aboutsummaryrefslogtreecommitdiffstats
path: root/sitesummary-nodes
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2012-08-31 09:03:33 +0000
committerPetter Reinholdtsen <pere@hungry.com>2012-08-31 09:03:33 +0000
commit8f34054357f7087fb2be5e0d122b8f248158eceb (patch)
tree46a98b494f6473bcc3d703ecb720cdd011c73715 /sitesummary-nodes
parent91c87446716af7f7fbb5a1b461273f54fe9f0ebc (diff)
downloadsitesummary-8f34054357f7087fb2be5e0d122b8f248158eceb.tar.gz
sitesummary-8f34054357f7087fb2be5e0d122b8f248158eceb.tar.bz2
sitesummary-8f34054357f7087fb2be5e0d122b8f248158eceb.tar.xz
Make Nagios config more robust, ignore hosts without any name and
address, which must be the result of a corrupt sitesummary entry.
Diffstat (limited to 'sitesummary-nodes')
-rwxr-xr-xsitesummary-nodes5
1 files changed, 5 insertions, 0 deletions
diff --git a/sitesummary-nodes b/sitesummary-nodes
index ab2ecf1..fb27d57 100755
--- a/sitesummary-nodes
+++ b/sitesummary-nodes
@@ -251,6 +251,11 @@ sub generate_nagios_config {
my $address = get_dns_address($hostid);
my $localhostname = get_localhostname($hostid);
+ unless (defined $address && defined $localhostname) {
+ print "# Skipping ID $hostid without hostname and address\n";
+ next;
+ }
+
my $redirect = "";
my $nagiosclient = is_nagios_client($hostid);
my $remote = is_remote_nagios_client($hostid);