diff options
Diffstat (limited to 'plugins/check_vol_server.py')
-rwxr-xr-x | plugins/check_vol_server.py | 17 |
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'] |