[debian-edu-commits] r78968 - in trunk/src/sitesummary: . debian

pere at alioth.debian.org pere at alioth.debian.org
Sun Feb 3 12:49:15 UTC 2013


Author: pere
Date: 2013-02-03 12:49:14 +0000 (Sun, 03 Feb 2013)
New Revision: 78968

Modified:
   trunk/src/sitesummary/debian/changelog
   trunk/src/sitesummary/sitesummary-nodes
Log:
sitesummary-nodes: Add support for fetching configuration from
/etc/sitesummary/sitesummary-nodes.conf, and make it possible to
configure the nagios warning and critical levels for ping checks.

Modified: trunk/src/sitesummary/debian/changelog
===================================================================
--- trunk/src/sitesummary/debian/changelog	2013-02-03 05:57:29 UTC (rev 78967)
+++ trunk/src/sitesummary/debian/changelog	2013-02-03 12:49:14 UTC (rev 78968)
@@ -1,3 +1,11 @@
+sitesummary (0.1.9) UNRELEASED; urgency=low
+
+  * sitesummary-nodes: Add support for fetching configuration from
+    /etc/sitesummary/sitesummary-nodes.conf, and make it possible to
+    configure the nagios warning and critical levels for ping checks.
+
+ -- Petter Reinholdtsen <pere at debian.org>  Sun, 03 Feb 2013 13:46:15 +0100
+
 sitesummary (0.1.8) unstable; urgency=low
 
   * nagios-plugins/check_kernel_status: Add support for new format of

Modified: trunk/src/sitesummary/sitesummary-nodes
===================================================================
--- trunk/src/sitesummary/sitesummary-nodes	2013-02-03 05:57:29 UTC (rev 78967)
+++ trunk/src/sitesummary/sitesummary-nodes	2013-02-03 12:49:14 UTC (rev 78968)
@@ -10,6 +10,7 @@
 use Getopt::Std;
 use Socket;
 use File::Temp qw(tempfile);
+use vars qw($npingwarn $npingwarnp $npingcrit $npingcritp);
 
 sub usage {
     print <<EOF;
@@ -22,11 +23,17 @@
 EOF
 }
 
+$npingwarn = 100.0;
+$npingwarnp = 20; # percent
+$npingcrit = 500.0;
+$npingcritp = 60; # percent
+
 # Idea for way to provide overrides for the functions in this script
-#eval 'require "/etc/sitesummary/sitesummary-nodes-override"';
-#if ($@ && $@ !~ qr{^Can't locate /etc/sitesummary/sitesummary-nodes-override}) {
-#    die $@;
-#};
+my $conffile = "/etc/sitesummary/sitesummary-nodes.conf";
+eval 'require "$conffile"';
+if ($@ && $@ !~ qr{^Can't locate $conffile}) {
+    die $@;
+};
 
 my %opts;
 getopts("hmnw", \%opts) || (usage(), exit(1));
@@ -315,7 +322,10 @@
             $hosts{$defaultroute} = $defaultroute;
             $hostgroup{"router"} = 1;
             print_nagios_service_check(0, $defaultroute, "ping",
-                                       "check_ping", "100.0,20%!500.0,60%");
+                                       "check_ping",
+                                       sprintf("%.1f,%d%%!%.1f,%d%%",
+                                               $npingwarn, $npingwarnp,
+                                               $npingcrit, $npingcritp));
         }
 
         my %switch = get_switch_info($hostid);
@@ -336,7 +346,10 @@
 
         # first, check ping to see if the other checks should be performed
         print_nagios_service_check(0, $hostname, "ping",
-                                   "check_ping", "100.0,20%!500.0,60%");
+                                   "check_ping",
+                                   sprintf("%.1f,%d%%!%.1f,%d%%",
+                                           $npingwarn, $npingwarnp,
+                                           $npingcrit, $npingcritp));
 
         my %tcpservices =
         (




More information about the debian-edu-commits mailing list