Nagios Event Handler script not working

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
joash0809
Posts: 14
Joined: Wed Jul 29, 2020 9:26 am

Nagios Event Handler script not working

Post by joash0809 »

Hi Nagios Support,

I created an event handler script, to write into a log file every time a service hits critical hard state. I've defined the command of the event handler as shown in the nagios documentation for event handler. However, I'm using the standard macros that already available in nagios. The issue is when event handler is unable to complete and nothing is written in the log file. when i tried to run the script in the backend by manually inputting the variables then it is able to write the output to the log file. attaching the event handler script as well.
You do not have the required permissions to view the files attached to this post.
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Nagios Event Handler script not working

Post by ssax »

The main issue I see with event handler scripts is related to permissions (testing as root and then nagios can't write to the log file) so double-check the permissions on the log file and the executable.

Please confirm that when you're testing that the host/service is meeting these requirements:
- This is the most common reason why it's not kicked off when you expect
Event handlers are executed when a service or host:

Is in a SOFT problem state
Initially goes into a HARD problem state
Initially recovers from a SOFT or HARD problem state
Taken from here:

https://assets.nagios.com/downloads/nag ... dlers.html

Other than that, there is another option in your /usr/local/nagios/etc/nagios.cfg that you can use to set some old nagios environmental macros (you can set to 1 to enable them and restart the nagios process, zero is the default):

Code: Select all

enable_environment_macros=0
Please PM me a copy of your profile.zip, you can download it from Admin > System Profile by clicking the Download Profile button.
Locked