Problem with Event Handler



I’ve got a event handler script, that it calls an another script.

If I execute the first script, with the nagios user, it works (the second script is executed). But if this is executed by Nagios, only runs the first script, but the call to the second script doesn’t work.

Both have the same permisions and the same owner (nagios).

Any idea?



define service{ host_name somehost service_description HTTP max_check_attempts 4 event_handler restart-httpd ...other service variables... } define command{ command_name restart-httpd command_line /usr/local/nagios/libexec/eventhandlers/restart-httpd $SERVICESTATE$ $STATETYPE$ $SERVICEATTEMPT$ }

Let’s say these are your definitins. You could redirect the error to some file, let’s say /tmp/event.error by modifying command_line in command definition, like this:

Then let the nagios execute it, and see what is the output in /tmp/event.error

If the script is written with #!/bin/sh, try to turn it into #!/bin/bash. I had the similar problem and it solved it, by turning the script to #!/bin/bash