Event Handler for a service

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
FCC_Nagios_Support
Posts: 161
Joined: Tue Mar 10, 2020 11:07 am

Event Handler for a service

Post by FCC_Nagios_Support »

Good morning,

I was taking a look to event_handler in Nagios Core and it specifies an event handler as a trigger such as bellow
define service{
host_name somehost
service_description HTTP
max_check_attempts 4
event_handler restart-httpd
...
}
Once the service has been defined with an event handler, we must define that event handler as a command. An example command definition for restart-httpd is shown below. Notice the macros in the command line that I am passing to the event handler script - these are important!

define command{
command_name restart-httpd
command_line /usr/local/nagios/libexec/eventhandlers/restart-httpd $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$
}
Now, let's actually write the event handler script (this is the /usr/local/nagios/libexec/eventhandlers/restart-httpd script).

SO I UNDERSTAND WHEN THE SERVICE GOES DOWN THE SCRIPT IS TRIGGERED AND THE THE SERVICE IS RESTARTED.

HOW CAN CONFIGURE THIS IN NAGIOSXI

MANY THANKS IN ADVANCE
KIND REGARDS
User avatar
jbrunkow
Posts: 441
Joined: Fri Mar 13, 2020 10:45 am

Re: Event Handler for a service

Post by jbrunkow »

I recommend following the following linked documentation for detailed instructions on how to set up an event handler in Nagios XI.
INTRODUCTION TO EVENT HANDLERS
It sounds like you have already completed several of the steps outlined in it. :D

You may just need to navigate to the Admin section of XI using the bar on top > then click Manage Components under System Extensions on the left pane > click the wrench icon to enter the configuration menu > and enter your command there.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.

Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked