1
0
mirror of https://github.com/Napsty/check_esxi_hardware.git synced 2024-11-21 09:53:48 +01:00

Fix bug when missing serial number from CIM elements (#69)

This commit is contained in:
Claudio Kuenzler 2022-12-30 08:57:39 +01:00 committed by GitHub
parent 8a99d8aace
commit 7aaaae4337
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -289,6 +289,10 @@
#@ 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
import sys
@ -299,7 +303,7 @@ import pkg_resources
import json
from optparse import OptionParser,OptionGroup
version = '20220708'
version = '20221230'
NS = 'root/cimv2'
hosturl = ''
@ -863,7 +867,6 @@ for classe in ClassesToCheck :
model = instance[u'Model']
if model:
verboseoutput(" Model = "+model)
#server_info += model + ' s/n:'
server_info += model
elif elementName == 'Server Blade' :
@ -1067,7 +1070,7 @@ xdata['GlobalStatus'] = GlobalStatus
if GlobalStatus == ExitOK :
if format == 'string':
print("OK - Server: %s %s %s%s" % (server_info, 's/n: ' + SerialNumber, bios_info, perf))
print("OK - Server: %s s/n: %s %s%s" % (server_info, SerialNumber, bios_info, perf))
else:
xdataprint()