From 4f79e6ddffa8c988c4f651546131bcb5985b9721 Mon Sep 17 00:00:00 2001 From: Peter Palfrader Date: Thu, 26 Mar 2009 13:52:31 +0000 Subject: Also allow remote hostname replacement in remotechecks git-svn-id: svn+ssh://asteria.noreply.org/svn/weaselutils/trunk@381 bc3d92e2-beff-0310-a7cd-cc87d7ac0ede --- build-nagios | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/build-nagios b/build-nagios index 2d71d9c..415eabd 100755 --- a/build-nagios +++ b/build-nagios @@ -405,7 +405,10 @@ config['services'].each{ |service| 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}_#{hostservice['service_description']}", hostservice['remotecheck'].gsub(/\$HOSTADDRESS\$/, host_ip)) + remotecheck = hostservice['remotecheck'] + remotecheck.gsub!(/\$HOSTADDRESS\$/, host_ip) + remotecheck.gsub!(/\$HOSTNAME\$/, host) + check = $nrpe.add("#{host}_#{hostservice['service_description']}", remotecheck) 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 -- cgit v1.2.3