@@ -36,6 +36,7 @@
# Copyright (c) 2012 Craig Hart
# Copyright (c) 2013 Carl R. Friend
# Copyright (c) 2015 Andreas Gottwald
+# Copyright (c) 2015 Stanislav German-Evtushenko
#
# The VMware 4.1 CIM API is documented here:
# http://www.vmware.com/support/developer/cim-sdk/4.1/smash/cim_smash_410_prog.pdf
@@ -220,6 +221,10 @@
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Added support for patched pywbem 0.7.0 and new version 0.8.0, handle SSL error exception
#@---------------------------------------------------
+#@ Date : 20150710
+#@ Author : Stanislav German-Evtushenko
+#@ Reason : Exit Unknown instead of Critical for timeouts and auth errors
+#@---------------------------------------------------
import sys
import time
@@ -229,7 +234,7 @@
import pkg_resources
from optparse import OptionParser,OptionGroup
-version = '20150626'
+version = '20150710'
NS = 'root/cimv2'
@@ -570,8 +575,8 @@
on_windows = False
import signal
def handler(signum, frame):
- print 'CRITICAL: Execution time too long!'
- sys.exit(ExitCritical)
+ print 'UNKNOWN: Execution time too long!'
+ sys.exit(ExitUnknown)
# connection to host
verboseoutput("Connection to "+hosturl)
@@ -640,13 +645,13 @@
instance_list = wbemclient.EnumerateInstances(classe)
except pywbem.cim_operations.CIMError,args:
if ( args[1].find('Socket error') >= 0 ):
- print "CRITICAL: %s" %args
- sys.exit (ExitCritical)
+ print "UNKNOWN: %s" %args
+ sys.exit (ExitUnknown)
else:
verboseoutput("Unknown CIM Error: %s" % args)
except pywbem.cim_http.AuthError,arg:
verboseoutput("Global exit set to UNKNOWN")
- GlobalStatus = ExitCritical
+ GlobalStatus = ExitUnknown
print "UNKNOWN: Authentication Error"
sys.exit (GlobalStatus)
else:
|