From 2132a0f6927275e76c5e55069acc3e8314567475 Mon Sep 17 00:00:00 2001 From: Sahina Bose Date: Fri, 8 Aug 2014 19:04:27 +0530 Subject: nagios-common: Corrected geo-rep status in case of replicate volumes The logic to determine faulty should be if count of passive+faulty > (brickcount/replicacount) Separated logic for replicate volumes to fix the comparison Change-Id: Ia7797cb091dc14e551ddbe2e540d532930e41be3 Bug-Url:https://bugzilla.redhat.com/show_bug.cgi?id=1109727 Signed-off-by: Sahina Bose Reviewed-on: http://review.gluster.org/8443 Reviewed-by: Ramesh N Reviewed-by: Kanagaraj M --- glusternagios/glustercli.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/glusternagios/glustercli.py b/glusternagios/glustercli.py index 111c9a9..4ec8194 100755 --- a/glusternagios/glustercli.py +++ b/glusternagios/glustercli.py @@ -557,7 +557,7 @@ def _parseVolumeGeoRepStatus(volumeName, out): if "REPLICATE" in volumes[volumeName]["volumeType"]: replicaCount = int(volumes[volumeName]["replicaCount"]) else: - replicaCount = brickCount + replicaCount = 1 for slave, count_dict in slaves.iteritems(): if count_dict['nodecount'] > brickCount: @@ -565,15 +565,18 @@ def _parseVolumeGeoRepStatus(volumeName, out): # may be wrong slaves[slave]['detail'] += "NOTE:Multiple slave session aggregated" if count_dict['faulty'] > 0: + if replicaCount > 1: # georep cli status does not give the node name in the same way as # gluster volume info - there's no way to compare and get the # subvolume. So if fault+passive > than num of primary bricks, # moving to faulty - if (count_dict['faulty'] + count_dict['passive'] - >= count_dict['nodecount']/replicaCount): - slaves[slave]['status'] = GeoRepStatus.FAULTY + if (count_dict['faulty'] + count_dict['passive'] + > count_dict['nodecount']/replicaCount): + slaves[slave]['status'] = GeoRepStatus.FAULTY + else: + slaves[slave]['status'] = GeoRepStatus.PARTIAL_FAULTY else: - slaves[slave]['status'] = GeoRepStatus.PARTIAL_FAULTY + slaves[slave]['status'] = GeoRepStatus.FAULTY elif (count_dict['notstarted'] > 0 and slaves[slave]['status'] == GeoRepStatus.OK): slaves[slave]['status'] = GeoRepStatus.NOT_STARTED -- cgit