diff options
Diffstat (limited to 'build-nagios')
-rwxr-xr-x | build-nagios | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/build-nagios b/build-nagios index 7185590..14737ec 100755 --- a/build-nagios +++ b/build-nagios @@ -367,20 +367,21 @@ config['services'].each{ |service| relay = service['runfrom'] hosts.each{ |host| + # how to recursively copy this thing? + hostservice = YAML::load( service.to_yaml ) host_ip = config['servers'][host]['address'] throw "For some reason I do not have an address for #{host}. This shouldn't be." unless host_ip - check = $nrpe.add("#{host}_#{service['service_description']}", service['remotecheck'].gsub(/\$HOSTADDRESS\$/, host_ip)) - service['check_command'] = "#{NRPE_CHECKNAME_HOST}!#{ config['servers'][ relay ]['address'] }!#{ check }" + check = $nrpe.add("#{host}_#{hostservice['service_description']}", hostservice['remotecheck'].gsub(/\$HOSTADDRESS\$/, host_ip)) + hostservice['check_command'] = "#{NRPE_CHECKNAME_HOST}!#{ config['servers'][ relay ]['address'] }!#{ check }" # Make sure dependencies are an array. If there are none, create an empty array # if depends is just a string, make a list with just that element - service['depends'] = ensure_array( service['depends'] ) - + hostservice['depends'] = ensure_array( hostservice['depends'] ) # And append this new dependency - service['depends'] << "#{ relay }:#{ NRPE_PROCESS_SERVICE }"; + hostservice['depends'] << "#{ relay }:#{ NRPE_PROCESS_SERVICE }"; - addService( [ host ], service, files) + addService( [ host ], hostservice, files) } elsif service['runfrom'] || service['remotecheck'] throw "runfrom and remotecheck must either appear both or not at all in service #{service['service_description']}" |