You are here

Issues with custom notification script

3 posts / 0 new
Last post
Ryan Shaw
rshaw_1's picture
Issues with custom notification script

I'm trying to create a notification that will trigger a NRPE message that then calls our phones.  We're replacing an existing system with this as a drop-in, which is part of the reason we're using this approach.

Anyways, I have a perl script that parses the information and passes it to nrpe.  When I use "/usr/local/nagios/utils/test_notifications hostproblem" to test it, the script runs and command completes jsut fine and I get my call.  After configuring it in Notification Methods, I can see it in misc_commands.cfg, so it linked in properly.  I have added it both to shared notification profiles, as well as the main admin one, with 24x7 time period and all defaults.  When I trigger a failure though, I get an e-mail from the e-mail notification just fine, but no phone call

I added some commands to teh script to write to syslog at various stages, and I'm not seeing any of these showing up when I trigger it through a failed check, just the e-mail ones.  Again, if I run the test command, it works just fine and all the debug checks show up.

 

Is there anywhere else I can look for further debug information?  Is there anything else I can easily check that I may have missed?  The fact it works fine when I run the test, both as root and as sudo -u nagios, tells me the script itself and permissions look to be just fine, but all the settings in the shared notificaiton profiles, and under the user's notifications, look to be fine also.

Duncan Ferguson
dferguson's picture
Ryan,

Ryan,

Check the nagios/var/nagios.log file for any references to the host and service that should trigger the notification - this may provide some information about why it hasnt triggered.

An easy way to do this is to use "nlcat NOTIFICATION" as the nagios user which will search the current log for the given string and convert the timestamps to date/time in the output.

When you test your notification meethod, are you running it while being in the root directory rather than libexec/notifications?  This is how nagios will run the script, so any relative paths within the script may not work as expected.

  Duncs

Ryan Shaw
rshaw_1's picture
That log was what I was

That log was what I was looking for, thank you!  It turns out at some point I ahd fixed the problem, but my debug statement to make sure I had fixed it was breaking things.  Once I removed that, I was able to see it execute successfully