diff options
Diffstat (limited to 'plugins/check_volume_status.py')
-rwxr-xr-x | plugins/check_volume_status.py | 32 |
1 files changed, 18 insertions, 14 deletions
diff --git a/plugins/check_volume_status.py b/plugins/check_volume_status.py index e2b9205..4812e99 100755 --- a/plugins/check_volume_status.py +++ b/plugins/check_volume_status.py @@ -115,20 +115,24 @@ def getVolumeGeoRepStatus(args): exitstatus = utils.PluginStatusCode.UNKNOWN message = "UNKNOWN: Volume info not found" else: - if (volume[args.volume]['status'] == - glustercli.GeoRepStatus.PARTIAL_FAULTY): - exitstatus = utils.PluginStatusCode.WARNING - message = "Partially faulty\n %s" % volume[args.volume]['detail'] - elif volume[args.volume]['status'] == glustercli.GeoRepStatus.FAULTY: - exitstatus = utils.PluginStatusCode.CRITICAL - message = "Faulty\n %s" % volume[args.volume]['detail'] - elif (volume[args.volume]['status'] == - glustercli.GeoRepStatus.NOT_STARTED): - exitstatus = utils.PluginStatusCode.WARNING - message = "Not Started" - else: - exitstatus = utils.PluginStatusCode.OK - message = "OK" + exitstatus = utils.PluginStatusCode.OK + message = "Session status:" + detail = "Details:" + for slavename, slave_dict in volume[args.volume]['slaves'].iteritems(): + message += ("%s - %s " % (slavename, + slave_dict['status'])) + detail += ("%s - %s " % (slavename, + slave_dict['detail'])) + if slave_dict['status'] == glustercli.GeoRepStatus.FAULTY: + exitstatus = utils.PluginStatusCode.CRITICAL + elif (slave_dict['status'] + in [glustercli.GeoRepStatus.PARTIAL_FAULTY, + glustercli.GeoRepStatus.STOPPED, + glustercli.GeoRepStatus.NOT_STARTED] + and exitstatus == utils.PluginStatusCode.OK): + exitstatus = utils.PluginStatusCode.WARNING + if exitstatus != utils.PluginStatusCode.OK: + message += "\n" + detail return exitstatus, message |