Page 1 of 2

Nagios Global Event Handler

Posted: Wed Feb 15, 2012 2:42 am
by selvi
In the "Global Event Handler" Component, if we configure the shell file under the "Service State Change Handler Commands", when it will get execute? and how the Nagios monitor the system services?

Re: Nagios Global Event Handler

Posted: Wed Feb 15, 2012 10:31 am
by scottwilkerson
selvi wrote:In the "Global Event Handler" Component, if we configure the shell file under the "Service State Change Handler Commands", when it will get execute? ?
This will execute is the state of a service changes.
ie.
from OK to Warning
from Warning to OK
from OK to Critical
etc.

Re: Nagios Global Event Handler

Posted: Thu Feb 16, 2012 9:06 am
by selvi
Thank you for your timely reply for my doubt regarding event handler.

In Nagios i am able to see the change in host status ( OK - Critical and Critical - OK), but the Global Event Handler command was not executed ?

Re: Nagios Global Event Handler

Posted: Thu Feb 16, 2012 10:18 am
by scottwilkerson
Does the nagios user have permissions on the script you are attempting to run?

ie. from the command prompt, can you run

Code: Select all

su nagios -c '/path/to/the/event/handler.sh'
From our doc
http://assets.nagios.com/downloads/nagi ... ndlers.pdf
General Considerations
Keep these considerations in mind when utilizing global event handler commands:
• Global event handlers will run with the privileges of the nagios user on the local Nagios XI server
• Make sure event handlers execute quickly, so they can return control to Nagios XI to process other events
• Time-intensive global event handlers should be executed as a background or daemon process to prevent blocking behavior

Re: Nagios Global Event Handler

Posted: Fri Feb 17, 2012 8:05 am
by selvi
1) The User had the privilege to execute the Event Handler, but the event handler command was not executed when the host state and service state got changed.

2) In Reports --> Notification i can see the changes in state. i have configured Email notification for receiving the event status, but i am not receiving any emails. I have received sample test mail.

3) Exactly i want to know when the Global Event Handler will execute automatically, is there any way test it manually

Re: Nagios Global Event Handler

Posted: Fri Feb 17, 2012 5:28 pm
by scottwilkerson
I just tested this on my test machine and worked as expected.

Can you post the permissions of your script ie.

Code: Select all

ls -l /path/to/your/script.sh
Also, a screenshot of Admin -> Manage Components -> Global Event Handlers -> Edit

Thanks

Re: Nagios Global Event Handler

Posted: Sat Feb 18, 2012 6:33 am
by selvi
I have here by attached the screen shots of the Global Event handler and also the permission of shell file. Pls help me out regarding this.

Thanks for your reply....

Regards,
Selvi

Re: Nagios Global Event Handler

Posted: Sat Feb 18, 2012 8:53 am
by scottwilkerson
In your screen shots of the Global Event handler, I see a period . in front of the commands...

remove the . from the beginning of each command.

Re: Nagios Global Event Handler

Posted: Mon Feb 20, 2012 12:30 am
by selvi
We have already tried without . (dot) in the Event Handler but the command did not executed.

Re: Nagios Global Event Handler

Posted: Mon Feb 20, 2012 8:37 am
by scottwilkerson
For sure it shouldn't have the .

Also, form the command line it may be a good idea that the nagios user can execute the script and get the desired results

Code: Select all

su nagios -c '/root/SomClient/bin/somClient.sh'