Our development house uses NRPE to run Nagios checks on our remote servers. This is useful since we can run Nagios in one place and monitor several servers. NRPE is a plugin to Nagios (see http://nagios.sourceforge.net/docs/nrpe/NRPE.pdf).
I've written a module that exposes the checks in the Nagios module to drush so they can be called by an NRPE daemon running on the server. This is also a security enhancement as it doesn't expose this information through the Drupal web interface.
If you want to add this to the Nagios Module then I'd be happy to become co-maintainer with you. Alternately I can apply for a cvs account and make this a separate module, but it seems to me that merging them together would be better.
| Comment | File | Size | Author |
|---|---|---|---|
| #19 | 989932-19_nagios_drush_support.patch | 22.98 KB | greg.harvey |
| #20 | 989932-20_nagios_drush_support.patch | 5.73 KB | greg.harvey |
| #16 | 989932-16_nagios_drush_commands.patch | 5.78 KB | greg.harvey |
| #7 | 989932-7_nagios_nrpe_support.patch | 3.95 KB | hashmap |
| #6 | 989932-6_nagios_nrpe_support.patch | 6.61 KB | greg.harvey |
Comments
Comment #1
florian.cathala commentedsubscribing
Comment #2
Anonymous (not verified) commentedsubscribing.
Comment #3
greg.harveyThis is excellent - we are installing it on a stage server today and we'll see how it flies.
Comment #4
greg.harveyAnd here is a proper patch to review.
Comment #5
greg.harveyI realised when applying this patch with drush make I hadn't tidied up the paths properly. New patch fixes that and applies more cleanly.
Comment #6
greg.harveyWe discovered an issue (not with the module, but with necessary Linux set-up for the requirements checks to work) that should be noted in the README.txt file, so re-rolled the patch with a better README.
Can someone please review this. If you're not going to include it in the main Nagios package, then we should create a project for it.
Comment #7
hashmap commentedHere is a patch for Greg's patch.
I added the option of specifying multiple checks for one drush nrpe call, with a note in README.txt about syntax.
Also, dependencies was misspelled in the nagios_nrpe.info file. Fixed.
Comment #8
greg.harveySomething went wrong with attaching the last patch, but it was uploaded - it's here:
http://drupal.org/files/issues/989932-7_nagios_nrpe_support.patch
Comment #9
greg.harveyI'm now co-maintaining this, so here's the plan:
1. The patch in #6 needs to be re-rolled so it's actually part of the Nagios module. There's no need for it to be separate.
2. The patch in #7 should be taken to another issue - one step at a time. Wait to do that until #6 is actually released, then you can patch against dev with the suggestions in #7 in a new issue and we can review and include. I won't consider #7 in this issue at this point. I want to get the *already tested* code out the door.
Comment #10
Anonymous (not verified) commentedI think the 'NRPE' nature of this is overrated: these could simply become Drush commands for the Nagios module itself. NRPE would be able to run them simply by being able to execute arbitrary [command]'s per the nrpe.cfg.
Comment #11
greg.harveyExactly, that's the plan. Just the drush hooks and the include as part of the main Nagios module.
Comment #12
pescetti commentedSubscribing.
Comment #13
hashmap commentedUpon further testing, the patch I submitted (#7) does not work correctly. I will work on it some more and wait to submit again as suggested in #9.
Comment #14
greg.harveyThanks.
This is still a "feature request" assigned to me, btw. Please leave the issue categories alone - it's very annoying to have to keep changing them back... ;-)
Comment #15
greg.harveyOk, the attached is a patch bringing the NRPE module changes in to the main Nagios module. Here's what it does:
- Adds a drush include providing two drush commands
- One of those commands provides a couple of hooks to allow other modules to make additional NRPE checks
- Nagios implementations of those hooks in the main module file
- And, of course, updated README.txt
Please review and test.
Thanks! =)
Edit: For information, we're running this on a production server and it seems ok, so if we go a week without problems I'll make this R&TBC and get it committed.
Comment #16
greg.harveyAnd I forgot the actual patch! *sigh*
Comment #17
Anonymous (not verified) commentedWhat I meant in #10 is that we don't really need any references to 'nrpe' in the code at all. The fact that NRPE could execute the drush commands is implicit (NRPE could theoretically query *any* drush command that is written to return the appropriate return codes to Nagios (and note that the return codes are Nagios, and not NRPE, specific)
But if it's easier to have the nrpe references in there (in the command names, functions, etc), then that's fine too.
In other words what I mean is that this should really be about providing nagios drush commands, and not nagios nrpe drush commands. (You might want to run 'drush nagios requirements' or something from the cli and you ought to have no real reason to add 'nrpe' to do so)
Comment #18
greg.harveyAhh, I gotcha. I can do that, we'll just have to update our Nagios conf, but you know that already. ;-)
Let me work on that this afternoon.
Comment #19
greg.harvey** DO NOT USE **
Alright, here's a patch implementing Mig's suggestion. Mig, fyi, it's running on stage.enigma1 if you want to check it out.
Comment #20
greg.harveyIgnore that last patch, I forgot to delete all the crud from the d.o packager... use this one!
Comment #21
greg.harveyNow running #20 on a stage *and* on a production server. It's running on a three-site multisite for one of our bigger customers, so far, so good. I'll let it run over the weekend and if there are no problems I'll mark this R&TBC.
Comment #22
greg.harveyOk, #20 has been fine and stable for a few weeks now, so committed. Thanks to Josh for the work on this, it's a great addition!