X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=config%2Fbuild-nagios;h=1eb3977d4adb88dec9300b3b5073538451b699c0;hb=0b151f4e477a20461724c5f6985a8f8b2e2a0e47;hp=13c3d4ce59a3fee980e070dea3d83d24fa4c720c;hpb=f09cdfeb1669f47f8d427ff3b04d195067a57d78;p=mirror%2Fdsa-nagios.git diff --git a/config/build-nagios b/config/build-nagios index 13c3d4c..1eb3977 100755 --- a/config/build-nagios +++ b/config/build-nagios @@ -127,11 +127,13 @@ $nrpe = Nrpe.new() # host/service/etc definitions # # It skips over such keys as are listed in exclude_keys -# and also skips private keys (those starting with an underscre) +# and also skips private keys (those starting with an underscore) def print_block(fd, kind, hash, exclude_keys) fd.puts "define #{kind} {" hash.each_pair{ |key, value| - next if key[0,1] == '_' + next if key == '_extinfo' + next if key == '_hostgroups' + next if key == '_memberlist' next if exclude_keys.include? key fd.puts " #{key} #{value}" } @@ -239,9 +241,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 }