From f6c4a6b4fac009f2b4ca738066b7ba9858ec9dec Mon Sep 17 00:00:00 2001 From: Nishanth Thomas Date: Wed, 18 Jun 2014 17:40:55 +0530 Subject: nagios-server-addons:executeRandomHost to send request with correct host address When the inital request fails, executeRandomHost is supposed to iterate over the list of avialable hosts and resend the request until get a successful response. This part of code was falty, where the request was send without getting the proper ipaddress/hostname Change-Id: I1f1c7a5bccba3bd601c9e3241083784f15a2c4b6 Bug-url: https://bugzilla.redhat.com/show_bug.cgi?id=1109843 Signed-off-by: Nishanth Thomas Reviewed-on: http://review.gluster.org/8101 Reviewed-by: Sahina Bose Tested-by: Nishanth Thomas --- plugins/check_vol_server.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/plugins/check_vol_server.py b/plugins/check_vol_server.py index 8263e6d..cabc1bc 100755 --- a/plugins/check_vol_server.py +++ b/plugins/check_vol_server.py @@ -206,13 +206,17 @@ def _executeRandomHost(hostgroup, command): if status != utils.PluginStatusCode.UNKNOWN: return status, output - # random host is not able to execute the command - # Now try to iterate through the list of hosts - # in the host group and send the command until - # the command is successful + #random host is not able to execute the command + #Now try to iterate through the list of hosts + #in the host group and send the command until + #the command is successful + + #No need to send it to host which we already sent + list_hosts.remove(host) for host in list_hosts: + host_address = _getHostAddress(host) status, output = execNRPECommand(server_utils.getNRPEBaseCommand( - host, + host_address, timeout=args.timeout) + command) if status != utils.PluginStatusCode.UNKNOWN: return status, output -- cgit