|
39 | 39 | # Copyright (c) 2015 Stanislav German-Evtushenko |
40 | 40 | # Copyright (c) 2015 Stefan Roos |
41 | 41 | # Copyright (c) 2018 Peter Newman |
| 42 | +# Copyright (c) 2019 Luca Berra |
42 | 43 | # |
43 | 44 | # The VMware 4.1 CIM API is documented here: |
44 | 45 | # http://www.vmware.com/support/developer/cim-sdk/4.1/smash/cim_smash_410_prog.pdf |
|
267 | 268 | #@ Date : 20190701 |
268 | 269 | #@ Author : Phil Randal (phil.randal@gmail.com) |
269 | 270 | #@ 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) |
270 | 275 |
|
271 | 276 | from __future__ import print_function |
272 | 277 | import sys |
|
276 | 281 | import pkg_resources |
277 | 282 | from optparse import OptionParser,OptionGroup |
278 | 283 |
|
279 | | -version = '20190701' |
| 284 | +version = '20191115' |
280 | 285 |
|
281 | 286 | NS = 'root/cimv2' |
282 | 287 | hosturl = '' |
|
376 | 381 | get_temp = True |
377 | 382 | get_fan = True |
378 | 383 | get_lcd = True |
| 384 | +get_intrusion = True |
379 | 385 |
|
380 | 386 | # define exit codes |
381 | 387 | ExitOK = 0 |
@@ -500,7 +506,7 @@ def verboseoutput(message) : |
500 | 506 | # ---------------------------------------------------------------------- |
501 | 507 |
|
502 | 508 | 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 |
504 | 510 | usage = "usage: %prog -H hostname -U username -P password [-C port -V vendor -v -p -I XX -i list,list -r]\n" \ |
505 | 511 | "example: %prog -H hostname -U root -P password -C 5989 -V auto -I uk\n\n" \ |
506 | 512 | "or, verbosely:\n\n" \ |
@@ -542,6 +548,8 @@ def getopts() : |
542 | 548 | help="don't collect fan performance data") |
543 | 549 | group2.add_option("--no-lcd", action="store_false", dest="get_lcd", default=True, \ |
544 | 550 | 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") |
545 | 553 |
|
546 | 554 | parser.add_option_group(group1) |
547 | 555 | parser.add_option_group(group2) |
@@ -601,6 +609,7 @@ def getopts() : |
601 | 609 | get_temp=options.get_temp |
602 | 610 | get_fan=options.get_fan |
603 | 611 | get_lcd=options.get_lcd |
| 612 | + get_intrusion=options.get_intrusion |
604 | 613 |
|
605 | 614 | # if user or password starts with 'file:', use the first string in file as user, second as password |
606 | 615 | if (re.match('^file:', user) or re.match('^file:', password)): |
@@ -644,6 +653,18 @@ def handler(signum, frame): |
644 | 653 | ignore_list.append("Front Panel Board 1 FP LCD Cable 0: Connected") |
645 | 654 | ignore_list.append("Front Panel Board 1 FP LCD Cable 0: Config Error") |
646 | 655 |
|
| 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 | + |
647 | 668 | # connection to host |
648 | 669 | verboseoutput("Connection to "+hosturl) |
649 | 670 | # pywbem 0.7.0 handling is special, some patched 0.7.0 installations work differently |
|
0 commit comments