diff options
-rw-r--r-- | debian/changelog | 4 | ||||
-rwxr-xr-x | sitesummary-nodes | 13 |
2 files changed, 17 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 25e4fbd..237aeee 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,6 +1,10 @@ sitesummary (0.1.4) UNRELEASED; urgency=low * Add support in check_kernel_version for any 3.X kernel. + * Add support in the Nagios configuration generator to ignore + specific checks for a given host by listing it in + /etc/sitesummary/nagiosignore. Useful for machines where a + package is installed but disabled. -- Petter Reinholdtsen <pere@debian.org> Sun, 29 Apr 2012 14:33:21 +0200 diff --git a/sitesummary-nodes b/sitesummary-nodes index 1e3035d..3c439a9 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -31,6 +31,9 @@ EOF my %opts; getopts("hmnw", \%opts) || (usage(), exit(1)); +my $nagiosignorefile = "/etc/sitesummary/nagiosignore"; +my %nagios_ignore; + my %hostnames; my $server_hostid = get_localhost_hostid() || die "Unable to figure out hostid for the local host"; @@ -45,6 +48,14 @@ if ($opts{'h'}) { } elsif ($opts{'w'}) { print_ip_hw_list(); } elsif ($opts{'n'}) { + if (open(my $fh, $nagiosignorefile)) { + while (<$fh>) { + chomp; + my ($hostname, $nagioscheck) = split(/:/); + $nagios_ignore{"$hostname:$nagioscheck"} = 1; + } + close $fh; + } generate_nagios_config(); } else { print_list(); @@ -173,6 +184,8 @@ sub is_remote_nrpe_config_active { sub print_nagios_service_check { my ($remote, $hostname, $description, $check, $check_args) = @_; my $template = "server-service"; + + return if exists $nagios_ignore{"$hostname:$check"}; my $cmd; if ($remote) { $cmd = "check_nrpe!$check"; |