custom service notifications + NOTIFICATIONTYPE macro

Aaron Knister aaron.knister at gmail.com
Thu Oct 7 19:17:06 CEST 2010


Hi,

I'm using the custom service notification features of nagios 3 from my
event handler scripts. I noticed that custom service notifications
were being sent out with NOTIFICATIONTYPE set to recovery instead of
custom as the documentation indicates should be the case.  The "fix"
seemed fairly straightforward. Here's my patch:

diff -ur nagios-3.2.3/base/notifications.c nagios-3.2.3-new/base/notifications.c
--- nagios-3.2.3/base/notifications.c	2010-08-04 22:43:53.000000000 -0400
+++ nagios-3.2.3-new/base/notifications.c	2010-10-07 12:59:23.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


If anyone sees issues with it, please let me know.

-Aaron

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb




More information about the Developers mailing list