X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=config%2Fbuild-nagios;h=7a80f0a017ccb8a5a0616e110e6685288d44c29a;hb=aa6f214d821e7c3aac9b36c9826531b676b3bbfc;hp=5e41e052288f20fb58400eb78fd8fb5ab7f1a520;hpb=1710a1225b39acf0c7ed226aac924abcc79f4433;p=mirror%2Fdsa-nagios.git diff --git a/config/build-nagios b/config/build-nagios index 5e41e05..7a80f0a 100755 --- a/config/build-nagios +++ b/config/build-nagios @@ -131,9 +131,7 @@ $nrpe = Nrpe.new() def print_block(fd, kind, hash, exclude_keys) fd.puts "define #{kind} {" hash.keys.sort.each{ |key| - next if key == '_extinfo' - next if key == '_hostgroups' - next if key == '_memberlist' + next if key[0,1] == '_' next if exclude_keys.include? key fd.puts " #{key} #{hash[key]}" } @@ -176,9 +174,13 @@ def addService(hosts, service, files, servers) set_complain_if_set s, 'host_name', host, 'Service', s['service_description'] merge_contacts(servers[host], s) - print_block files['services'], 'service', s, %w(nrpe runfrom remotecheck - depends - hosts hostgroups excludehosts excludehostgroups) + exclude_keys = %w(nrpe runfrom remotecheck + depends + hosts hostgroups excludehosts excludehostgroups) + if servers[host]['no-servicegroups'] + exclude_keys << 'servicegroups' + end + print_block files['services'], 'service', s, exclude_keys } if service['depends'] @@ -330,7 +332,7 @@ config['servers'].keys.sort.each{ |name| set_if_unset server, 'use' , HOST_TEMPLATE_NAME set_if_unset server, 'check_command', HOST_ALIVE_CHECK unless server['pingable'] == false - print_block files['hosts'] , 'host' , server , %w(hostgroups pingable) + print_block files['hosts'] , 'host' , server , %w(hostgroups pingable no-servicegroups)