summaryrefslogtreecommitdiffstats
path: root/plugins/check_volume_status.py
diff options
context:
space:
mode:
authorSahina Bose <sabose@redhat.com>2014-04-24 15:51:21 +0530
committerSahina Bose <sabose@redhat.com>2014-05-01 22:15:03 -0700
commitade53f83d569ee9d46914af51f62a13e0cc9406d (patch)
tree60ca49f92f464a9c02624bc69cdfd9266da64685 /plugins/check_volume_status.py
parent63a7839a3d05494960d4ba15e5fef08157c82887 (diff)
plugins: Added geo-rep status to volume_status
Added option to get the geo rep status to check_volume_status plugin Change-Id: I32d2a0240e3888505c54fdce9a3fb731b9300e38 Signed-off-by: Sahina Bose <sabose@redhat.com> Reviewed-on: http://review.gluster.org/7591 Reviewed-by: Shubhendu Tripathi <shtripat@redhat.com> Reviewed-by: Kanagaraj M <kmayilsa@redhat.com>
Diffstat (limited to 'plugins/check_volume_status.py')
-rwxr-xr-xplugins/check_volume_status.py33
1 files changed, 32 insertions, 1 deletions
diff --git a/plugins/check_volume_status.py b/plugins/check_volume_status.py
index 072900a..70bed2f 100755
--- a/plugins/check_volume_status.py
+++ b/plugins/check_volume_status.py
@@ -94,6 +94,35 @@ def getVolumeSelfHealStatus(args):
return exitstatus, message
+def getVolumeGeoRepStatus(args):
+ try:
+ volume = glustercli.volumeGeoRepStatus(args.volume)
+ except glustercli.GlusterCmdFailedException as e:
+ out = ("Geo replication status could not be determined - %s"
+ % '.'.join(e.err))
+ return utils.PluginStatusCode.WARNING, out
+
+ if volume.get(args.volume) is None:
+ 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 - %s" % volume[args.volume]['detail']
+ elif volume[args.volume]['status'] == glustercli.GeoRepStatus.FAULTY:
+ exitstatus = utils.PluginStatusCode.CRITICAL
+ message = "Faulty - %s" % volume[args.volume]['detail']
+ elif (volume[args.volume]['status'] ==
+ glustercli.GeoRepStatus.NOT_STARTED):
+ exitstatus = utils.PluginStatusCode.WARNING
+ message = "Not Started"
+ else:
+ exitstatus = utils.PluginStatus.OK
+ message = "OK"
+ return exitstatus, message
+
+
def parse_input():
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--volume", action="store",
@@ -103,7 +132,7 @@ def parse_input():
default="info",
dest="type",
help="Type of status to be shown. Possible values:",
- choices=["info", "quota", "self-heal"])
+ choices=["info", "quota", "self-heal", "geo-rep"])
args = parser.parse_args()
return args
@@ -116,5 +145,7 @@ if __name__ == '__main__':
exitstatus, message = getVolumeQuotaStatus(args)
if args.type == "self-heal":
exitstatus, message = getVolumeSelfHealStatus(args)
+ if args.type == "geo-rep":
+ exitstatus, message = getVolumeGeoRepStatus(args)
print message
exit(exitstatus)