1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-16 15:33:46 +01:00

Added a safeguard and print usage when no argument given

This commit is contained in:
Denis GERMAIN 2016-12-04 12:20:06 +01:00
parent ca07c14132
commit 77be9cb42d

View File

@ -110,6 +110,7 @@ def main():
sys.exit(2) sys.exit(2)
check_suspend = False check_suspend = False
typeCheck = None
for o, a in opts: for o, a in opts:
if o in ('-c', '--cluster'): if o in ('-c', '--cluster'):
typeCheck = 'cluster' typeCheck = 'cluster'
@ -122,6 +123,10 @@ def main():
usage() usage()
sys.exit() sys.exit()
if typeCheck == None:
usage()
sys.exit()
try: try:
clustatOutput = os.popen('/usr/sbin/clustat -fx') clustatOutput = os.popen('/usr/sbin/clustat -fx')
dom = xml.dom.minidom.parse(clustatOutput) dom = xml.dom.minidom.parse(clustatOutput)