aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2010-01-16 09:47:46 +0000
committerPetter Reinholdtsen <pere@hungry.com>2010-01-16 09:47:46 +0000
commit20cca9c571aaf071242cffbba0a24f414d6d43fa (patch)
tree11d864887b1ac13105ca8321234d98e9c7575e62
parent401d35620839a7e7af8b9073c077d62dba5bc085 (diff)
downloadsitesummary-20cca9c571aaf071242cffbba0a24f414d6d43fa.tar.gz
sitesummary-20cca9c571aaf071242cffbba0a24f414d6d43fa.tar.bz2
sitesummary-20cca9c571aaf071242cffbba0a24f414d6d43fa.tar.xz
Move host check to generating function.
-rwxr-xr-xsitesummary-nodes22
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%");