From 8f34054357f7087fb2be5e0d122b8f248158eceb Mon Sep 17 00:00:00 2001 From: Petter Reinholdtsen Date: Fri, 31 Aug 2012 09:03:33 +0000 Subject: Make Nagios config more robust, ignore hosts without any name and address, which must be the result of a corrupt sitesummary entry. --- debian/changelog | 7 +++++++ sitesummary-nodes | 5 +++++ 2 files changed, 12 insertions(+) diff --git a/debian/changelog b/debian/changelog index ae69533..5732bb1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +sitesummary (0.1.6) UNRELEASED; urgency=low + + * Make Nagios config more robust, ignore hosts without any name and + address, which must be the result of a corrupt sitesummary entry. + + -- Petter Reinholdtsen Fri, 31 Aug 2012 11:00:04 +0200 + sitesummary (0.1.5) unstable; urgency=low * Team upload. 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); -- cgit v1.2.3