From 05c2cd7c527d3a7e8b1244db72505314c3e82d3a Mon Sep 17 00:00:00 2001 From: Sahina Bose Date: Tue, 27 May 2014 17:04:36 +0530 Subject: plugins: Geo-rep plugin status message enhanced Added geo-rep session wise details to the plugin output. Change-Id: I2086a493c2befa4c1e25a1cc5523213f0f13c8dd Bug-Url: https://bugzilla.redhat.com/1101218 Bug-Url: https://bugzilla.redhat.com/1101223 Signed-off-by: Sahina Bose Reviewed-on: http://review.gluster.org/7896 --- plugins/check_volume_status.py | 32 ++++++++++++++++++-------------- 1 file changed, 18 insertions(+), 14 deletions(-) (limited to 'plugins') 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 -- cgit