1
0
mirror of https://github.com/Napsty/check_esxi_hardware.git synced 2024-11-22 10:23:49 +01:00

Merge pull request #10 from Napsty/chassissn

Added Serial Number for Chassis
This commit is contained in:
Claudio Kuenzler 2015-01-09 11:54:31 +01:00
commit 16e85dcc0c

View File

@ -207,6 +207,10 @@
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com) #@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Another two workarounds for Dell systems (VGA Cable Pres 0, Add-in Card 4 PEM Presence 0) #@ Reason : Another two workarounds for Dell systems (VGA Cable Pres 0, Add-in Card 4 PEM Presence 0)
#@--------------------------------------------------- #@---------------------------------------------------
#@ Date : 20140916
#@ Author : Claudio Kuenzler (www.claudiokuenzler.com)
#@ Reason : Output serial number of chassis if a blade server is checked
#@---------------------------------------------------
import sys import sys
import time import time
@ -215,7 +219,7 @@ import re
import string import string
from optparse import OptionParser,OptionGroup from optparse import OptionParser,OptionGroup
version = '20140319' version = '20140916'
NS = 'root/cimv2' NS = 'root/cimv2'
@ -315,6 +319,9 @@ ExitWarning = 1
ExitCritical = 2 ExitCritical = 2
ExitUnknown = 3 ExitUnknown = 3
# Special handling for blade servers
isblade = "no"
def dell_country(country): def dell_country(country):
if country == 'at': # Austria if country == 'at': # Austria
return 'at/de/' return 'at/de/'
@ -642,6 +649,7 @@ for classe in ClassesToCheck :
man = 'Unknown Manufacturer' man = 'Unknown Manufacturer'
verboseoutput(" Manufacturer = "+man) verboseoutput(" Manufacturer = "+man)
SerialNumber = instance[u'SerialNumber'] SerialNumber = instance[u'SerialNumber']
SerialChassis = instance[u'SerialNumber']
if SerialNumber: if SerialNumber:
verboseoutput(" SerialNumber = "+SerialNumber) verboseoutput(" SerialNumber = "+SerialNumber)
server_info = man + ' ' server_info = man + ' '
@ -655,6 +663,7 @@ for classe in ClassesToCheck :
SerialNumber = instance[u'SerialNumber'] SerialNumber = instance[u'SerialNumber']
if SerialNumber: if SerialNumber:
verboseoutput(" SerialNumber = "+SerialNumber) verboseoutput(" SerialNumber = "+SerialNumber)
isblade = "yes"
# Report detail of Numeric Sensors and generate nagios perfdata # Report detail of Numeric Sensors and generate nagios perfdata
@ -813,6 +822,10 @@ if (urlise_country != '') :
SerialNumber = urlised_serialnumber(vendor,urlise_country,SerialNumber) SerialNumber = urlised_serialnumber(vendor,urlise_country,SerialNumber)
server_info = urlised_server_info(vendor,urlise_country,server_info) 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 # Output performance data
perf = '|' perf = '|'
if perfdata: if perfdata: