From 58138dcd260104a24e9f1e6c417f0cff8dafb990 Mon Sep 17 00:00:00 2001 From: Nishanth Thomas Date: Mon, 26 May 2014 20:01:44 +0530 Subject: gluster-nagios-addons:volume status based on volume type Added the volume type in the plugin output The logic of determining the volume status changed based on the volume type. Added the volume type and the list of bricks down in the plugin output Change-Id: Ib999fc78059c725a29f4f7bc3b3328c34b6a6b33 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1096159 Bug-Url: https://bugzilla.redhat.com/show_bug.cgi?id=1096169 Signed-off-by: Nishanth Thomas Reviewed-on: http://review.gluster.org/7878 Reviewed-by: Sahina Bose Tested-by: Sahina Bose --- plugins/check_volume_status.py | 6 ++++-- plugins/discover_volumes.py | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/check_volume_status.py b/plugins/check_volume_status.py index 4812e99..77168f3 100755 --- a/plugins/check_volume_status.py +++ b/plugins/check_volume_status.py @@ -34,11 +34,13 @@ def getVolumeStatus(args): elif volumes[args.volume]["volumeStatus"] == (glustercli. VolumeStatus.ONLINE): exitstatus = utils.PluginStatusCode.OK - message = "OK: Volume is up" + message = "OK: Volume : %s type - Volume is up" % \ + (volumes[args.volume]["volumeType"]) elif volumes[args.volume]["volumeStatus"] == (glustercli. VolumeStatus.OFFLINE): exitstatus = utils.PluginStatusCode.CRITICAL - message = "CRITICAL: Volume is stopped" + message = "CRITICAL: Volume : %s type is stopped" % \ + (volumes[args.volume]["volumeType"]) except glustercli.GlusterCmdFailedException as e: out = ("UNKNOWN: Command execution failed %s" % e.message) return utils.PluginStatusCode.UNKNOWN, out diff --git a/plugins/discover_volumes.py b/plugins/discover_volumes.py index ba48532..5d1d463 100755 --- a/plugins/discover_volumes.py +++ b/plugins/discover_volumes.py @@ -65,10 +65,12 @@ def discoverVolumes(volumeName, list): if geoRepStatus == "on": volDict['geo-rep'] = geoRepStatus + volDict['replicaCount'] = volume['replicaCount'] volDict['bricks'] = [] for brick in volume['bricksInfo']: brickproplist = brick['name'].split(':') - volDict['bricks'].append({'brickpath': brickproplist[1], + volDict['bricks'].append({'brickaddress': brickproplist[0], + 'brickpath': brickproplist[1], 'hostUuid': brick['hostUuid']}) resultlist[key] = volDict resultString = json.dumps(resultlist) -- cgit