Skip to content

Commit 7aaaae4

Browse files
authored
Fix bug when missing serial number from CIM elements (#69)
1 parent 8a99d8a commit 7aaaae4

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

check_esxi_hardware.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@
289289
#@ Author : Marco Markgraf
290290
#@ Reason : Added JSON-output (Zabbix needs it)
291291
#@---------------------------------------------------
292+
#@ Date : 20221230
293+
#@ Author : Claudio Kuenzler
294+
#@ Reason : Fix bug when missing S/N (issue #68)
295+
#@---------------------------------------------------
292296

293297
from __future__ import print_function
294298
import sys
@@ -299,7 +303,7 @@
299303
import json
300304
from optparse import OptionParser,OptionGroup
301305

302-
version = '20220708'
306+
version = '20221230'
303307

304308
NS = 'root/cimv2'
305309
hosturl = ''
@@ -863,7 +867,6 @@ def handler(signum, frame):
863867
model = instance[u'Model']
864868
if model:
865869
verboseoutput(" Model = "+model)
866-
#server_info += model + ' s/n:'
867870
server_info += model
868871

869872
elif elementName == 'Server Blade' :
@@ -1067,7 +1070,7 @@ def handler(signum, frame):
10671070

10681071
if GlobalStatus == ExitOK :
10691072
if format == 'string':
1070-
print("OK - Server: %s %s %s%s" % (server_info, 's/n: ' + SerialNumber, bios_info, perf))
1073+
print("OK - Server: %s s/n: %s %s%s" % (server_info, SerialNumber, bios_info, perf))
10711074
else:
10721075
xdataprint()
10731076

0 commit comments

Comments
 (0)