add correct gateway info
[mirror/dsa-nagios.git] / config / build-nagios
index 94a2b53..acbf339 100755 (executable)
@@ -239,9 +239,9 @@ def find_hosts(service, servers, hostgroups)
        hosts        = merge_hosts_and_hostgroups service, servers, hostgroups, ''
        excludehosts = merge_hosts_and_hostgroups service, servers, hostgroups, 'exclude'
 
-       excludehosts.each{ |host|
+       excludehosts.uniq.each{ |host|
                if hosts.delete(host) == nil
-                       throw "Cannot remove host #{host} from service #{service['service_description']}: it's not included anyway or excluded twice."
+                       puts "info: [service #{service['service_description']}] not excluding host #{host} - it's not included anyway."
                end
        }
 
@@ -358,6 +358,7 @@ config['servers'].each_pair{ |name, server|
 ##############
 config['hostgroups'].each_pair{ |name, hg|
        next if hg['private']
+       throw "Empty hostgroup #{name}" if hg['_memberlist'].length == 0
 
        set_complain_if_set hg, 'hostgroup_name', name                       , 'Hostgroup', name
        set_complain_if_set hg, 'members'       , hg['_memberlist'].join(","), 'Hostgroup', name