diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2012-04-29 17:57:37 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2012-04-29 17:57:37 +0000 |
commit | cee561dd4bcb48a91c55c5ea820857cac59acaef (patch) | |
tree | 60c1921b80d91372632a520b283a34cc163bba3d /sitesummary-nodes | |
parent | a0f473f5e96ac92247e18eb082c05474689e2f82 (diff) | |
download | sitesummary-cee561dd4bcb48a91c55c5ea820857cac59acaef.tar.gz sitesummary-cee561dd4bcb48a91c55c5ea820857cac59acaef.tar.bz2 sitesummary-cee561dd4bcb48a91c55c5ea820857cac59acaef.tar.xz |
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.
Diffstat (limited to 'sitesummary-nodes')
-rwxr-xr-x | sitesummary-nodes | 13 |
1 files changed, 13 insertions, 0 deletions
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"; |