Event handler sending notifications after every check

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
aceadm
Posts: 23
Joined: Thu Jun 11, 2020 8:13 am

Event handler sending notifications after every check

Post by aceadm »

Might be a starter question but after I set up my own event handler and placed it on a host (basically a script sending an alarm), I am getting an alarm every 5 minutes (every check that nagios does basically). I've read about Soft and Hard state of hosts but didn't figure how to stop this behaviour.
I need to have the event handler work once, everytime the state changes and not everytime the check is happening and the state is the same.

Thanks in advance.
benjaminsmith
Posts: 5324
Joined: Wed Aug 22, 2018 4:39 pm
Location: saint paul

Re: Event handler sending notifications after every check

Post by benjaminsmith »

Hi @aceadm,

It sounds like the stat is changing frequently for this check and I would recommend checking the State History report to see what's happening, event handlers are called under the following conditions:
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
You can also gain greater control of when Event Handlers are called by adding some logic to script and checking against standard macros, examples in the guide below.
Nagios XI Introduction to Event Handlers

Let me know what you find out when viewing the state history, Reports > State History, and select both state types.
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!
aceadm
Posts: 23
Joined: Thu Jun 11, 2020 8:13 am

Re: Event handler sending notifications after every check

Post by aceadm »

benjaminsmith wrote:Hi @aceadm,

It sounds like the stat is changing frequently for this check and I would recommend checking the State History report to see what's happening, event handlers are called under the following conditions:
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
You can also gain greater control of when Event Handlers are called by adding some logic to script and checking against standard macros, examples in the guide below.
Nagios XI Introduction to Event Handlers

Let me know what you find out when viewing the state history, Reports > State History, and select both state types.
You were right, I had to stop all SOFT messages from my script and pass only the HARD state type as I found in this post:
https://support.nagios.com/forum/viewto ... =6&t=51416

Thank you for your help!
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: Event handler sending notifications after every check

Post by scottwilkerson »

aceadm wrote:
benjaminsmith wrote:Hi @aceadm,

It sounds like the stat is changing frequently for this check and I would recommend checking the State History report to see what's happening, event handlers are called under the following conditions:
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
You can also gain greater control of when Event Handlers are called by adding some logic to script and checking against standard macros, examples in the guide below.
Nagios XI Introduction to Event Handlers

Let me know what you find out when viewing the state history, Reports > State History, and select both state types.
You were right, I had to stop all SOFT messages from my script and pass only the HARD state type as I found in this post:
https://support.nagios.com/forum/viewto ... =6&t=51416

Thank you for your help!
May we close this case?
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked