diff options
-rw-r--r-- | debian/changelog | 8 | ||||
-rwxr-xr-x | sitesummary-nodes | 25 |
2 files changed, 27 insertions, 6 deletions
diff --git a/debian/changelog b/debian/changelog index d31e72e..9b822e6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -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@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 diff --git a/sitesummary-nodes b/sitesummary-nodes index 2ff836c..c97dbae 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -10,6 +10,7 @@ use SiteSummary; 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 @@ Usage: $0 [-hmnw] 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 @@ sub generate_nagios_config { $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 @@ sub generate_nagios_config { # 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 = ( |