Are Nagios XI Event Handlers called on startup.

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
ian r smo
Posts: 3
Joined: Wed Apr 15, 2020 9:33 am

Are Nagios XI Event Handlers called on startup.

Post by ian r smo »

We are planning to monitor Switches using Nagios XI triggering an event handler to call an exe when a switch changes state, to send a message into our system software. My question is when the Nagio XI Computer/Software restarts will Nagio XI call the event handlers for the states of the switches, or will it only call the event handler exe when there is a change of state in the Switch?

Example: switches A and B are up, switch A has an error, Switch B has no error. The Nagio XI is started, the state of the switches do not change. Will the error event handle for switch A be called? and no error event handle (error cleared) for Switch B be called?

I apologise for asking a question that I would normally find the answer by trying it, but I am currently unable to access the equipment due to Covid-19 lockdown.
User avatar
jbrunkow
Posts: 441
Joined: Fri Mar 13, 2020 10:45 am

Re: Are Nagios XI Event Handlers called on startup.

Post by jbrunkow »

I do not believe that the event handlers are triggered immediately after startup.
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
Please refer to the following linked documentation for more information about how event handlers operate in Nagios.
https://assets.nagios.com/downloads/nag ... dlers.html

The state of the host or service upon startup is stored in the retention.dat file.

Nagios Core - Understanding retention.dat and modified_attributes

It is also worth mentioning that this feature is highly configurable, and you may need to look in /usr/local/nagios/libexec/eventhandlers/, your nagios.cfg file, or objects.cache file.
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!
ian r smo
Posts: 3
Joined: Wed Apr 15, 2020 9:33 am

Re: Are Nagios XI Event Handlers called on startup.

Post by ian r smo »

Thankyou for your replay.
My understanding from the “Understanding retention.dat” link is that if we have the follow sequence:-
1) Nagios XI running monitoring switches. Switch A has no faults. Switch B has a fault.
2) Nagios XI machine shutdown.
3) Fault occurs on a Switch A while Nagios XI machine shutdown.
4) The fault on Switch B is cleared while Nagios XI machine is shutdown.
5) Nagios XI machine restarts.
Then Switch A fault occurred event handler for the would be called, and the Switch B fault occurred event handle would be called. Would this be correct?

Alternatively if as part of our start-up of Nagios XI we replaced retention.dat file with one that indicates there are no errors then would it always trigger all the fault occurred event handler for any fault that is present?
ssax
Dreams In Code
Posts: 7682
Joined: Wed Feb 11, 2015 12:54 pm

Re: Are Nagios XI Event Handlers called on startup.

Post by ssax »

Event handlers are executed when a service or host:

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

Code: Select all

https://assets.nagios.com/downloads/nagioscore/docs/nagioscore/4/en/eventhandlers.html
So that means that if when the XI machine starts back up if Switch A is still in a problem state it should fire the event handler on the next check (they happen during the checks) since it would be in a SOFT problem state (#1).

Since Switch B was in a problem state, the next check would be an OK (since it recovered when XI was down), this would be the initial recovery (#3) and the event handler would be called.
Locked