summaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorSahina Bose <sabose@redhat.com>2014-04-10 15:48:32 +0530
committerBala.FA <barumuga@redhat.com>2014-04-29 10:14:33 +0530
commit86a404d7ce805a25762cd66c310b1ad9e3a2a779 (patch)
treed686e65934000e6f750360b1af6917863b3c3686 /plugins
parent96122accad447a7c11ce91678465600c262492a2 (diff)
plugins: Enhanced volume status with quota status
Added an optional parameter to query quota status Added command to nrpe.cfg Change-Id: I9f60ed1a98cb2ca59b799cf9c09e3621b7bd8c0c Signed-off-by: Sahina Bose <sabose@redhat.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Makefile.am1
-rwxr-xr-xplugins/check_volume_status.py33
2 files changed, 29 insertions, 5 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am
index eb88ee1..c74cc3e 100644
--- a/plugins/Makefile.am
+++ b/plugins/Makefile.am
@@ -11,6 +11,7 @@ dist_glusternagiosplugins_PYTHON = \
check_disk_and_inode.py \
check_vol_utilization.py \
check_vol_status.py \
+ check_volume_status.py \
cpu.py \
discoverpeers.py \
discoverlogicalcomponents.py \
diff --git a/plugins/check_volume_status.py b/plugins/check_volume_status.py
index 383ec14..df68657 100755
--- a/plugins/check_volume_status.py
+++ b/plugins/check_volume_status.py
@@ -39,23 +39,46 @@ def getVolumeStatus(args):
exitstatus = utils.PluginStatusCode.CRITICAL
message = "CRITICAL: Volume is stopped"
except glustercli.GlusterCmdFailedException as e:
- out = "UNKNOWN: Command execution failed"
- return utils.PluginStatusCode.UNKNOWN,out
+ out = ("UNKNOWN: Command execution failed %s" % e.message)
+ return utils.PluginStatusCode.UNKNOWN, out
return exitstatus, message
+
+def getVolumeQuotaStatus(args):
+ try:
+ status = glustercli.volumeQuotaStatus(args.volume)
+ except glustercli.GlusterCmdFailedException as e:
+ out = ("QUOTA: Quota status could not be determined %s" % e.message)
+ return utils.PluginStatusCode.UNKNOWN, out
+
+ if status == glustercli.VolumeQuotaStatus.EXCEEDED:
+ return utils.PluginStatusCode.WARNING, "QUOTA: limit exceeded"
+ elif status == glustercli.VolumeQuotaStatus.DISABLED:
+ return utils.PluginStatusCode.OK, "QUOTA: not enabled or configured"
+ else:
+ return utils.PluginStatusCode.OK, "QUOTA: OK"
+
+
def parse_input():
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--volume", action="store",
required=True,
- help="Name of the volume for which"
- " status is to be shown")
+ help="Name of the volume for status")
+ parser.add_argument("-t", "--type", action="store",
+ default="info",
+ dest="type",
+ help="Type of status to be shown. Possible values:",
+ choices=["info", "quota"])
args = parser.parse_args()
return args
if __name__ == '__main__':
args = parse_input()
- exitstatus, message = getVolumeStatus(args)
+ if args.type == "info":
+ exitstatus, message = getVolumeStatus(args)
+ if args.type == "quota":
+ exitstatus, message = getVolumeQuotaStatus(args)
print message
exit(exitstatus)