mirror of
https://github.com/opinkerfi/nagios-plugins.git
synced 2024-11-22 10:23:46 +01:00
This commit is contained in:
parent
d5d9316dec
commit
b31bc5fdae
@ -27,9 +27,9 @@ debugging = False
|
|||||||
# Some defaults
|
# Some defaults
|
||||||
show_perfdata = True
|
show_perfdata = True
|
||||||
show_longserviceoutput = True
|
show_longserviceoutput = True
|
||||||
uri='https://vmware:5989'
|
uri='https://is-hdq-esx0:5989'
|
||||||
username='root'
|
username='tommi'
|
||||||
password='root1234'
|
password='tommi'
|
||||||
namespace='root/cimv2'
|
namespace='root/cimv2'
|
||||||
|
|
||||||
|
|
||||||
@ -325,8 +325,11 @@ def parse_arguments():
|
|||||||
show_perfdata = True
|
show_perfdata = True
|
||||||
elif arg == '--no-perfdata':
|
elif arg == '--no-perfdata':
|
||||||
show_perfdata = False
|
show_perfdata = False
|
||||||
elif arg == '--url':
|
elif arg == '--uri':
|
||||||
url = arguments.pop(0)
|
uri = arguments.pop(0)
|
||||||
|
elif arg == '--hostname' or arg == '--host':
|
||||||
|
hostname = arguments.pop(0)
|
||||||
|
uri = 'https://%s:5989' % (hostname)
|
||||||
elif arg == '--username':
|
elif arg == '--username':
|
||||||
username = arguments.pop(0)
|
username = arguments.pop(0)
|
||||||
elif arg == '--password':
|
elif arg == '--password':
|
||||||
@ -359,12 +362,13 @@ def check_wbem():
|
|||||||
wbemclient = pywbem.WBEMConnection(uri, (username, password), namespace)
|
wbemclient = pywbem.WBEMConnection(uri, (username, password), namespace)
|
||||||
|
|
||||||
for classe in ClassesToCheck :
|
for classe in ClassesToCheck :
|
||||||
classe_status = ok
|
classe_status = not_present
|
||||||
debug("Checking classe %s" %(classe) )
|
debug("Checking classe %s" %(classe) )
|
||||||
instance_list = wbemclient.EnumerateInstances(classe)
|
instance_list = wbemclient.EnumerateInstances(classe)
|
||||||
for instance in instance_list :
|
for instance in instance_list :
|
||||||
elementName = instance['ElementName']
|
elementName = instance['ElementName']
|
||||||
debug( "ElementName = %s" %(elementName) )
|
for i in instance.keys():
|
||||||
|
debug ( "%s %s = %s" %(elementName, i, instance[i]) )
|
||||||
if instance['OperationalStatus'] is not None :
|
if instance['OperationalStatus'] is not None :
|
||||||
elementStatus = instance['OperationalStatus'][0]
|
elementStatus = instance['OperationalStatus'][0]
|
||||||
debug( "Element %s = %s" % (elementName, elementStatus) )
|
debug( "Element %s = %s" % (elementName, elementStatus) )
|
||||||
@ -394,9 +398,9 @@ def check_wbem():
|
|||||||
nagios_status = max(nagios_status, interpretStatus)
|
nagios_status = max(nagios_status, interpretStatus)
|
||||||
classe_status = max(classe_status, interpretStatus)
|
classe_status = max(classe_status, interpretStatus)
|
||||||
if interpretStatus > ok:
|
if interpretStatus > ok:
|
||||||
add_summary( "%s=%s" % (elementName, interpretStatus) )
|
add_summary( "%s=%s" % (elementName, state[interpretStatus]) )
|
||||||
add_long( "%s=%s" % (elementName, interpretStatus) )
|
add_long( "- %s=%s" % (elementName, state[interpretStatus]) )
|
||||||
add_long( "%s = %s" % (classe, classe_status) )
|
add_long( "%s = %s" % (classe, state[classe_status]) )
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
parse_arguments()
|
parse_arguments()
|
||||||
|
Loading…
Reference in New Issue
Block a user