summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorNishanth Thomas <nthomas@redhat.com>2014-11-07 01:07:45 +0530
committerSahina Bose <sabose@redhat.com>2014-11-17 21:41:49 -0800
commitc7fa43e3dd1aa63d20caac8d6ffd85735614d832 (patch)
treec3e317b59fe6104b86bb14b9eb499d6e8ce8267d /plugins
parenta93474a43065ab3c9539b1268c5ebe819903bb4c (diff)
nagios-server-addons:_executeRandomHost to check for the status of glusterd service
During the creation of eligible list of hosts, need to consider the status of glusterd service also. this is included. Also added some additional checks to handle the errors https://bugzilla.redhat.com/show_bug.cgi?id=1136205 https://bugzilla.redhat.com/show_bug.cgi?id=1109843 Signed-off-by: Nishanth Thomas <nthomas@redhat.com> Change-Id: Ic757ecc0df5ef3c261048a961af59715ca889a26 Reviewed-on: http://review.gluster.org/9066 Reviewed-by: Ramesh N <rnachimu@redhat.com> Tested-by: Nishanth Thomas <nishusemail@gmail.com> Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'plugins')
-rwxr-xr-xplugins/check_vol_server.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/plugins/check_vol_server.py b/plugins/check_vol_server.py
index cabc1bc..f6c11d3 100755
--- a/plugins/check_vol_server.py
+++ b/plugins/check_vol_server.py
@@ -14,13 +14,24 @@ def _getListHosts(hostgroup):
table = json.loads(livestatus.readLiveStatusAsJSON(
"GET hostgroups\nColumns: members_with_state\n"
"Filter: name = " + hostgroup + "\n"))[0][0]
- # Get the only those nodes which are UP
+ # Get the only those nodes which are UP and
+ #glusterd service is running
for row in table:
- if row[1] == utils.HostStatusCode.UP:
+ if row[1] == utils.HostStatusCode.UP and \
+ _getGlusterdStatus(row[0]) \
+ == utils.PluginStatusCode.OK:
list_hosts.append(row[0])
return list_hosts
+def _getGlusterdStatus(hostname):
+ status = json.loads(livestatus.readLiveStatusAsJSON(
+ "GET services\nColumns: state\n"
+ "Filter: description = Gluster Management\n"
+ "Filter: host_name = " + hostname + "\n"))[0][0]
+ return status
+
+
def _getHostAddress(host):
# Get the address of the host
host_address = livestatus.checkLiveStatus("GET hosts\nColumns: address\n"
@@ -102,6 +113,8 @@ def _getVolumeStatusOutput(hostgroup, volume):
# Get volume details
nrpeStatus, nrpeOut = _executeRandomHost(
hostgroup, _getVolDetailNRPECommand(volume))
+ if nrpeStatus != utils.PluginStatusCode.OK:
+ return utils.PluginStatusCode.UNKNOWN, nrpeOut
volInfo = json.loads(nrpeOut)
# Get the volume type
vol_type = volInfo[volume]['type']