diff options
author | Ramesh Nachimuthu <rnachimu@redhat.com> | 2014-11-05 15:57:13 +0530 |
---|---|---|
committer | Sahina Bose <sabose@redhat.com> | 2014-11-11 23:00:51 -0800 |
commit | af2463b0c05d2618b1b83e82873bf0570dccf068 (patch) | |
tree | 72d553e3b36d0d2382bbf1ec0325ed51753b8870 /plugins | |
parent | 11f96adbb1f8bff8cf7b385da10200a5627d980a (diff) |
server-plugin: consider all status of volume in cluster status
Consider the 'UNKNOWN' status of volumes while calculating the cluster
status. Following will be the cluster state and state information.
Cluster State State Information
UP "OK : None of the Volumes in the cluster are in Critical State"
UP "OK : No Volumes present in the cluster"
UP "WARNING : Some Volumes in the cluster are in Critical State"
UP "WARNING : Some Volumes in the cluster are in Unknown State"
UP "WARNING : Some Volumes in the cluster are in Warning State"
UP "WARNING : All Volumes in the cluster are in Warning State"
DOWN "CRITICAL: All Volumes in the cluster are in Critical State"
DOWN "CRITICAL: All Volumes in the cluster are in Unknown State"
Bug-url: https://bugzilla.redhat.com/1128007
Change-Id: I06fb1697cb4919420ab6d6ea54e9d9ee96820d2a
Signed-off-by: Ramesh Nachimuthu <rnachimu@redhat.com>
Reviewed-on: http://review.gluster.org/9053
Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com>
Reviewed-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'plugins')
-rwxr-xr-x | plugins/check_cluster_status.py | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/plugins/check_cluster_status.py b/plugins/check_cluster_status.py index 287cb2d..ee9050c 100755 --- a/plugins/check_cluster_status.py +++ b/plugins/check_cluster_status.py @@ -37,19 +37,39 @@ def findClusterStatus(clusterName): "Filter: host_name = %s" % ('Volume Status -', clusterName) table = livestatus.readLiveStatus(cmd) noOfVolumesInCriticalState = 0 + noOfVolumesInUnknownState = 0 + noOfVolumesInWarningState = 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 len(row) > 0: + if row[0] == '1': + noOfVolumesInWarningState += 1 + elif row[0] == '2': + noOfVolumesInCriticalState += 1 + elif row[0] == '3': + noOfVolumesInUnknownState += 1 + if noOfVolumesInCriticalState == noOfVolumes: print "CRITICAL: All Volumes in the cluster are in Critical State" exitStatus = utils.PluginStatusCode.CRITICAL + elif noOfVolumesInUnknownState == noOfVolumes: + print "CRITICAL: All Volumes in the cluster are in Unknown State" + exitStatus = utils.PluginStatusCode.CRITICAL elif noOfVolumesInCriticalState > 0: print "WARNING : Some Volumes in the cluster are in Critical State" exitStatus = utils.PluginStatusCode.WARNING + elif noOfVolumesInUnknownState > 0: + print "WARNING : Some Volumes in the cluster are in Unknown State" + exitStatus = utils.PluginStatusCode.WARNING + elif noOfVolumesInWarningState == noOfVolumes: + print "WARNING : All Volumes in the cluster are in Warning State" + exitStatus = utils.PluginStatusCode.WARNING + elif noOfVolumesInWarningState > 0: + print "WARNING : Some Volumes in the cluster are in Warning State" + exitStatus = utils.PluginStatusCode.WARNING else: print "OK : None of the Volumes in the cluster are in Critical State" return exitStatus |