[dev.icinga.com #950] NOTIFICATIONTYPE MACRO never became CUSTOM #437

Closed
icinga-migration opened this Issue Nov 2, 2010 · 2 comments

Projects

None yet

1 participant

@icinga-migration
Member

This issue has been migrated from Redmine: https://dev.icinga.com/issues/950

Created by mfriedrich on 2010-11-02 17:46:20 +00:00

Assignee: mfriedrich
Status: Resolved (closed on 2010-11-09 16:13:28 +00:00)
Target Version: 1.3
Last Update: 2010-11-09 16:13:28 +00:00 (in Redmine)


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 
@icinga-migration
Member

Updated by mfriedrich on 2010-11-05 07:23:15 +00:00

  • Status changed from New to Assigned
  • Assigned to set to mfriedrich
  • Target Version set to 1.3
@icinga-migration
Member

Updated by mfriedrich on 2010-11-09 16:13:28 +00:00

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

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

@icinga-migration icinga-migration added this to the 1.3 milestone Jan 17, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment