Hi lists, Some time ago I talked about using a script for resetting traps; I just made one. Unfortunately Nagios::Config was way too buggy to work on complex configs so I went up with a solution using Nagios::StatusLog.
The command looks like this:
./TrapReset.pl -c /path/to/nagios.cfg
It will look up the status and command files from the Nagios config, parse
the status and then force an active check for services matching these
criterias:
1. Should not be scheduled to be checked
2. Has active checks enabled
On my setup this roughly translate to all my traps (They all have the
following proprieties: check_period none; max_check_attempts 1; is_volatile
1; active_checks_enabled 1 )
Alternatively you can look in the code and replace:
if ($$log{'SERVICE'}{$host}{$service}{'should_be_scheduled'} == 0 &&
$$log{'SERVICE'}{$host}{$service}{'active_checks_enabled'} == 1) {
With the following line (already there, commented-out):
if ($service =~ /^.+Trap$/) {
Where '^.+Trap$' is the regexp to match. It will use the regexp to match
services on which to run a forced check. You can also change the command
sent, say if you want to submit passive check results instead.
This is by no way a finished product and I assume the user has at least
basic Perl programming skills to make this program suit his needs.
Thomas
TrapReset.pl
Description: Binary data
smime.p7s
Description: S/MIME cryptographic signature
------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________ Nagios-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/nagios-users ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue. ::: Messages without supporting info will risk being sent to /dev/null
