summaryrefslogtreecommitdiffstats
path: root/plugins/check_cluster_status.py
diff options
context:
space:
mode:
authorNishanth Thomas <nthomas@redhat.com>2014-05-08 15:22:22 +0530
committerSahina Bose <sabose@redhat.com>2014-05-13 03:24:00 -0700
commit2efd1bf9bbff94e08b2936f15f3f6ab136b3286b (patch)
tree6812c6263f89a2a702aeb7b9b25cf059cfbae9ae /plugins/check_cluster_status.py
parent9379f10239710c950c8ce319a18022215a892a66 (diff)
nagios-server-addons : Fixed cluster status plugin to correct queries
BZ 1089641, changed the mk-livestatus query so that it picks the right services BZ 1089670, introduced a check to set status to OK if no volumes present in the cluster Bug-Url:https://bugzilla.redhat.com/show_bug.cgi?id=1089670 Bug:Url:https://bugzilla.redhat.com/show_bug.cgi?id=1089641 Change-Id: I93aed685c75ff3455e1129c0d8f9e485b6c5f2b0 Signed-off-by: Nishanth Thomas <nthomas@redhat.com> Reviewed-on: http://review.gluster.org/7708 Reviewed-by: Sahina Bose <sabose@redhat.com> Tested-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'plugins/check_cluster_status.py')
-rwxr-xr-xplugins/check_cluster_status.py17
1 files changed, 7 insertions, 10 deletions
diff --git a/plugins/check_cluster_status.py b/plugins/check_cluster_status.py
index ab2a484..287cb2d 100755
--- a/plugins/check_cluster_status.py
+++ b/plugins/check_cluster_status.py
@@ -34,27 +34,24 @@ def findClusterStatus(clusterName):
# Write command to socket
cmd = "GET services\nColumns: state\n" \
"Filter: description ~~ %s\n" \
- "Filter: host_name = %s" % ('Volume Status', clusterName)
+ "Filter: host_name = %s" % ('Volume Status -', clusterName)
table = livestatus.readLiveStatus(cmd)
noOfVolumesInCriticalState = 0
noOfVolumes = len(table)
+ if noOfVolumes == 0:
+ print "OK : No Volumes present in the cluster"
+ return exitStatus
for row in table:
if len(row) > 0 and row[0] == '2':
noOfVolumesInCriticalState += 1
if noOfVolumesInCriticalState == noOfVolumes:
- print "Cluster Status CRITICAL: All Volumes are in Critical State " \
- "| noOfVolumes=%s noOfVolumesInCriticalState=%s" \
- % (noOfVolumes, noOfVolumesInCriticalState)
+ print "CRITICAL: All Volumes in the cluster are in Critical State"
exitStatus = utils.PluginStatusCode.CRITICAL
elif noOfVolumesInCriticalState > 0:
- print "Cluster Status WARNING : Some Volumes are in Critical State " \
- "| noOfVolumes=%s noOfVolumesInCriticalState=%s" \
- % (noOfVolumes, noOfVolumesInCriticalState)
+ print "WARNING : Some Volumes in the cluster are in Critical State"
exitStatus = utils.PluginStatusCode.WARNING
else:
- print "Cluster Status OK : None of the Volumes are in Critical " \
- "State | noOfVolumes=%s noOfVolumesInCriticalState=%s" \
- % (noOfVolumes, noOfVolumesInCriticalState)
+ print "OK : None of the Volumes in the cluster are in Critical State"
return exitStatus