Page 1 of 1

Notification when Status Information (not status) changes

PostPosted: Sun Nov 23, 2014 11:23 pm
by pato
Hi all,

I've got a service check which reads from a log4net database and reports back on matching rows indicating a particular error. A column from the row (job number) is returned in the notification as status information ($SERVICEOUTPUT$). I encountered behaviour today in which one row is returned, triggering a CRITICAL status change and a notification. However, immediately after resolving this, another row is generated from a new error. The status information changes, as it's a new job number, but the status is still CRITICAL, so no new notification is issued. Aside from configuring periodic repeat notifications, can I trigger additional notifications on a status information change?

Re: Notification when Status Information (not status) change

PostPosted: Mon Nov 24, 2014 1:18 am
by Box293
No, because it is the state of the service that triggers when it changes from OK / WARNING / CRITICAL / UNKNOWN. Just because the wording of the status changes does not make any difference if the service is already in a hard critical state. When it sends it's next notification the updated text will be sent in the notification.

Re: Notification when Status Information (not status) change

PostPosted: Mon Nov 24, 2014 2:44 pm
by eloyd
You can cheat and make the service trigger an event handler, pass the state and status to the event handler which saves the last copy of the status information somewhere (temp file) and compares the new status to the old status. If it's not the same, then send an email. This way, Nagios still does the scheduling, but you're doing an end run around the notification logic.

Re: Notification when Status Information (not status) change

PostPosted: Mon Nov 24, 2014 3:44 pm
by pato
eloyd wrote:You can cheat and make the service trigger an event handler, pass the state and status to the event handler which saves the last copy of the status information somewhere (temp file) and compares the new status to the old status. If it's not the same, then send an email. This way, Nagios still does the scheduling, but you're doing an end run around the notification logic.


That's brilliant and looks like exactly what I need. Thank you so much!

Re: Notification when Status Information (not status) change

PostPosted: Mon Nov 24, 2014 4:03 pm
by eloyd
Well, I wouldn't say it's "brilliant" exactly. "Stunning," maybe. :-)

Let me know if you need help.

Re: Notification when Status Information (not status) change

PostPosted: Tue Nov 25, 2014 11:49 am
by sreinhardt
You could also set the service to have isvolatile on. However it should be noted this will send on every warning\critical result not just when the status messages change. Otherwise I'd agree that eloyd's idea sounds like a pretty killer way of handling it.

Re: Notification when Status Information (not status) change

PostPosted: Tue Nov 25, 2014 12:02 pm
by eloyd
No, "killer" would be to have the event handler figure out if it should notify, and then send the command back to the Nagios command pipe to do the notification. That would be killer.

Re: Notification when Status Information (not status) change

PostPosted: Tue Nov 25, 2014 4:28 pm
by abrist
Proper "Killer" would entail the Pony Express, electrodes, Clint Eastwood, and lasers.