Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: Pure Perl Big Brother and Nagios clients: ideas? code bits?

by pileofrogs (Priest)
on Apr 25, 2012 at 20:01 UTC ( #967157=note: print w/ replies, xml ) Need Help??


in reply to Pure Perl Big Brother and Nagios clients: ideas? code bits?

The best thing I ever did with Nagios was defining my tests in the test and not in the nagios server.

That probably doesn't make sense and I bet there is an actual term for what I'm trying to describe. Basically, you make your tests produce something like TAP output that says "I'm about to test blah. I expect blah. I got blah... " and so on. Then your nagios plugin just has to interpret the results, instead of interpreting the behavior of the service.

Why is that cool? Every time you change a test you have to alter the bit that runs the test and then alter the bit that interprets the test to match. If you use a test that describes itself, you don't need the test description to be on the nagios server. You can change the test on the tested server and you're done. It makes developement and maintenance of tests soooo much easier.

Hooo... I bet that didn't make sense either...

Example: You have a web server that runs SSI and you want to test that SSI is working. Later you decide you want to make sure that exec is disabled.

Normal: You create a web page that uses SSI. You set up a nagios plugin to read that page. Later you add something that uses SSI exec to the page. You edit the nagios plugin to look for evidence that the SSI exec failed.

Better: You create a web page that tests SSI and produces the results as something parseable*. You set up nagios to read that page and parse the test results. Later you edit the web page that tests SSI and produces the parseable results. No fiddling with nagios required.

*Parseable test results can be super simple. I do a thing where h3 blocks containing test names are followed by two h2 blocks containing the literal expected output followed by the generated output. If the expected matches the generated, test passes.

Wheeee... I hope that made sense and doesn't sound too stupid!

--Pileofrogs


Comment on Re: Pure Perl Big Brother and Nagios clients: ideas? code bits?
Re^2: Pure Perl Big Brother and Nagios clients: ideas? code bits?
by spartan (Pilgrim) on Apr 25, 2012 at 21:43 UTC
    I hope this is not too much to ask, but can you provide a complete example please.

    My guess is this is no small feat for you, but I would really like to simplify checks. I'll leave it up to you as to how to provide a complete example, but beg you to do so in any form.

    Very funny Scotty... Now PLEASE beam down my PANTS!

      Sorry, I've been away for a time. I doubt this is still something you need, but what the hey.

      I use s system where H2 tags mean a test name and H3 tags mean an expected value and a dynamic value sooo

      <h1>My Tests</h1> <p>Heres some text that my parser will ignore!</p> <h2>SSI ENABLED</h2> <h3>foobarbaz</h3> <h3><!--#echo "foobarbaz" --></h3> <h2>SSI EXEC PROHIBITED</h2> <h3>[error: exec forbidden]</h3> <h3><!-- #exec cmd="echo Holy Crap" --></h3>

      Writing the parser as a nagios module is an exercise left up to the reader...

      Also, the SSI above is made-up and won't really work.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://967157]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2014-07-29 04:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (211 votes), past polls