Nagios Bug and Feature Tracker
Bug and Feature Tracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0000168 [Nagios Core] Notifications tweak always 2010-10-24 11:55 2012-04-21 07:02
Reporter dvoryanchikov View Status public  
Assigned To estanley
Priority normal Resolution fixed  
Status resolved   Product Version
Summary 0000168: 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
Tags No tags attached.
Nagios Version 3.2.3
OS any
OS Version any
Attached Files ? file icon nagios_macro_notificationtype_custom.patch [^] (1,042 bytes) 2010-10-24 11:55

- Relationships

-  Notes
(0000417)
estanley (administrator)
2012-04-21 07:02

Patch applied.

- Issue History
Date Modified Username Field Change
2010-10-24 11:55 dvoryanchikov New Issue
2010-10-24 11:55 dvoryanchikov File Added: nagios_macro_notificationtype_custom.patch
2010-10-24 11:55 dvoryanchikov Nagios Version => 3.2.3
2010-10-24 11:55 dvoryanchikov OS => any
2010-10-24 11:55 dvoryanchikov OS Version => any
2012-04-21 07:02 estanley Note Added: 0000417
2012-04-21 07:02 estanley Status new => resolved
2012-04-21 07:02 estanley Resolution open => fixed
2012-04-21 07:02 estanley Assigned To => estanley


Mantis 1.1.7[^]
Copyright © 2000 - 2008 Mantis Group
Powered by Mantis Bugtracker