Module: check_mk
Branch: master
Commit: adf4d1f869f3e8263a478f4418ee6cb24854c70f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=adf4d1f869f3e8…
Author: Moritz Kiemer <mo(a)mathias-kettner.de>
Date: Fri Jan 11 15:21:48 2019 +0100
prtconf: inventory: write firmware info to firmeware node
Change-Id: I7db227582f76fcdd0cbcf459c6581549bfed55f8
---
cmk/gui/plugins/views/inventory.py | 3 +++
inventory/prtconf | 32 +++++++++++++++++++++-----------
2 files changed, 24 insertions(+), 11 deletions(-)
diff --git a/cmk/gui/plugins/views/inventory.py b/cmk/gui/plugins/views/inventory.py
index 8d3f142..f487ab4 100644
--- a/cmk/gui/plugins/views/inventory.py
+++ b/cmk/gui/plugins/views/inventory.py
@@ -921,6 +921,9 @@ inventory_displayhints.update({
".hardware.nwadapter:*.ipv6_subnet": {"title": _("IPv6
Subnet")},
".hardware.nwadapter:*.gateway": {"title":
_("Gateway")},
".software.": {"title": _("Software"),
"icon": "software"},
+ ".software.firmware.vendor": {"title": _("Vendor")},
+ ".software.firmware.version": {"title": _("Version")},
+ ".software.firmware.platform_level": {"title": _("Platform
Firmware level")},
".software.os.": {"title": _("Operating System")},
".software.os.name": {"title": _("Name"),
"short": _("Operating System")},
".software.os.version": {"title": _("Version")},
diff --git a/inventory/prtconf b/inventory/prtconf
index 960e32d..8c4cc6d 100644
--- a/inventory/prtconf
+++ b/inventory/prtconf
@@ -57,19 +57,25 @@ def parse_prtconf(info):
if line[0].startswith("========="):
break # ignore the rest of the output currently
if len(line) == 2:
- varname = line[0]
- value = line[1].strip()
- parsed[varname] = value
+ k, v = line
+ parsed[k] = v.strip()
return parsed
+def _split_vendor(string):
+ if string.upper().startswith("IBM"):
+ return "IBM", string[3:].lstrip('., -/')
+ return "", string
+
+
def inv_prtconf(info, inventory_tree):
parsed = parse_prtconf(info)
cpu_dict = inventory_tree.get_dict("hardware.cpu.")
sys_dict = inventory_tree.get_dict("hardware.system.")
mem_dict = inventory_tree.get_dict("hardware.memory.")
+ fmw_dict = inventory_tree.get_dict("software.firmware.")
cpu_type = parsed.get("CPU Type")
if cpu_type is not None:
@@ -94,19 +100,23 @@ def inv_prtconf(info, inventory_tree):
fw_version = parsed.get("Firmware Version")
if fw_version is not None:
- bios_dict = inventory_tree.get_dict("hardware.bios.")
- bios_dict["version"] = fw_version
- if fw_version.startswith("IBM"):
- bios_dict["vendor"] = "IBM"
- sys_dict["manufacturer"] = "IBM"
+ vendor, fmw_dict["version"] = _split_vendor(fw_version)
+ if vendor:
+ fmw_dict["vendor"] = vendor
+
+ fw_platform_level = parsed.get("Platform Firmware level")
+ if fw_platform_level is not None:
+ fmw_dict["platform_level"] = fw_platform_level
serial = parsed.get("Machine Serial Number")
if serial is not None:
sys_dict["serial"] = serial
- product = parsed.get("System Model")
- if product is not None:
- sys_dict["product"] = product
+ model = parsed.get("System Model")
+ if model is not None:
+ manufacturer, sys_dict["product"] = _split_vendor(model)
+ if manufacturer:
+ sys_dict["manufacturer"] = manufacturer
ram = parsed.get("Memory Size")
if ram is not None: