1
0
mirror of https://github.com/Napsty/check_esxi_hardware.git synced 2026-02-06 15:15:20 +01:00

46 Commits

Author SHA1 Message Date
Napsty
8836e8ecea Allow regular expressions from ignore list (-r) 2019-05-10 09:59:10 +02:00
Napsty
8bcf7309d9 Allow regular expressions from ignore list (-r) 2019-05-03 17:09:34 +02:00
Claudio Kuenzler
df56d7373d Merge pull request #30 from Napsty/python3
Python3 compatibility
2018-10-02 06:58:00 +02:00
Claudio Kuenzler
6aebd1a4bb Added future statement for print function 2018-10-01 12:39:10 +02:00
Claudio Kuenzler
96aced6377 Python3 compatibility 2018-10-01 11:15:59 +02:00
Claudio Kuenzler
9f8b22a393 version bump 2018-04-11 07:35:09 +02:00
Claudio Kuenzler
413dac781b Merge pull request #21 from peternewman/master
Throw an unknown if we can't fetch the data for some reason
2018-04-11 07:33:28 +02:00
Peter Newman
21e0c2b3ed Fix a whitespace issue 2018-04-10 14:37:18 +01:00
Peter Newman
b758ee20df Merge pull request #1 from Napsty/master
Resync with master
2018-04-10 14:36:13 +01:00
Claudio Kuenzler
277206abc7 Merge pull request #28 from Napsty/pywbemversion
Try to use internal pywbem function to determine version
2018-03-29 09:19:41 +02:00
Claudio Kuenzler
bd61850aa5 Try to use internal pywbem function to determine version 2018-03-29 09:15:07 +02:00
Claudio Kuenzler
ccb315d2d7 Merge pull request #23 from Napsty/lcd
Option --no-lcd
2017-09-05 21:08:58 +02:00
Claudio Kuenzler
575c4b47a7 Ready for new version 2017-09-05 21:06:53 +02:00
Claudio Kuenzler
0e62849ffb Define lcd ignore list before checking classes 2017-09-02 11:24:37 +02:00
Claudio Kuenzler
9ea8ba5967 Corected lcd condition 2017-09-02 11:21:31 +02:00
Claudio Kuenzler
7d4a85d0f3 Update check_esxi_hardware.py 2017-09-01 16:49:19 +02:00
Claudio Kuenzler
ff33e0a7b8 Debugging --no-lcd 2017-09-01 07:05:54 +02:00
Claudio Kuenzler
cec24c19bd Added --no-lcd option 2017-08-31 21:19:34 +02:00
Peter Newman
db0ffb7a05 Throw another unknown if we can't fetch the data elsewhere for some reason 2017-01-25 10:48:19 +00:00
Peter Newman
3566f03ecb SPaG 2017-01-24 18:06:35 +00:00
Peter Newman
ecf93a695e Throw an unknown if we can't fetch the data for some reason 2017-01-24 17:57:28 +00:00
Claudio Kuenzler
89f9e505c3 Added support for pywbem 0.9.x (and upcoming releases) 2016-10-13 15:59:19 +02:00
Claudio Kuenzler
82a4156e34 Bump version, edit changelog 2016-05-31 07:28:55 +02:00
Claudio Kuenzler
1f7c3b5927 Merge pull request #17 from Napsty/ports
Add CIM port option, adapt help
2016-05-31 07:27:03 +02:00
Claudio Kuenzler
ced39ad416 Add CIM port option, adapt help 2016-04-14 21:41:31 +02:00
Claudio Kuenzler
ec7db6479d Merge pull request #16 from Napsty/pywbem-versions
Distinguish between pywbem 0.7 and 0.8
2016-04-11 15:21:16 +02:00
Claudio Kuenzler
496ae6cf31 Distinguish between pywbem 0.7 and 0.8 2016-04-11 15:19:37 +02:00
Claudio Kuenzler
d8a95f864f Merge pull request #14 from stefaro/patch-1
Merge pull request from Stefan Roos. Declare hosturl variable. Remove sensor_value variable (it's not used).
2016-04-07 13:51:36 +02:00
Stefan Roos
156016869a Update check_esxi_hardware.py
Removed some modifications.
2016-04-07 10:11:40 +03:00
stefaro
03f8ca8335 Minor changes and cleanup
Removed unused sensor_value variable and string import.
Removed no SSL tryout on pywbem v 0.0.7 (default version doesn't have no_verification).
Added global hosturl variable declaration after imports.
Added "Front Panel Board 1 FP LCD Cable 0: Connected" to ignore list (LENOVO System x3550 M5).
2015-11-11 09:57:05 +02:00
Claudio Kuenzler
3727e67609 Exit Unknown instead of Critical for non-essential errors 2015-07-10 09:56:25 +02:00
Claudio Kuenzler
8c147a204e Merge pull request #12 from giner/patch-1
check_esxi_hardware.py: unknown instead of crit
2015-07-10 09:45:02 +02:00
Napsty
0036c441de Change version number for public release 2015-06-26 14:50:10 +02:00
Napsty
c806fb4d90 Change version number for public release 2015-06-26 14:30:42 +02:00
Napsty
6c8a4bfd63 Extended pywbem version compatibility 2015-06-10 12:47:12 +02:00
Stanislav German-Evtushenko
fb038edcda check_esxi_hardware.py: revert last change
1. This change was wrong and inappropriate.
2. The issue I tried to fix was caused by the bug in python library pywbem: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=780264
2015-06-01 19:52:59 +03:00
Napsty
3f97ca6485 Added support for patched pywbem 0.7.0 and new version 0.8.0, handle SSL error exception 2015-05-12 08:45:32 +02:00
Stanislav German-Evtushenko
b3c0ca4cdd check_esxi_hardware.py: force exit on timeout
Replace sys.exit by os._exit to be sure that the script stops on timeout immediately and does not produce false-positive results (usually it comes to WARNING).
2015-04-07 15:56:00 +03:00
Stanislav German-Evtushenko
e3a43a5dd0 check_esxi_hardware.py: unknown instead of crit
Set status to unknown instead of critical for timeouts, authentication errors and such things as those issues are critical for the check itself but not for the service.
2015-03-16 15:16:47 +03:00
Napsty
8aecf4e7d1 Change version number for public release 2015-01-19 16:48:38 +01:00
Claudio Kuenzler
60b03332f9 Fix NoneType element bug
Andreas Gottwald sent a patch which fixes an issue, when the CIM element was a "NoneType" element but the plugin wanted to read a string from it. 

    Traceback (most recent call last):
     File "./check_esxi_hardware.py", line 629, in <module>
    verboseoutput("  Element Name = "+elementName)
    TypeError: cannot concatenate 'str' and 'NoneType' objects
2015-01-15 15:13:47 +01:00
Claudio Kuenzler
16b07977ae Adapt date
The change for the chassis serial number was already prepared a few months ago but I only found time today to do the merge and the release. Therefore adapting the date in history and version variable to today (20150109)
2015-01-09 11:56:17 +01:00
Claudio Kuenzler
16e85dcc0c Merge pull request #10 from Napsty/chassissn
Added Serial Number for Chassis
2015-01-09 11:54:31 +01:00
Napsty
d67db0b2ff Fixed uninitialized variable isblade 2014-09-16 13:27:48 +02:00
Napsty
6abc24f522 Removed autoindent, added spaced instead 2014-09-09 17:30:55 +02:00
Napsty
629911c8de Output serial number of chassis if a blade server is checked 2014-09-09 17:28:53 +02:00
2 changed files with 167 additions and 44 deletions

View File

@@ -8,4 +8,4 @@ This is the public git repository for development of the plugin.
Documentation + Production Ready Plugin
-------------
Please refer to http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php
Please refer to https://www.claudiokuenzler.com/monitoring-plugins/check_esxi_hardware.php

View File

@@ -24,7 +24,7 @@
# Copyright (c) 2008 David Ligeret
# Copyright (c) 2009 Joshua Daniel Franklin
# Copyright (c) 2010 Branden Schneider
# Copyright (c) 2010-2014 Claudio Kuenzler
# Copyright (c) 2010-2019 Claudio Kuenzler
# Copyright (c) 2010 Samir Ibradzic
# Copyright (c) 2010 Aaron Rogers
# Copyright (c) 2011 Ludovic Hutin
@@ -35,6 +35,10 @@
# Copyright (c) 2011 Ian Chard
# Copyright (c) 2012 Craig Hart
# Copyright (c) 2013 Carl R. Friend
# Copyright (c) 2015 Andreas Gottwald
# Copyright (c) 2015 Stanislav German-Evtushenko
# Copyright (c) 2015 Stefan Roos
# Copyright (c) 2018 Peter Newman
#
# 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
@@ -43,8 +47,8 @@
# The VMware 5.x CIM API is documented here:
# http://pubs.vmware.com/vsphere-50/index.jsp?nav=/5_1_1
#
# This Nagios plugin is maintained here:
# http://www.claudiokuenzler.com/nagios-plugins/check_esxi_hardware.php
# This monitoring plugin is maintained and documented here:
# https://www.claudiokuenzler.com/monitoring-plugins/check_esxi_hardware.php
#
#@---------------------------------------------------
#@ History
@@ -207,17 +211,72 @@
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Another two workarounds for Dell systems (VGA Cable Pres 0, Add-in Card 4 PEM Presence 0)
#@---------------------------------------------------
#@ Date : 20150109
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Output serial number of chassis if a blade server is checked
#@---------------------------------------------------
#@ Date : 20150119
#@ Author : Andreas Gottwald
#@ Reason : Fix NoneType element bug
#@---------------------------------------------------
#@ Date : 20150626
#@ 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
#@---------------------------------------------------
#@ Date : 20151111
#@ Author : Stefan Roos
#@ Reason : Removed unused sensor_value variable and string import.
#@ Reason : Added global hosturl variable declaration after imports.
#@---------------------------------------------------
#@ Date : 20160411
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Distinguish between pywbem 0.7 and 0.8 (which is now released)
#@---------------------------------------------------
#@ Date : 20160531
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Add parameter for variable CIM port (useful when behind NAT)
#@---------------------------------------------------
#@ Date : 20161013
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Added support for pywbem 0.9.x (and upcoming releases)
#@---------------------------------------------------
#@ Date : 20170905
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Added option to ignore LCD/Display related elements (--no-lcd)
#@---------------------------------------------------
#@ Date : 20180329
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Try to use internal pywbem function to determine version
#@---------------------------------------------------
#@ Date : 20180411
#@ Author : Peter Newman
#@ Reason : Throw an unknown if we can't fetch the data for some reason
#@---------------------------------------------------
#@ Date : 20181001
#@ Author : Claudio Kuenzler
#@ Reason : python3 compatibility
#@---------------------------------------------------
#@ Date : 20190510
#@ Author : Claudio Kuenzler
#@ Reason : Allow regular expressions from ignore list (-r)
#@---------------------------------------------------
from __future__ import print_function
import sys
import time
import pywbem
import re
import string
import pkg_resources
from optparse import OptionParser,OptionGroup
version = '20140319'
version = '20190510'
NS = 'root/cimv2'
hosturl = ''
# define classes to check 'OperationStatus' instance
ClassesToCheck = [
@@ -278,6 +337,9 @@ perf_Prefix = {
# host name
hostname=''
# cim port
cimport=''
# user
user=''
@@ -298,6 +360,8 @@ timeout = 0
# elements to ignore (full SEL, broken BIOS, etc)
ignore_list=[]
regex_ignore_list=[]
regex=False
# urlise model and tag numbers (currently only Dell supported, but the code does the right thing for other vendors)
urlise_country=''
@@ -308,6 +372,7 @@ get_volts = True
get_current = True
get_temp = True
get_fan = True
get_lcd = True
# define exit codes
ExitOK = 0
@@ -315,6 +380,9 @@ ExitWarning = 1
ExitCritical = 2
ExitUnknown = 3
# Special handling for blade servers
isblade = "no"
def dell_country(country):
if country == 'at': # Austria
return 'at/de/'
@@ -424,19 +492,16 @@ def urlised_serialnumber(vendor,country,SerialNumber):
def verboseoutput(message) :
if verbose:
print "%s %s" % (time.strftime("%Y%m%d %H:%M:%S"), message)
print(time.strftime("%Y%m%d %H:%M:%S"), message)
# ----------------------------------------------------------------------
def getopts() :
global hosturl,user,password,vendor,verbose,perfdata,urlise_country,timeout,ignore_list,get_power,get_volts,get_current,get_temp,get_fan
usage = "usage: %prog https://hostname user password system [verbose]\n" \
"example: %prog https://my-shiny-new-vmware-server root fakepassword dell\n\n" \
"or, using new style options:\n\n" \
"usage: %prog -H hostname -U username -P password [-V system -v -p -I XX]\n" \
"example: %prog -H my-shiny-new-vmware-server -U root -P fakepassword -V auto -I uk\n\n" \
global hosturl,cimport,user,password,vendor,verbose,perfdata,urlise_country,timeout,ignore_list,regex,get_power,get_volts,get_current,get_temp,get_fan,get_lcd
usage = "usage: %prog -H hostname -U username -P password [-C port -V vendor -v -p -I XX -i list,list -r]\n" \
"example: %prog -H hostname -U root -P password -C 5989 -V auto -I uk\n\n" \
"or, verbosely:\n\n" \
"usage: %prog --host=hostname --user=username --pass=password [--vendor=system --verbose --perfdata --html=XX]\n"
"usage: %prog --host=hostname --user=username --pass=password [--cimport=port --vendor=system --verbose --perfdata --html=XX]\n"
parser = OptionParser(usage=usage, version="%prog "+version)
group1 = OptionGroup(parser, 'Mandatory parameters')
@@ -447,6 +512,7 @@ def getopts() :
group1.add_option("-P", "--pass", dest="password", \
help="password, if password matches file:<path>, first line of given file will be used as password", metavar="PASS")
group2.add_option("-C", "--cimport", dest="cimport", help="CIM port (default 5989)", metavar="CIMPORT")
group2.add_option("-V", "--vendor", dest="vendor", help="Vendor code: auto, dell, hp, ibm, intel, or unknown (default)", \
metavar="VENDOR", type='choice', choices=['auto','dell','hp','ibm','intel','unknown'],default="unknown")
group2.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, \
@@ -459,6 +525,8 @@ def getopts() :
help="timeout in seconds - no effect on Windows (default = no timeout)")
group2.add_option("-i", "--ignore", action="store", type="string", dest="ignore", default="", \
help="comma-separated list of elements to ignore")
group2.add_option("-r", "--regex", action="store_true", dest="regex", default=False, \
help="allow regular expression lookup of ignore list")
group2.add_option("--no-power", action="store_false", dest="get_power", default=True, \
help="don't collect power performance data")
group2.add_option("--no-volts", action="store_false", dest="get_volts", default=True, \
@@ -469,20 +537,22 @@ def getopts() :
help="don't collect temperature performance data")
group2.add_option("--no-fan", action="store_false", dest="get_fan", default=True, \
help="don't collect fan performance data")
group2.add_option("--no-lcd", action="store_false", dest="get_lcd", default=True, \
help="don't collect lcd/front display status")
parser.add_option_group(group1)
parser.add_option_group(group2)
# check input arguments
if len(sys.argv) < 2:
print "no parameters specified\n"
print("no parameters specified\n")
parser.print_help()
sys.exit(-1)
# if first argument starts with 'https://' we have old-style parameters, so handle in old way
if re.match("https://",sys.argv[1]):
# check input arguments
if len(sys.argv) < 5:
print "too few parameters\n"
print("too few parameters\n")
parser.print_help()
sys.exit(-1)
if len(sys.argv) > 5 :
@@ -500,7 +570,7 @@ def getopts() :
mandatories = ['host', 'user', 'password']
for m in mandatories:
if not options.__dict__[m]:
print "mandatory parameter '--" + m + "' is missing\n"
print("mandatory parameter '--" + m + "' is missing\n")
parser.print_help()
sys.exit(-1)
@@ -514,17 +584,20 @@ def getopts() :
user=options.user
password=options.password
cimport=options.cimport
vendor=options.vendor.lower()
verbose=options.verbose
perfdata=options.perfdata
urlise_country=options.urlise_country.lower()
timeout=options.timeout
ignore_list=options.ignore.split(',')
regex=options.regex
get_power=options.get_power
get_volts=options.get_volts
get_current=options.get_current
get_temp=options.get_temp
get_fan=options.get_fan
get_lcd=options.get_lcd
# if user or password starts with 'file:', use the first string in file as user, second as password
if (re.match('^file:', user) or re.match('^file:', password)):
@@ -553,12 +626,46 @@ if os_platform != "win32":
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)
if cimport:
verboseoutput("Using manually defined CIM port "+cimport)
hosturl += ':'+cimport
# Append lcd related elements to ignore list if --no-lcd was used
verboseoutput("LCD Status: %s" % get_lcd)
if not get_lcd:
ignore_list.append("System Board 1 LCD Cable Pres 0: Connected")
ignore_list.append("System Board 1 VGA Cable Pres 0: Connected")
ignore_list.append("Front Panel Board 1 FP LCD Cable 0: Connected")
ignore_list.append("Front Panel Board 1 FP LCD Cable 0: Config Error")
# connection to host
verboseoutput("Connection to "+hosturl)
wbemclient = pywbem.WBEMConnection(hosturl, (user,password), NS)
# pywbem 0.7.0 handling is special, some patched 0.7.0 installations work differently
try:
pywbemversion = pywbem.__version__
except:
pywbemversion = pkg_resources.get_distribution("pywbem").version
else:
pywbemversion = pywbem.__version__
verboseoutput("Found pywbem version "+pywbemversion)
if '0.7.' in pywbemversion:
try:
conntest = pywbem.WBEMConnection(hosturl, (user,password))
c = conntest.EnumerateInstances('CIM_Card')
except:
#raise
verboseoutput("Connection error, disable SSL certificate verification (probably patched pywbem)")
wbemclient = pywbem.WBEMConnection(hosturl, (user,password), no_verification=True)
else:
verboseoutput("Connection worked")
wbemclient = pywbem.WBEMConnection(hosturl, (user,password))
# pywbem 0.8.0 and later
else:
wbemclient = pywbem.WBEMConnection(hosturl, (user,password), NS, no_verification=True)
# Add a timeout for the script. When using with Nagios, the Nagios timeout cannot be < than plugin timeout.
if on_windows == False and timeout > 0:
@@ -577,16 +684,19 @@ ExitMsg = ""
if vendor=='auto':
try:
c=wbemclient.EnumerateInstances('CIM_Chassis')
except pywbem.cim_operations.CIMError,args:
except pywbem.cim_operations.CIMError as args:
if ( args[1].find('Socket error') >= 0 ):
print "UNKNOWN: %s" %args
print("UNKNOWN: {}".format(args))
sys.exit (ExitUnknown)
elif ( args[1].find('ThreadPool --- Failed to enqueue request') >= 0 ):
print("UNKNOWN: {}".format(args))
sys.exit (ExitUnknown)
else:
verboseoutput("Unknown CIM Error: %s" % args)
except pywbem.cim_http.AuthError,arg:
except pywbem.cim_http.AuthError as arg:
verboseoutput("Global exit set to UNKNOWN")
GlobalStatus = ExitUnknown
print "UNKNOWN: Authentication Error"
print("UNKNOWN: Authentication Error")
sys.exit (GlobalStatus)
else:
man=c[0][u'Manufacturer']
@@ -605,27 +715,37 @@ for classe in ClassesToCheck :
verboseoutput("Check classe "+classe)
try:
instance_list = wbemclient.EnumerateInstances(classe)
except pywbem.cim_operations.CIMError,args:
except pywbem.cim_operations.CIMError as args:
if ( args[1].find('Socket error') >= 0 ):
print "CRITICAL: %s" %args
sys.exit (ExitCritical)
print("UNKNOWN: {}".format(args))
sys.exit (ExitUnknown)
elif ( args[1].find('ThreadPool --- Failed to enqueue request') >= 0 ):
print("UNKNOWN: {}".format(args))
sys.exit (ExitUnknown)
else:
verboseoutput("Unknown CIM Error: %s" % args)
except pywbem.cim_http.AuthError,arg:
except pywbem.cim_http.AuthError as arg:
verboseoutput("Global exit set to UNKNOWN")
GlobalStatus = ExitCritical
print "UNKNOWN: Authentication Error"
GlobalStatus = ExitUnknown
print("UNKNOWN: Authentication Error")
sys.exit (GlobalStatus)
else:
# GlobalStatus = ExitOK #ARR
for instance in instance_list :
sensor_value = ""
elementName = instance['ElementName']
if elementName is None :
elementName = 'Unknown'
elementNameValue = elementName
verboseoutput(" Element Name = "+elementName)
# Ignore element if we don't want it
if elementName in ignore_list :
if (regex == True) and (len(ignore_list) > 0) :
for ignore in ignore_list :
if re.search(ignore, elementName, re.IGNORECASE) :
verboseoutput(" (ignored through regex)")
regex_ignore_list.append(elementName)
if (elementName in ignore_list) or (elementName in regex_ignore_list) :
verboseoutput(" (ignored)")
continue
@@ -642,6 +762,7 @@ for classe in ClassesToCheck :
man = 'Unknown Manufacturer'
verboseoutput(" Manufacturer = "+man)
SerialNumber = instance[u'SerialNumber']
SerialChassis = instance[u'SerialNumber']
if SerialNumber:
verboseoutput(" SerialNumber = "+SerialNumber)
server_info = man + ' '
@@ -655,6 +776,7 @@ for classe in ClassesToCheck :
SerialNumber = instance[u'SerialNumber']
if SerialNumber:
verboseoutput(" SerialNumber = "+SerialNumber)
isblade = "yes"
# Report detail of Numeric Sensors and generate nagios perfdata
@@ -723,7 +845,6 @@ for classe in ClassesToCheck :
verboseoutput(" Family = %d" % instance['Family'])
verboseoutput(" CurrentClockSpeed = %dMHz" % instance['CurrentClockSpeed'])
# HP Check
if vendor == "hp" :
if instance['HealthState'] is not None :
@@ -739,11 +860,11 @@ for classe in ClassesToCheck :
30 : ExitCritical, # Non-recoverable Error
}[elementStatus]
if (interpretStatus == ExitCritical) :
verboseoutput("GLobal exit set to CRITICAL")
verboseoutput("Global exit set to CRITICAL")
GlobalStatus = ExitCritical
ExitMsg += " CRITICAL : %s " % elementNameValue
if (interpretStatus == ExitWarning and GlobalStatus != ExitCritical) :
verboseoutput("GLobal exit set to WARNING")
verboseoutput("Global exit set to WARNING")
GlobalStatus = ExitWarning
ExitMsg += " WARNING : %s " % elementNameValue
# Added the following for when GlobalStatus is ExitCritical and a warning is detected
@@ -760,9 +881,7 @@ for classe in ClassesToCheck :
elif (vendor == "dell" or vendor == "intel" or vendor == "ibm" or vendor=="unknown") :
# Added 20121027 As long as Dell doesnt correct these CIM elements return code we have to ignore it
ignore_list.append("System Board 1 Riser Config Err 0: Connected")
ignore_list.append("System Board 1 LCD Cable Pres 0: Connected")
ignore_list.append("System Board 1 VGA Cable Pres 0: Connected")
ignore_list.append("Add-in Card 4 PEM Presence 0: Connected")
ignore_list.append("Add-in Card 4 PEM Presence 0: Connected")
if instance['OperationalStatus'] is not None :
elementStatus = instance['OperationalStatus'][0]
verboseoutput(" Element Op Status = %d" % elementStatus)
@@ -794,7 +913,7 @@ for classe in ClassesToCheck :
GlobalStatus = ExitCritical
ExitMsg += " CRITICAL : %s " % elementNameValue
if (interpretStatus == ExitWarning and GlobalStatus != ExitCritical) :
verboseoutput("GLobal exit set to WARNING")
verboseoutput("Global exit set to WARNING")
GlobalStatus = ExitWarning
ExitMsg += " WARNING : %s " % elementNameValue
# Added same logic as in 20100702 here, otherwise Dell servers would return UNKNOWN instead of OK
@@ -813,6 +932,10 @@ if (urlise_country != '') :
SerialNumber = urlised_serialnumber(vendor,urlise_country,SerialNumber)
server_info = urlised_server_info(vendor,urlise_country,server_info)
# If this is a blade server, also output chassis serial number as additional info
if (isblade == "yes") :
SerialNumber += " Chassis S/N: %s " % (SerialChassis)
# Output performance data
perf = '|'
if perfdata:
@@ -834,12 +957,12 @@ if perf == '|':
perf = ''
if GlobalStatus == ExitOK :
print "OK - Server: %s %s %s%s" % (server_info, SerialNumber, bios_info, perf)
print("OK - Server: %s %s %s%s" % (server_info, SerialNumber, bios_info, perf))
elif GlobalStatus == ExitUnknown :
print "UNKNOWN: %s" % (ExitMsg) #ARR
print("UNKNOWN: %s" % (ExitMsg)) #ARR
else:
print "%s- Server: %s %s %s%s" % (ExitMsg, server_info, SerialNumber, bios_info, perf)
print("%s - Server: %s %s %s%s" % (ExitMsg, server_info, SerialNumber, bios_info, perf))
sys.exit (GlobalStatus)