Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??

A really sharp architect named Jeremy Bumpus once showed me that it was straightforward to write a script that could speak with a Big Brother server, and thus do tests independent of the BB client. The advantage, of course, is that you don't have to jump through hoops to get the bb user to run tests that only a privileged user should. The code uses IO::Socket, which has been a part of every Perl I've tested, even stripped down system Perls.

A bit of test code (half pseudocode) might look something like this:
my $bbhost = $ENV{BBHOST}; my $machine = `hostname`; chomp($machine); if ( -f $bbhost/etc/bbaliasname ) { # fetch aliasname and assign it to machine. } # $test would be the name of the test as BB displays it. my $test = "app"; # green, yellow and red are alert levels. my $color = 'green'; # # run test here, reset color if necessary # my $conn = new IO::Socket::INET ( PeerAddr => 'my_bb_server.domain.biz', PeerPort => '1984', Proto => 'tcp', ) || warn("Cannot create socket to port 1984 on localhost\n"); my $date = `date`; print $conn "status $machine.$test $color $date "; print $conn "test blah blah blah.\n"; print $conn "moretestinfo"; close($conn);

The cool thing about this test is that it can be run on servers that don't have a compiler (the ordinary BB client install requires cc and make), leading to the notion that the whole bb-local client piece could be replaced with a pure Perl solution on servers for which, for business reasons, you can't install a compiler and for which you have no dev or QA systems to compile from.

And since I've written some tests of this kind for Big Brother, it's making me wonder how much of this technology is transferrable to Nagios. Yes, things aren't entirely thought out or thought through, and I'm fishing for ideas here, particularly from the Perl enabled folks who might understand Nagios client to server protocols.

All I'm trying to do is push some useful tests across a broad heterogenous enterprise, where the monitoring solution in place can go from Big Brother to Big Sister to free Nagios to commercial Nagios to Icinga to Zenoss. Some Perl tools for Joe Admin would be appreciated.

Thanks!

David


In reply to Pure Perl Big Brother and Nagios clients: ideas? code bits? by dwm042

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others studying the Monastery: (12)
    As of 2014-12-18 19:38 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      Is guessing a good strategy for surviving in the IT business?





      Results (61 votes), past polls