mirror of
https://github.com/Napsty/check_esxi_hardware.git
synced 2026-02-06 15:15:20 +01:00
Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7aaaae4337 | ||
|
|
8a99d8aace | ||
|
|
141fdfb500 | ||
|
|
a548d358e0 | ||
|
|
2b6511a60a | ||
|
|
d154bc9f1b | ||
|
|
e4f406a309 | ||
|
|
d8f9fa1c82 | ||
|
|
274dceee74 |
32
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
32
.github/ISSUE_TEMPLATE/bug_report.md
vendored
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
**Before actually creating a new issue**
|
||||||
|
I confirm, I have read the FAQ (https://www.claudiokuenzler.com/blog/308/check-esxi-hardware-faq-frequently-asked-questions): Y/N
|
||||||
|
I confirm, I have restarted the CIM server (` /etc/init.d/sfcbd-watchdog restart `) on the ESXi server and the problem remains: Y/N
|
||||||
|
I confirm, I have cleared the server's local IPMI cache (`localcli hardware ipmi sel clear`) and restarted the services (`/sbin/services.sh restart`) on the ESXi server and the problem remains: Y/N
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**Show the full plugin output, including the command with -v parameter**
|
||||||
|
Run the plugin with `-v` parameter and show the full output (including command) here. Obviously obfuscate credentials.
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Versions:**
|
||||||
|
- check_esxi_hardware plugin:
|
||||||
|
- VMware ESXi:
|
||||||
|
- pywbem:
|
||||||
|
- Python:
|
||||||
|
- Third party tools (Dell OMSA, HP Offline Bundle, etc):
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
||||||
@@ -9,3 +9,7 @@ This is the public git repository for development of the plugin.
|
|||||||
Documentation + Production Ready Plugin
|
Documentation + Production Ready Plugin
|
||||||
-------------
|
-------------
|
||||||
Please refer to https://www.claudiokuenzler.com/monitoring-plugins/check_esxi_hardware.php
|
Please refer to https://www.claudiokuenzler.com/monitoring-plugins/check_esxi_hardware.php
|
||||||
|
|
||||||
|
Compatibility list
|
||||||
|
-------------
|
||||||
|
Please check https://www.claudiokuenzler.com/blog/1110/check_esxi_hardware-esxi-compatibility-matrix-list for a (non conclusive) matrix of known working versions.
|
||||||
|
|||||||
@@ -15,16 +15,14 @@
|
|||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
#
|
#
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program; if not, write to the Free Software
|
# along with this program; if not, see <https://www.gnu.org/licenses/>.
|
||||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
|
|
||||||
# 02110-1301, USA.
|
|
||||||
#
|
#
|
||||||
# Pre-req : pywbem
|
# Pre-req : pywbem
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 David Ligeret
|
# Copyright (c) 2008 David Ligeret
|
||||||
# Copyright (c) 2009 Joshua Daniel Franklin
|
# Copyright (c) 2009 Joshua Daniel Franklin
|
||||||
# Copyright (c) 2010 Branden Schneider
|
# Copyright (c) 2010 Branden Schneider
|
||||||
# Copyright (c) 2010-2019 Claudio Kuenzler
|
# Copyright (c) 2010-2022 Claudio Kuenzler
|
||||||
# Copyright (c) 2010 Samir Ibradzic
|
# Copyright (c) 2010 Samir Ibradzic
|
||||||
# Copyright (c) 2010 Aaron Rogers
|
# Copyright (c) 2010 Aaron Rogers
|
||||||
# Copyright (c) 2011 Ludovic Hutin
|
# Copyright (c) 2011 Ludovic Hutin
|
||||||
@@ -39,14 +37,15 @@
|
|||||||
# Copyright (c) 2015 Stanislav German-Evtushenko
|
# Copyright (c) 2015 Stanislav German-Evtushenko
|
||||||
# Copyright (c) 2015 Stefan Roos
|
# Copyright (c) 2015 Stefan Roos
|
||||||
# Copyright (c) 2018 Peter Newman
|
# Copyright (c) 2018 Peter Newman
|
||||||
# Copyright (c) 2019 Luca Berra
|
# Copyright (c) 2020 Luca Berra
|
||||||
|
# Copyright (c) 2022 Marco Markgraf
|
||||||
#
|
#
|
||||||
# The VMware 4.1 CIM API is documented here:
|
# 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
|
# http://www.vmware.com/support/developer/cim-sdk/4.1/smash/cim_smash_410_prog.pdf
|
||||||
# http://www.vmware.com/support/developer/cim-sdk/smash/u2/ga/apirefdoc/
|
# http://www.vmware.com/support/developer/cim-sdk/smash/u2/ga/apirefdoc/
|
||||||
#
|
#
|
||||||
# The VMware 5.x CIM API is documented here:
|
# The VMware 5.5 and above CIM API is documented here:
|
||||||
# http://pubs.vmware.com/vsphere-50/index.jsp?nav=/5_1_1
|
# https://code.vmware.com/apis/207/cim
|
||||||
#
|
#
|
||||||
# This monitoring plugin is maintained and documented here:
|
# This monitoring plugin is maintained and documented here:
|
||||||
# https://www.claudiokuenzler.com/monitoring-plugins/check_esxi_hardware.php
|
# https://www.claudiokuenzler.com/monitoring-plugins/check_esxi_hardware.php
|
||||||
@@ -269,9 +268,31 @@
|
|||||||
#@ Author : Phil Randal (phil.randal@gmail.com)
|
#@ Author : Phil Randal (phil.randal@gmail.com)
|
||||||
#@ Reason : Fix lookup of warranty info for Dell (again)
|
#@ Reason : Fix lookup of warranty info for Dell (again)
|
||||||
#@---------------------------------------------------
|
#@---------------------------------------------------
|
||||||
#@ Date : 20191115
|
#@ Date : 20200605
|
||||||
#@ Author : Luca Berra
|
#@ Author : Luca Berra
|
||||||
#@ Reason : Add option to ignore chassis intrusion (Supermicro)
|
#@ Reason : Add option to ignore chassis intrusion (Supermicro)
|
||||||
|
#@---------------------------------------------------
|
||||||
|
#@ Date : 20200605
|
||||||
|
#@ Author : Claudio Kuenzler
|
||||||
|
#@ Reason : Add parameter (-S) for custom SSL/TLS protocol version
|
||||||
|
#@---------------------------------------------------
|
||||||
|
#@ Date : 20200710
|
||||||
|
#@ Author : Claudio Kuenzler
|
||||||
|
#@ Reason : Improve missing mandatory parameter error text (issue #47)
|
||||||
|
#@ Delete temporary openssl config file after use (issue #48)
|
||||||
|
#@---------------------------------------------------
|
||||||
|
#@ Date : 20210809
|
||||||
|
#@ Author : Claudio Kuenzler
|
||||||
|
#@ Reason : Fix TLSv1 usage (issue #51)
|
||||||
|
#@---------------------------------------------------
|
||||||
|
#@ Date : 20220509
|
||||||
|
#@ Author : Marco Markgraf
|
||||||
|
#@ Reason : Added JSON-output (Zabbix needs it)
|
||||||
|
#@---------------------------------------------------
|
||||||
|
#@ Date : 20221230
|
||||||
|
#@ Author : Claudio Kuenzler
|
||||||
|
#@ Reason : Fix bug when missing S/N (issue #68)
|
||||||
|
#@---------------------------------------------------
|
||||||
|
|
||||||
from __future__ import print_function
|
from __future__ import print_function
|
||||||
import sys
|
import sys
|
||||||
@@ -279,9 +300,10 @@ import time
|
|||||||
import pywbem
|
import pywbem
|
||||||
import re
|
import re
|
||||||
import pkg_resources
|
import pkg_resources
|
||||||
|
import json
|
||||||
from optparse import OptionParser,OptionGroup
|
from optparse import OptionParser,OptionGroup
|
||||||
|
|
||||||
version = '20191115'
|
version = '20221230'
|
||||||
|
|
||||||
NS = 'root/cimv2'
|
NS = 'root/cimv2'
|
||||||
hosturl = ''
|
hosturl = ''
|
||||||
@@ -329,6 +351,7 @@ sensor_Type = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
data = []
|
data = []
|
||||||
|
xdata = {}
|
||||||
|
|
||||||
perf_Prefix = {
|
perf_Prefix = {
|
||||||
1:'Pow',
|
1:'Pow',
|
||||||
@@ -360,6 +383,10 @@ vendor='unknown'
|
|||||||
# verbose
|
# verbose
|
||||||
verbose=False
|
verbose=False
|
||||||
|
|
||||||
|
# output json
|
||||||
|
format='string'
|
||||||
|
pretty=False
|
||||||
|
|
||||||
# Produce performance data output for nagios
|
# Produce performance data output for nagios
|
||||||
perfdata=False
|
perfdata=False
|
||||||
|
|
||||||
@@ -505,23 +532,32 @@ def verboseoutput(message) :
|
|||||||
|
|
||||||
# ----------------------------------------------------------------------
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
|
def xdataprint():
|
||||||
|
if format == 'json' and not pretty:
|
||||||
|
print(json.dumps(xdata, sort_keys=True))
|
||||||
|
if format == 'json' and pretty:
|
||||||
|
print(json.dumps(xdata, sort_keys=True, indent=4))
|
||||||
|
|
||||||
|
# ----------------------------------------------------------------------
|
||||||
|
|
||||||
def getopts() :
|
def getopts() :
|
||||||
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,get_intrusion
|
global hosturl,hostname,cimport,sslproto,user,password,vendor,verbose,perfdata,urlise_country,timeout,ignore_list,regex,get_power,get_volts,get_current,get_temp,get_fan,get_lcd,get_intrusion,format,pretty
|
||||||
usage = "usage: %prog -H hostname -U username -P password [-C port -V vendor -v -p -I XX -i list,list -r]\n" \
|
usage = "usage: %prog -H hostname -U username -P password [-C port -S proto -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" \
|
"example: %prog -H hostname -U root -P password -C 5989 -V auto -I uk\n\n" \
|
||||||
"or, verbosely:\n\n" \
|
"or, verbosely:\n\n" \
|
||||||
"usage: %prog --host=hostname --user=username --pass=password [--cimport=port --vendor=system --verbose --perfdata --html=XX]\n"
|
"usage: %prog --host=hostname --user=username --pass=password [--cimport=port --sslproto=version --vendor=system --verbose --perfdata --html=XX --format=json --pretty]\n"
|
||||||
|
|
||||||
parser = OptionParser(usage=usage, version="%prog "+version)
|
parser = OptionParser(usage=usage, version="%prog "+version)
|
||||||
group1 = OptionGroup(parser, 'Mandatory parameters')
|
group1 = OptionGroup(parser, 'Mandatory parameters')
|
||||||
group2 = OptionGroup(parser, 'Optional parameters')
|
group2 = OptionGroup(parser, 'Optional parameters')
|
||||||
|
|
||||||
group1.add_option("-H", "--host", dest="host", help="report on HOST", metavar="HOST")
|
group1.add_option("-H", "--host", dest="host", help="connect to HOST", metavar="HOST")
|
||||||
group1.add_option("-U", "--user", dest="user", help="user to connect as", metavar="USER")
|
group1.add_option("-U", "--user", dest="user", help="user to connect as", metavar="USER")
|
||||||
group1.add_option("-P", "--pass", dest="password", \
|
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")
|
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("-C", "--cimport", dest="cimport", help="CIM port (default 5989)", metavar="CIMPORT")
|
||||||
|
group2.add_option("-S", "--sslproto", dest="sslproto", help="SSL/TLS protocol version to overwrite system default: SSLv2, SSLv3, TLSv1, TLSv1.1, TLSv1.2, TLSv1.3", metavar="SSLPROTO")
|
||||||
group2.add_option("-V", "--vendor", dest="vendor", help="Vendor code: auto, dell, hp, ibm, intel, or unknown (default)", \
|
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")
|
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, \
|
group2.add_option("-v", "--verbose", action="store_true", dest="verbose", default=False, \
|
||||||
@@ -550,6 +586,10 @@ def getopts() :
|
|||||||
help="don't collect lcd/front display status")
|
help="don't collect lcd/front display status")
|
||||||
group2.add_option("--no-intrusion", action="store_false", dest="get_intrusion", default=True, \
|
group2.add_option("--no-intrusion", action="store_false", dest="get_intrusion", default=True, \
|
||||||
help="don't collect chassis intrusion status")
|
help="don't collect chassis intrusion status")
|
||||||
|
group2.add_option("--format", dest="format", help="'string' (default) or 'json'", \
|
||||||
|
metavar="FORMAT", type='choice', choices=['string','json'],default="string")
|
||||||
|
group2.add_option("--pretty", action="store_true", dest="pretty", default=False, \
|
||||||
|
help="return data as a pretty-printed json-array")
|
||||||
|
|
||||||
parser.add_option_group(group1)
|
parser.add_option_group(group1)
|
||||||
parser.add_option_group(group2)
|
parser.add_option_group(group2)
|
||||||
@@ -581,7 +621,7 @@ def getopts() :
|
|||||||
mandatories = ['host', 'user', 'password']
|
mandatories = ['host', 'user', 'password']
|
||||||
for m in mandatories:
|
for m in mandatories:
|
||||||
if not options.__dict__[m]:
|
if not options.__dict__[m]:
|
||||||
print("mandatory parameter '--" + m + "' is missing\n")
|
print("mandatory option '" + m + "' not defined. read usage in help.\n")
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
sys.exit(-1)
|
sys.exit(-1)
|
||||||
|
|
||||||
@@ -596,13 +636,16 @@ def getopts() :
|
|||||||
user=options.user
|
user=options.user
|
||||||
password=options.password
|
password=options.password
|
||||||
cimport=options.cimport
|
cimport=options.cimport
|
||||||
|
ignore_list=options.ignore.split(',')
|
||||||
|
format=options.format
|
||||||
|
pretty=options.pretty
|
||||||
|
perfdata=options.perfdata
|
||||||
|
regex=options.regex
|
||||||
|
sslproto=options.sslproto
|
||||||
|
timeout=options.timeout
|
||||||
|
urlise_country=options.urlise_country.lower()
|
||||||
vendor=options.vendor.lower()
|
vendor=options.vendor.lower()
|
||||||
verbose=options.verbose
|
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_power=options.get_power
|
||||||
get_volts=options.get_volts
|
get_volts=options.get_volts
|
||||||
get_current=options.get_current
|
get_current=options.get_current
|
||||||
@@ -641,10 +684,30 @@ if os_platform != "win32":
|
|||||||
print('UNKNOWN: Execution time too long!')
|
print('UNKNOWN: Execution time too long!')
|
||||||
sys.exit(ExitUnknown)
|
sys.exit(ExitUnknown)
|
||||||
|
|
||||||
|
# Use non-default CIM port
|
||||||
if cimport:
|
if cimport:
|
||||||
verboseoutput("Using manually defined CIM port "+cimport)
|
verboseoutput("Using manually defined CIM port "+cimport)
|
||||||
hosturl += ':'+cimport
|
hosturl += ':'+cimport
|
||||||
|
|
||||||
|
# Use non-default SSL protocol version
|
||||||
|
if sslproto:
|
||||||
|
verboseoutput("Using non-default SSL protocol: "+sslproto)
|
||||||
|
allowed_protos = ["SSLv2", "SSLv3", "TLSv1", "TLSv1.1", "TLSv1.2", "TLSv1.3"]
|
||||||
|
if any(proto.lower() == sslproto.lower() for proto in allowed_protos):
|
||||||
|
import os
|
||||||
|
sslconfpath = '/tmp/'+hostname+'_openssl.conf'
|
||||||
|
verboseoutput("Creating OpenSSL config file: "+sslconfpath)
|
||||||
|
try:
|
||||||
|
with open(sslconfpath, 'w') as config_file:
|
||||||
|
config_file.write("openssl_conf = openssl_init\n[openssl_init]\nssl_conf = ssl_configuration\n[ssl_configuration]\nsystem_default = tls_system_default\n[tls_system_default]\nMinProtocol = "+sslproto+"\n")
|
||||||
|
except Exception as e:
|
||||||
|
print('CRITICAL: An error occured while trying to write ssl config file: %s (%s)' % (sslconfpath, e))
|
||||||
|
sys.exit(ExitCritical)
|
||||||
|
os.environ["OPENSSL_CONF"] = sslconfpath
|
||||||
|
else:
|
||||||
|
print('CRITICAL: Invalid SSL protocol version given!')
|
||||||
|
sys.exit(ExitCritical)
|
||||||
|
|
||||||
# Append lcd related elements to ignore list if --no-lcd was used
|
# Append lcd related elements to ignore list if --no-lcd was used
|
||||||
verboseoutput("LCD Status: %s" % get_lcd)
|
verboseoutput("LCD Status: %s" % get_lcd)
|
||||||
if not get_lcd:
|
if not get_lcd:
|
||||||
@@ -717,6 +780,10 @@ if vendor=='auto':
|
|||||||
sys.exit (ExitUnknown)
|
sys.exit (ExitUnknown)
|
||||||
else:
|
else:
|
||||||
verboseoutput("Unknown CIM Error: %s" % args)
|
verboseoutput("Unknown CIM Error: %s" % args)
|
||||||
|
except pywbem._exceptions.ConnectionError as args:
|
||||||
|
GlobalStatus = ExitUnknown
|
||||||
|
print("UNKNOWN: {}".format(args))
|
||||||
|
sys.exit (GlobalStatus)
|
||||||
except pywbem.cim_http.AuthError as arg:
|
except pywbem.cim_http.AuthError as arg:
|
||||||
verboseoutput("Global exit set to UNKNOWN")
|
verboseoutput("Global exit set to UNKNOWN")
|
||||||
GlobalStatus = ExitUnknown
|
GlobalStatus = ExitUnknown
|
||||||
@@ -739,7 +806,7 @@ for classe in ClassesToCheck :
|
|||||||
verboseoutput("Check classe "+classe)
|
verboseoutput("Check classe "+classe)
|
||||||
try:
|
try:
|
||||||
instance_list = wbemclient.EnumerateInstances(classe)
|
instance_list = wbemclient.EnumerateInstances(classe)
|
||||||
except pywbem.cim_operations.CIMError as args:
|
except pywbem._cim_operations.CIMError as args:
|
||||||
if ( args[1].find('Socket error') >= 0 ):
|
if ( args[1].find('Socket error') >= 0 ):
|
||||||
print("UNKNOWN: {}".format(args))
|
print("UNKNOWN: {}".format(args))
|
||||||
sys.exit (ExitUnknown)
|
sys.exit (ExitUnknown)
|
||||||
@@ -748,7 +815,11 @@ for classe in ClassesToCheck :
|
|||||||
sys.exit (ExitUnknown)
|
sys.exit (ExitUnknown)
|
||||||
else:
|
else:
|
||||||
verboseoutput("Unknown CIM Error: %s" % args)
|
verboseoutput("Unknown CIM Error: %s" % args)
|
||||||
except pywbem.cim_http.AuthError as arg:
|
except pywbem._exceptions.ConnectionError as args:
|
||||||
|
GlobalStatus = ExitUnknown
|
||||||
|
print("UNKNOWN: {}".format(args))
|
||||||
|
sys.exit (GlobalStatus)
|
||||||
|
except pywbem._cim_http.AuthError as arg:
|
||||||
verboseoutput("Global exit set to UNKNOWN")
|
verboseoutput("Global exit set to UNKNOWN")
|
||||||
GlobalStatus = ExitUnknown
|
GlobalStatus = ExitUnknown
|
||||||
print("UNKNOWN: Authentication Error")
|
print("UNKNOWN: Authentication Error")
|
||||||
@@ -780,6 +851,8 @@ for classe in ClassesToCheck :
|
|||||||
+ str(instance[u'ReleaseDate'].datetime.date())
|
+ str(instance[u'ReleaseDate'].datetime.date())
|
||||||
verboseoutput(" VersionString = "+instance[u'VersionString'])
|
verboseoutput(" VersionString = "+instance[u'VersionString'])
|
||||||
|
|
||||||
|
xdata['Bios Info'] = bios_info
|
||||||
|
|
||||||
elif elementName == 'Chassis' :
|
elif elementName == 'Chassis' :
|
||||||
man = instance[u'Manufacturer']
|
man = instance[u'Manufacturer']
|
||||||
if man is None :
|
if man is None :
|
||||||
@@ -794,7 +867,7 @@ for classe in ClassesToCheck :
|
|||||||
model = instance[u'Model']
|
model = instance[u'Model']
|
||||||
if model:
|
if model:
|
||||||
verboseoutput(" Model = "+model)
|
verboseoutput(" Model = "+model)
|
||||||
server_info += model + ' s/n:'
|
server_info += model
|
||||||
|
|
||||||
elif elementName == 'Server Blade' :
|
elif elementName == 'Server Blade' :
|
||||||
SerialNumber = instance[u'SerialNumber']
|
SerialNumber = instance[u'SerialNumber']
|
||||||
@@ -802,6 +875,8 @@ for classe in ClassesToCheck :
|
|||||||
verboseoutput(" SerialNumber = "+SerialNumber)
|
verboseoutput(" SerialNumber = "+SerialNumber)
|
||||||
isblade = "yes"
|
isblade = "yes"
|
||||||
|
|
||||||
|
xdata['SerialNumber'] = SerialNumber
|
||||||
|
|
||||||
# Report detail of Numeric Sensors and generate nagios perfdata
|
# Report detail of Numeric Sensors and generate nagios perfdata
|
||||||
|
|
||||||
if classe == "CIM_NumericSensor" :
|
if classe == "CIM_NumericSensor" :
|
||||||
@@ -843,27 +918,33 @@ for classe in ClassesToCheck :
|
|||||||
if units == 7: # Watts
|
if units == 7: # Watts
|
||||||
if get_power:
|
if get_power:
|
||||||
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),1) )
|
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),1) )
|
||||||
|
xdata[perf_el] = { 'Unit': 'Watt', 'Value': cr, 'warn' : utnc, 'crit': utc }
|
||||||
elif units == 6: # Current
|
elif units == 6: # Current
|
||||||
if get_current:
|
if get_current:
|
||||||
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),3) )
|
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),3) )
|
||||||
|
xdata[perf_el] = { 'Unit': 'Ampere', 'Value': cr, 'warn' : utnc, 'crit': utc }
|
||||||
|
|
||||||
# PSU Voltage
|
# PSU Voltage
|
||||||
elif sensorType == 3: # Voltage
|
elif sensorType == 3: # Voltage
|
||||||
if get_volts:
|
if get_volts:
|
||||||
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),2) )
|
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),2) )
|
||||||
|
xdata[perf_el] = { 'Unit': 'Volt', 'Value': cr, 'warn' : utnc, 'crit': utc }
|
||||||
|
|
||||||
# Temperatures
|
# Temperatures
|
||||||
elif sensorType == 2: # Temperature
|
elif sensorType == 2: # Temperature
|
||||||
if get_temp:
|
if get_temp:
|
||||||
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),4) )
|
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),4) )
|
||||||
|
xdata[perf_el] = { 'Value': cr, 'warn' : utnc, 'crit': utc }
|
||||||
|
|
||||||
# Fan speeds
|
# Fan speeds
|
||||||
elif sensorType == 5: # Tachometer
|
elif sensorType == 5: # Tachometer
|
||||||
if get_fan:
|
if get_fan:
|
||||||
if units == 65: # percentage
|
if units == 65: # percentage
|
||||||
data.append( ("%s=%g%%;%g;%g " % (perf_el, cr, utnc, utc),6) )
|
data.append( ("%s=%g%%;%g;%g " % (perf_el, cr, utnc, utc),6) )
|
||||||
|
xdata[perf_el] = { 'Unit': '%', 'Value': cr, 'warn' : utnc, 'crit': utc }
|
||||||
else:
|
else:
|
||||||
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),5) )
|
data.append( ("%s=%g;%g;%g " % (perf_el, cr, utnc, utc),5) )
|
||||||
|
xdata[perf_el] = { 'Value': cr, 'warn' : utnc, 'crit': utc }
|
||||||
|
|
||||||
elif classe == "CIM_Processor" :
|
elif classe == "CIM_Processor" :
|
||||||
verboseoutput(" Family = %d" % instance['Family'])
|
verboseoutput(" Family = %d" % instance['Family'])
|
||||||
@@ -959,6 +1040,7 @@ if (urlise_country != '') :
|
|||||||
# If this is a blade server, also output chassis serial number as additional info
|
# If this is a blade server, also output chassis serial number as additional info
|
||||||
if (isblade == "yes") :
|
if (isblade == "yes") :
|
||||||
SerialNumber += " Chassis S/N: %s " % (SerialChassis)
|
SerialNumber += " Chassis S/N: %s " % (SerialChassis)
|
||||||
|
xdata['ChassisSerialNumber'] = SerialChassis
|
||||||
|
|
||||||
# Output performance data
|
# Output performance data
|
||||||
perf = '|'
|
perf = '|'
|
||||||
@@ -980,13 +1062,28 @@ if perfdata:
|
|||||||
if perf == '|':
|
if perf == '|':
|
||||||
perf = ''
|
perf = ''
|
||||||
|
|
||||||
|
# Cleanup temporary openssl config
|
||||||
|
if sslproto:
|
||||||
|
os.remove(sslconfpath)
|
||||||
|
|
||||||
|
xdata['GlobalStatus'] = GlobalStatus
|
||||||
|
|
||||||
if GlobalStatus == ExitOK :
|
if GlobalStatus == ExitOK :
|
||||||
print("OK - Server: %s %s %s%s" % (server_info, SerialNumber, bios_info, perf))
|
if format == 'string':
|
||||||
|
print("OK - Server: %s s/n: %s %s%s" % (server_info, SerialNumber, bios_info, perf))
|
||||||
|
else:
|
||||||
|
xdataprint()
|
||||||
|
|
||||||
elif GlobalStatus == ExitUnknown :
|
elif GlobalStatus == ExitUnknown :
|
||||||
print("UNKNOWN: %s" % (ExitMsg)) #ARR
|
if format == 'string':
|
||||||
|
print("UNKNOWN: %s" % (ExitMsg)) #ARR
|
||||||
|
else:
|
||||||
|
xdataprint()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
print("%s - Server: %s %s %s%s" % (ExitMsg, server_info, SerialNumber, bios_info, perf))
|
if format == 'string':
|
||||||
|
print("%s - Server: %s %s %s%s" % (ExitMsg, server_info, 's/n: ' + SerialNumber, bios_info, perf))
|
||||||
|
else:
|
||||||
|
xdataprint()
|
||||||
|
|
||||||
sys.exit (GlobalStatus)
|
sys.exit (GlobalStatus)
|
||||||
|
|||||||
Reference in New Issue
Block a user