Notification when Status Information (not status) changes

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
pato
Posts: 18
Joined: Thu Oct 10, 2013 6:06 pm
Location: Melbourne, Australia

Notification when Status Information (not status) changes

Post 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?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: Notification when Status Information (not status) change

Post 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.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Notification when Status Information (not status) change

Post 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.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
pato
Posts: 18
Joined: Thu Oct 10, 2013 6:06 pm
Location: Melbourne, Australia

Re: Notification when Status Information (not status) change

Post 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!
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Notification when Status Information (not status) change

Post by eloyd »

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!
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: Notification when Status Information (not status) change

Post 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.
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.
User avatar
eloyd
Cool Title Here
Posts: 2129
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: Notification when Status Information (not status) change

Post 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.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoydI'm a Nagios Fanatic!
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: Notification when Status Information (not status) change

Post by abrist »

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.
Locked