Skip to content

Commit bf4ec05

Browse files
authored
Add option to ignore chassis intrusion (Supermicro) (#42)
1 parent 489da3d commit bf4ec05

1 file changed

Lines changed: 23 additions & 2 deletions

File tree

check_esxi_hardware.py

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@
3939
# Copyright (c) 2015 Stanislav German-Evtushenko
4040
# Copyright (c) 2015 Stefan Roos
4141
# Copyright (c) 2018 Peter Newman
42+
# Copyright (c) 2019 Luca Berra
4243
#
4344
# The VMware 4.1 CIM API is documented here:
4445
# http://www.vmware.com/support/developer/cim-sdk/4.1/smash/cim_smash_410_prog.pdf
@@ -267,6 +268,10 @@
267268
#@ Date : 20190701
268269
#@ Author : Phil Randal (phil.randal@gmail.com)
269270
#@ Reason : Fix lookup of warranty info for Dell (again)
271+
#@---------------------------------------------------
272+
#@ Date : 20191115
273+
#@ Author : Luca Berra
274+
#@ Reason : Add option to ignore chassis intrusion (Supermicro)
270275

271276
from __future__ import print_function
272277
import sys
@@ -276,7 +281,7 @@
276281
import pkg_resources
277282
from optparse import OptionParser,OptionGroup
278283

279-
version = '20190701'
284+
version = '20191115'
280285

281286
NS = 'root/cimv2'
282287
hosturl = ''
@@ -376,6 +381,7 @@
376381
get_temp = True
377382
get_fan = True
378383
get_lcd = True
384+
get_intrusion = True
379385

380386
# define exit codes
381387
ExitOK = 0
@@ -500,7 +506,7 @@ def verboseoutput(message) :
500506
# ----------------------------------------------------------------------
501507

502508
def getopts() :
503-
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
509+
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
504510
usage = "usage: %prog -H hostname -U username -P password [-C port -V vendor -v -p -I XX -i list,list -r]\n" \
505511
"example: %prog -H hostname -U root -P password -C 5989 -V auto -I uk\n\n" \
506512
"or, verbosely:\n\n" \
@@ -542,6 +548,8 @@ def getopts() :
542548
help="don't collect fan performance data")
543549
group2.add_option("--no-lcd", action="store_false", dest="get_lcd", default=True, \
544550
help="don't collect lcd/front display status")
551+
group2.add_option("--no-intrusion", action="store_false", dest="get_intrusion", default=True, \
552+
help="don't collect chassis intrusion status")
545553

546554
parser.add_option_group(group1)
547555
parser.add_option_group(group2)
@@ -601,6 +609,7 @@ def getopts() :
601609
get_temp=options.get_temp
602610
get_fan=options.get_fan
603611
get_lcd=options.get_lcd
612+
get_intrusion=options.get_intrusion
604613

605614
# if user or password starts with 'file:', use the first string in file as user, second as password
606615
if (re.match('^file:', user) or re.match('^file:', password)):
@@ -644,6 +653,18 @@ def handler(signum, frame):
644653
ignore_list.append("Front Panel Board 1 FP LCD Cable 0: Connected")
645654
ignore_list.append("Front Panel Board 1 FP LCD Cable 0: Config Error")
646655

656+
# Append chassis intrusion related elements to ignore list if --no-intrusion was used
657+
verboseoutput("Chassis Intrusion Status: %s" % get_intrusion)
658+
if not get_intrusion:
659+
ignore_list.append("System Chassis 1 Chassis Intru: General Chassis intrusion")
660+
ignore_list.append("System Chassis 1 Chassis Intru: Drive Bay intrusion")
661+
ignore_list.append("System Chassis 1 Chassis Intru: I/O Card area intrusion")
662+
ignore_list.append("System Chassis 1 Chassis Intru: Processor area intrusion")
663+
ignore_list.append("System Chassis 1 Chassis Intru: System unplugged from LAN")
664+
ignore_list.append("System Chassis 1 Chassis Intru: Unauthorized dock")
665+
ignore_list.append("System Chassis 1 Chassis Intru: FAN area intrusion")
666+
ignore_list.append("System Chassis 1 Chassis Intru: Unknown")
667+
647668
# connection to host
648669
verboseoutput("Connection to "+hosturl)
649670
# pywbem 0.7.0 handling is special, some patched 0.7.0 installations work differently

0 commit comments

Comments
 (0)