Bug #950

NOTIFICATIONTYPE MACRO never became CUSTOM

Added by dnsmichi over 3 years ago. Updated over 3 years ago.

Status:ResolvedStart date:11/02/2010
Priority:NormalDue date:
Assignee:dnsmichi% Done:

100%

Category:-
Target version:Icinga 1.x - 1.3
Icinga Version: OS Version:

Description

http://docs.icinga.org/latest/en/macrolist.html#macrolist-notificationcomment

A string containing the comment that was entered by the notification author. If the $NOTIFICATIONTYPE$ macro is set to "DOWNTIMESTART" or "DOWNTIMEEND", this will be the comment entered by the user who scheduled downtime for the host or service. If the $NOTIFICATIONTYPE$ macro is "ACKNOWLEDGEMENT", this will be the comment entered by the user who acknowledged the host or service problem. If the $NOTIFICATIONTYPE$ macro is "CUSTOM", this will be comment entered by the user who initated the custom host or service notification.

http://docs.icinga.org/latest/en/macrolist.html#macrolist-notificationtype

A string identifying the type of notification that is being sent ("PROBLEM", "RECOVERY", "ACKNOWLEDGEMENT", "FLAPPINGSTART", "FLAPPINGSTOP", "FLAPPINGDISABLED", "DOWNTIMESTART", "DOWNTIMEEND", or "DOWNTIMECANCELLED").

http://tracker.nagios.org/view.php?id=168

NOTIFICATIONTYPE MACRO is never became CUSTOM
Description     Documentation at http://nagios.sourceforge.net/docs/3_0/ [^] says, that
if the $NOTIFICATIONTYPE$ macro is "CUSTOM", $NOTIFICATIONCOMMENT$ macro will be comment entered by the user who initated the custom host or service notification
(http://nagios.sourceforge.net/docs/3_0/macrolist.html#notificationcomment). [^]

But $NOTIFICATIONTYPE$ value can be only
"PROBLEM", "RECOVERY", "ACKNOWLEDGEMENT", "FLAPPINGSTART", "FLAPPINGSTOP", "FLAPPINGDISABLED", "DOWNTIMESTART", "DOWNTIMEEND", or "DOWNTIMECANCELLED" 
(http://nagios.sourceforge.net/docs/3_0/macrolist.html#notificationtype). [^]

I have a bash script handler, which defines different text of notification depending on $NAGIOS_NOTIFICATIONTYPE environment variable value, and in case of custom host or service notification (for example, when user is requesting to send a custom host/service notification with web interface /nagios/cgi-bin/cmd.cgi?cmd_typ=159 and /nagios/cgi-bin/cmd.cgi?cmd_typ=160 ) it sends same text as if it was "RECOVERY" because of wrong $NOTIFICATIONTYPE$ value.

I found a mistype and fixed it with patch below.
Please commit it.

Best Regards,
Alexey Dvoryanchikov.

Additional Information     

--- ./base/notifications.c~ 2010-10-05 13:29:09.000000000 +0400
+++ ./base/notifications.c 2010-10-24 19:54:06.000000000 +0400
@@ -190,6 +190,8 @@
             macro_x[MACRO_NOTIFICATIONTYPE]=(char *)strdup("DOWNTIMEEND");
         else if(type==NOTIFICATION_DOWNTIMECANCELLED)
             macro_x[MACRO_NOTIFICATIONTYPE]=(char *)strdup("DOWNTIMECANCELLED");
+ else if(type==NOTIFICATION_CUSTOM)
+ macro_x[MACRO_NOTIFICATIONTYPE]=(char *)strdup("CUSTOM");
         else if(svc->current_state==STATE_OK)
             macro_x[MACRO_NOTIFICATIONTYPE]=(char *)strdup("RECOVERY");
         else
@@ -1108,6 +1110,8 @@
             macro_x[MACRO_NOTIFICATIONTYPE]=(char *)strdup("DOWNTIMEEND");
         else if(type==NOTIFICATION_DOWNTIMECANCELLED)
             macro_x[MACRO_NOTIFICATIONTYPE]=(char *)strdup("DOWNTIMECANCELLED");
+ else if(type==NOTIFICATION_CUSTOM)
+ macro_x[MACRO_NOTIFICATIONTYPE]=(char *)strdup("CUSTOM");
         else if(hst->current_state==HOST_UP)
             macro_x[MACRO_NOTIFICATIONTYPE]=(char *)strdup("RECOVERY");
         else 

History

#1 Updated by dnsmichi over 3 years ago

  • Status changed from New to Assigned
  • Assignee set to dnsmichi
  • Target version set to 1.3

#2 Updated by dnsmichi over 3 years ago

  • Status changed from Assigned to Resolved
  • % Done changed from 0 to 100

typed 'ä' instead of '#' now no reference. is resolved in git master.

Also available in: Atom PDF