1
0
mirror of https://github.com/Napsty/check_esxi_hardware.git synced 2024-11-22 02:13:46 +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 #@ Author : Marco Markgraf
#@ Reason : Added JSON-output (Zabbix needs it) #@ 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
@ -299,7 +303,7 @@ import pkg_resources
import json import json
from optparse import OptionParser,OptionGroup from optparse import OptionParser,OptionGroup
version = '20220708' version = '20221230'
NS = 'root/cimv2' NS = 'root/cimv2'
hosturl = '' hosturl = ''
@ -863,7 +867,6 @@ 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 server_info += model
elif elementName == 'Server Blade' : elif elementName == 'Server Blade' :
@ -1067,7 +1070,7 @@ xdata['GlobalStatus'] = GlobalStatus
if GlobalStatus == ExitOK : if GlobalStatus == ExitOK :
if format == 'string': 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: else:
xdataprint() xdataprint()