Notification when Status Information (not status) changes

Engage with the community of users including those using the open source solutions.
Includes Nagios Core, Plugins, and NCPA

Notification when Status Information (not status) changes

Postby pato » Sun Nov 23, 2014 11:23 pm

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?
pato
 
Posts: 18
Joined: Thu Oct 10, 2013 6:06 pm
Location: Melbourne, Australia

Re: Notification when Status Information (not status) change

Postby Box293 » Mon Nov 24, 2014 1:18 am

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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
Box293
Too Basu
 
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia

Re: Notification when Status Information (not status) change

Postby eloyd » Mon Nov 24, 2014 2:44 pm

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.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
User avatar
eloyd
Cool Title Here
 
Posts: 2091
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY

Re: Notification when Status Information (not status) change

Postby pato » Mon Nov 24, 2014 3:44 pm

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!
pato
 
Posts: 18
Joined: Thu Oct 10, 2013 6:06 pm
Location: Melbourne, Australia

Re: Notification when Status Information (not status) change

Postby eloyd » Mon Nov 24, 2014 4:03 pm

Well, I wouldn't say it's "brilliant" exactly. "Stunning," maybe. :-)

Let me know if you need help.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
User avatar
eloyd
Cool Title Here
 
Posts: 2091
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY

Re: Notification when Status Information (not status) change

Postby sreinhardt » Tue Nov 25, 2014 11:49 am

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.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
sreinhardt
-fno-stack-protector
 
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Notification when Status Information (not status) change

Postby eloyd » Tue Nov 25, 2014 12:02 pm

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.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
User avatar
eloyd
Cool Title Here
 
Posts: 2091
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY

Re: Notification when Status Information (not status) change

Postby abrist » Tue Nov 25, 2014 4:28 pm

Proper "Killer" would entail the Pony Express, electrodes, Clint Eastwood, and lasers.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
abrist
Red Shirt
 
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm


Return to Community Support

Who is online

Users browsing this forum: Google [Bot] and 35 guests