perform event handler before notification

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
michalwozniakm
Posts: 3
Joined: Tue Apr 07, 2015 5:48 am

perform event handler before notification

Post by michalwozniakm »

I have problem with eventhandler and notification order. I try to use event handler uptool_handler. When there isn't notification sent (SOFT states event handler is invoked just after check perform - perfect)
but: when there's problem with sending email I haveto wait 30 seconds for timeout. I know, that I can lower the timeout value but it is not the solution. Even if sending mail will lats 4 seconds it is too much to wait for executing event handler.
It would be perfect if I can configure notifications to be sent AFTER executing event handler. Is it possible?



Informational Message[2015-04-07 10:54:02] SERVICE EVENT HANDLER: onet3;HTTP;CRITICAL;HARD;3;uptool_handler
Informational Message[2015-04-07 10:54:02] Warning: Contact 'nagios' service notification command '/usr/bin/printf "%b" "From: nnn \nSubject: ** PROBLEM alert - onet3/HTTP is CRITICAL **\nTo: root\n\n***** nnn *****\n\nNotification Type: PROBLEM\n\nService: HTTP\nHost: onet3 (onet3)\nAddress: onet.pl\nState: CRITICAL\n [.....] root' timed out after 30 seconds
Service Notification[2015-04-07 10:53:31] SERVICE NOTIFICATION: nagios;onet3;HTTP;CRITICAL;notify-by-email;STATUS_NUMBER: 2
Service Notification[2015-04-07 10:53:29] SERVICE NOTIFICATION: michal;onet3;HTTP;CRITICAL;notify-by-sms;STATUS_NUMBER: 2
Service Critical[2015-04-07 10:53:29] SERVICE ALERT: onet3;HTTP;CRITICAL;HARD;3;STATUS_NUMBER: 2
Informational Message[2015-04-07 10:52:29] SERVICE EVENT HANDLER: onet3;HTTP;CRITICAL;SOFT;2;uptool_handler
Service Critical[2015-04-07 10:52:29] SERVICE ALERT: onet3;HTTP;CRITICAL;SOFT;2;STATUS_NUMBER: 2
Informational Message[2015-04-07 10:51:29] SERVICE EVENT HANDLER: onet3;HTTP;CRITICAL;SOFT;1;uptool_handler
Service Critical[2015-04-07 10:51:29] SERVICE ALERT: onet3;HTTP;CRITICAL;SOFT;1;STATUS_NUMBER: 2
jdalrymple
Skynet Drone
Posts: 2620
Joined: Wed Feb 11, 2015 1:56 pm

Re: perform event handler before notification

Post by jdalrymple »

It is not.

Are you not using these notifications? If not, just disable them for that service? If so - maybe create a custom event handler that sends the notification when the state is hard?
http://nagios.sourceforge.net/docs/3_0/ ... estatetype
It would be elaborate, but it's the only solution that comes to mind.
michalwozniakm
Posts: 3
Joined: Tue Apr 07, 2015 5:48 am

Re: perform event handler before notification

Post by michalwozniakm »

jdalrymple wrote:Are you not using these notifications?
Unfortunatelly i have to use notifications for this service.
I thought about sending notification from eventhandler, or otherwise: use notification to do what I want to do in eventhandler, but theese are not so elegant solutions...
BTW I don't understand, why notifications are performer before eventhandlers.
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: perform event handler before notification

Post by abrist »

michalwozniakm wrote:TW I don't understand, why notifications are performer before eventhandlers.
This is most likely the case as most people want to receive their notifications as soon as possible - if the event handler was timing out, this would add time before the alert is notified on.
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