Inventory plugin is now graceful if not all information are available
Message-ID: <56042fc3.Iu7b/KXTZd0royge%bk(a)mathias-kettner.de>
User-Agent: Heirloom mailx 12.5 6/20/10
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Module: check_mk
Branch: master
Commit: ca72714273079c70b5b2967a5b38a3d3a4a766d3
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=ca72714273079c…
Author: Bastian Kuhn <bk(a)mathias-kettner.de>
Date: Thu Sep 24 19:15:39 2015 +0200
#1294 FIX esx_vsphere_hostsystem: Inventory plugin is now graceful if not all information
are available
---
.werks/1294 | 9 +++++++++
ChangeLog | 1 +
inventory/esx_vsphere_hostsystem | 26 +++++++++++++++++---------
3 files changed, 27 insertions(+), 9 deletions(-)
diff --git a/.werks/1294 b/.werks/1294
new file mode 100644
index 0000000..7275ab0
--- /dev/null
+++ b/.werks/1294
@@ -0,0 +1,9 @@
+Title: esx_vsphere_hostsystem: Inventory plugin is now graceful if not all information
are available
+Level: 1
+Component: inv
+Compatible: compat
+Version: 1.2.7i3
+Date: 1443114860
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 0c97f99..2b64bf9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -327,6 +327,7 @@
* 2553 FIX: solaris_prtdiag: Can now handle Supermicro servers using Solaris 10
* 2624 FIX: fixed vbscript based inventory script (windows) only sending updated data
every 39 years
* 1293 FIX: dmidecode: Sanitized CPU Vendor field for some Intel CPUs...
+ * 1294 FIX: esx_vsphere_hostsystem: Inventory plugin is now graceful if not all
information are available
1.2.7i2:
diff --git a/inventory/esx_vsphere_hostsystem b/inventory/esx_vsphere_hostsystem
index 9658164..b2add03 100644
--- a/inventory/esx_vsphere_hostsystem
+++ b/inventory/esx_vsphere_hostsystem
@@ -72,19 +72,23 @@ def inv_esx_vsphere_hostsystem(info):
# 'vendor': 'intel'}}}
node = inv_tree("hardware.cpu.")
- node["max_speed"] =
float(data["hardware.cpuInfo"]["hz"])
- node["cpus"] =
int(data["hardware.cpuInfo"]["numCpuPackages"])
- node["cores"] =
int(data["hardware.cpuInfo"]["numCpuCores"])
+ if "hardware.cpuInfo" in data:
+ node["max_speed"] =
float(data["hardware.cpuInfo"]["hz"])
+ node["cpus"] =
int(data["hardware.cpuInfo"]["numCpuPackages"])
+ node["cores"] =
int(data["hardware.cpuInfo"]["numCpuCores"])
+ node["threads"] =
int(data["hardware.cpuInfo"]["numCpuThreads"])
+
node["cores_per_cpu"] = node["cores"] / node["cpus"]
- node["threads"] =
int(data["hardware.cpuInfo"]["numCpuThreads"])
node["threads_per_cpu"] = node["threads"] /
node["cpus"]
if "hardware.cpuPkg" in data:
node["model"] =
data["hardware.cpuPkg"]["0"]["description"]
node["vendor"] =
data["hardware.cpuPkg"]["0"]["vendor"]
node["bus_speed"] =
float(data["hardware.cpuPkg"]["0"]["busHz"])
- node = inv_tree("hardware.bios.")
- node["version"] =
data["hardware.biosInfo"]["biosVersion"]
+ if "hardware.biosInfo" in data:
+ node = inv_tree("hardware.bios.")
+ node["version"] =
data["hardware.biosInfo"]["biosVersion"]
+
import time
try:
node["date"] = float(time.strftime("%s", \
@@ -92,9 +96,13 @@ def inv_esx_vsphere_hostsystem(info):
except Exception, e:
pass
- node = inv_tree("hardware.system.")
- node["product"] = data["hardware.systemInfo"]["model"]
- node["vendor"] =
data["hardware.systemInfo"]["vendor"]
+ if "hardware.systemInfo" in data:
+ node = inv_tree("hardware.system.")
+ node["product"] =
data["hardware.systemInfo"]["model"]
+ node["vendor"] =
data["hardware.systemInfo"]["vendor"]
+ # We only know for HP that ServiceTag is the serial
+ if vendor == "HP":
+ node["serial"] =
data["hardware.systemInfo.otherIdentifyingInfo.ServiceTag"]["0"]
inv_info['esx_vsphere_hostsystem'] = {
"inv_function" : inv_esx_vsphere_hostsystem,