diff options
-rwxr-xr-x | sitesummary-nodes | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/sitesummary-nodes b/sitesummary-nodes index 9f0ba78..1b958b1 100755 --- a/sitesummary-nodes +++ b/sitesummary-nodes @@ -139,6 +139,18 @@ define service { EOF } +sub print_nagios_host_check { + my ($hostname, $address) = @_; + my $template = "server-host"; + print <<EOF; +define host { + use $template + host_name $hostname + address $address +} +EOF +} + sub generate_nagios_config { for my $hostname (sort keys %hostnames) { my $hostid = $hostnames{$hostname}; @@ -148,15 +160,13 @@ sub generate_nagios_config { my $redirect = ""; my $remote = is_remote_nagios_client($hostid); - # first, check ping to see if the other checks should be performed print <<EOF; ##################### $hostname ####################### -define host { - use server-host - host_name $hostname - address $address -} EOF + + print_nagios_host_check($hostname, $address); + + # 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%"); |