summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Palfrader <peter@palfrader.org>2007-06-21 17:20:30 +0000
committerweasel <weasel@bc3d92e2-beff-0310-a7cd-cc87d7ac0ede>2007-06-21 17:20:30 +0000
commitaf42477554fbd4acd37e8f44b2f1da06656b4eff (patch)
tree3997e10ac1627d33993edcca20fbf3c4a6a2ddd0
parent0f4751f2e2fb6c2ba114b0881237962fa2b832e3 (diff)
Maybe fix relayed checks
git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@285 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede
-rwxr-xr-xbuild-nagios13
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']}"