From af42477554fbd4acd37e8f44b2f1da06656b4eff Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 21 Jun 2007 17:20:30 +0000 Subject: Maybe fix relayed checks git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@285 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- build-nagios | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'build-nagios') 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']}" -- cgit v1.2.3