Nagios Global Event Handler

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
selvi
Posts: 12
Joined: Wed Feb 15, 2012 12:24 am

Nagios Global Event Handler

Post 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?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Global Event Handler

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
selvi
Posts: 12
Joined: Wed Feb 15, 2012 12:24 am

Re: Nagios Global Event Handler

Post 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 ?
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Global Event Handler

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
selvi
Posts: 12
Joined: Wed Feb 15, 2012 12:24 am

Re: Nagios Global Event Handler

Post 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
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Global Event Handler

Post 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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
selvi
Posts: 12
Joined: Wed Feb 15, 2012 12:24 am

Re: Nagios Global Event Handler

Post 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
You do not have the required permissions to view the files attached to this post.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Global Event Handler

Post 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.
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
selvi
Posts: 12
Joined: Wed Feb 15, 2012 12:24 am

Re: Nagios Global Event Handler

Post by selvi »

We have already tried without . (dot) in the Event Handler but the command did not executed.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Nagios Global Event Handler

Post 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'
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked