Skip to content

Commit

Permalink
Fix bug when missing serial number from CIM elements (#69)
Browse files Browse the repository at this point in the history
  • Loading branch information
Napsty authored Dec 30, 2022
1 parent 8a99d8a commit 7aaaae4
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions check_esxi_hardware.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -299,7 +303,7 @@
import json
from optparse import OptionParser,OptionGroup

version = '20220708'
version = '20221230'

NS = 'root/cimv2'
hosturl = ''
Expand Down Expand Up @@ -863,7 +867,6 @@ def handler(signum, frame):
model = instance[u'Model']
if model:
verboseoutput(" Model = "+model)
#server_info += model + ' s/n:'
server_info += model

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

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()

Expand Down

0 comments on commit 7aaaae4

Please sign in to comment.