Title: [opsview] [12201] Fixed adding custom contact variables from notification methods into environment variables for notification scripts to use
Revision
12201
Author
tvoon
Date
2013-04-30 12:53:19 +0100 (Tue, 30 Apr 2013)

Log Message

Fixed adding custom contact variables from notification methods into environment variables for notification scripts to use

Modified Paths

Modified: trunk/CHANGES
===================================================================
--- trunk/CHANGES	2013-04-29 15:18:04 UTC (rev 12200)
+++ trunk/CHANGES	2013-04-30 11:53:19 UTC (rev 12201)
@@ -32,6 +32,7 @@
     Fixed check_snmp_ifstatus plugin to cope with gaps in nodes when polling SNMP interfaces
     Fixed SNMP polling of device interfaces with no ifDescr set
     Fixed paths to images in events view and dashboard splash page for a rehomed web app
+    Fixed adding custom contact variables from notification methods into environment variables for notification scripts to use
 
 3.20130304
     ENHANCEMENTS:

Modified: trunk/opsview-core/bin/nagconfgen.pl
===================================================================
--- trunk/opsview-core/bin/nagconfgen.pl	2013-04-29 15:18:04 UTC (rev 12200)
+++ trunk/opsview-core/bin/nagconfgen.pl	2013-04-30 11:53:19 UTC (rev 12201)
@@ -2284,7 +2284,17 @@
 	command_name notify-by-" . $notificationmethod->nagios_name . "
 	command_line " . $notificationmethod->command_line . "
 ";
-        foreach my $env ( split( ",", $nagios_envvars_for_notifications ) ) {
+
+        # Need to get variables, based on the notification method
+        # Can ignore email and pager as these are already covered
+        my @extras =
+          map { $_ = "_CONTACT$_" }
+          grep { !/^(EMAIL|PAGER)$/ }
+          ( $notificationmethod->required_variables_list );
+
+        foreach
+          my $env ( split( ",", $nagios_envvars_for_notifications ), @extras )
+        {
             print OUTFILE "env NAGIOS_$env=\$$env\$\n";
         }
         print OUTFILE "}\n";

Modified: trunk/opsview-core/t/var/configs/Master Monitoring Server/misccommands.cfg
===================================================================
--- trunk/opsview-core/t/var/configs/Master Monitoring Server/misccommands.cfg	2013-04-29 15:18:04 UTC (rev 12200)
+++ trunk/opsview-core/t/var/configs/Master Monitoring Server/misccommands.cfg	2013-04-30 11:53:19 UTC (rev 12201)
@@ -178,4 +178,7 @@
 env NAGIOS_LASTSERVICESTATE=$LASTSERVICESTATE$
 env NAGIOS_LASTHOSTSTATE=$LASTHOSTSTATE$
 env NAGIOS_CONTACTGROUPNAMES=$CONTACTGROUPNAMES$
+env NAGIOS__CONTACTRSS_MAXIMUM_ITEMS=$_CONTACTRSS_MAXIMUM_ITEMS$
+env NAGIOS__CONTACTRSS_MAXIMUM_AGE=$_CONTACTRSS_MAXIMUM_AGE$
+env NAGIOS__CONTACTRSS_COLLAPSED=$_CONTACTRSS_COLLAPSED$
 }

Modified: trunk/opsview-core/t/var/configs/Master Monitoring Server/objects.cache
===================================================================
--- trunk/opsview-core/t/var/configs/Master Monitoring Server/objects.cache	2013-04-29 15:18:04 UTC (rev 12200)
+++ trunk/opsview-core/t/var/configs/Master Monitoring Server/objects.cache	2013-04-30 11:53:19 UTC (rev 12201)
@@ -546,6 +546,9 @@
 	env	NAGIOS_LASTSERVICESTATE=$LASTSERVICESTATE$
 	env	NAGIOS_LASTHOSTSTATE=$LASTHOSTSTATE$
 	env	NAGIOS_CONTACTGROUPNAMES=$CONTACTGROUPNAMES$
+	env	NAGIOS__CONTACTRSS_MAXIMUM_ITEMS=$_CONTACTRSS_MAXIMUM_ITEMS$
+	env	NAGIOS__CONTACTRSS_MAXIMUM_AGE=$_CONTACTRSS_MAXIMUM_AGE$
+	env	NAGIOS__CONTACTRSS_COLLAPSED=$_CONTACTRSS_COLLAPSED$
 	}
 
 define command {

_______________________________________________
Opsview-checkins mailing list
Opsview-checkins@lists.opsview.org
http://lists.opsview.org/lists/listinfo/opsview-checkins

Reply via email to