Page 1 of 1
Custom alert logic
Posted: Tue Feb 21, 2017 10:09 am
by guglez
Is it possible to send an alert only when critical event occurred more than 2 times during last hour?ing last hour? How to implement this logic?
Re: Custom alert logic
Posted: Tue Feb 21, 2017 11:34 am
by mcapra
This is a limitation within how Nagios Core dispatches notifications. More info about how that works on the back-end:
https://assets.nagios.com/downloads/nag ... tions.html
The decision to send out notifications is made in the service check and host check logic. The calculations for whether a notification is to be sent are only triggered when processing a host or service check corresponding to that notification; they are not triggered simply because the <notification_interval> has passed since a previous notification was sent. Host and service notifications occur in the following instances:
- When a hard state change occurs. More information on state types and hard state changes can be found here.
- When a host or service remains in a hard non-OK state and the time specified by the <notification_interval> option in the host or service definition has passed since the last notification was sent out (for that specified host or service).
Aside from that, you would probably have to leverage a custom notification handler to get that effect for dispatching emails.
Re: Custom alert logic
Posted: Tue Feb 21, 2017 11:38 am
by guglez
Hi @mcapra,
Do you have a document related to custom notification handlers?
Re: Custom alert logic
Posted: Tue Feb 21, 2017 12:06 pm
by dwhitfield
Customizing things pulls in a lot of XI pieces, but the place to start is understanding notification handlers in general. Page 5 of
https://assets.nagios.com/downloads/nag ... ios-XI.pdf has some info. You can look at our notification handlers, and then go from there. Please note that if you modify the built-in notification handlers, they will be overwritten when you upgrade XI. Also, it's highly likely other things won't work.
Of course, the link
@mcapra gave you will also help you understand. Please don't be confused that he sent you a Nagios Core doc. Nagios XI runs Nagios Core as the backend. If you look in your
/usr/local you'll see both a nagios dir and a nagiosxi dir (and other things). The nagios dir is Core.
I could also put in a feature request for more notification options, but the devs will prioritize those, so I can't tell you when/if it will be implemented. If you want me to put in a FR, please be specific in what you would like.
Lastly, we do offer custom dev for a fee. If you would be interested in that, please contact
[email protected].