Module: check_mk
Branch: master
Commit: bdc8487112959044cd91efedf048c947c0126b63
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=bdc84871129590…
Author: Andreas Boesl <ab(a)mathias-kettner.de>
Date: Thu Oct 23 10:46:25 2014 +0200
#1423 FIX Host HW-inventory: now longer generates an exception on displaying the BIOS
date
---
.werks/1423 | 9 +++++++++
ChangeLog | 1 +
inventory/dmidecode | 18 ++++++++++++++++--
3 files changed, 26 insertions(+), 2 deletions(-)
diff --git a/.werks/1423 b/.werks/1423
new file mode 100644
index 0000000..a704f07
--- /dev/null
+++ b/.werks/1423
@@ -0,0 +1,9 @@
+Title: Host HW-inventory: now longer generates an exception on displaying the BIOS date
+Level: 2
+Component: inv
+Compatible: compat
+Version: 1.2.5i6
+Date: 1414053851
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 4aec97b..d5b1e7c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -193,6 +193,7 @@
* 1413 HW/SW-Inventory implementation step one finished...
* 0655 FIX: win_cpuinfo and mk_inventory.ps1 agent: unit of CPU speed fixed, fixes
for long output lines in agent
* 1379 FIX: Fixed filter "Host has inventory data"...
+ * 1423 FIX: Host HW-inventory: now longer generates an exception on displaying the
BIOS date
check:
* 1384 oracle_jobs: new WATO rules, changed service name to SID.OWNER.NAME...
diff --git a/inventory/dmidecode b/inventory/dmidecode
index c654aeb..befa861 100644
--- a/inventory/dmidecode
+++ b/inventory/dmidecode
@@ -101,11 +101,18 @@ def inv_dmidecode_parse_section(name, lines):
# TODO: Summe über alle Arrays ausrechnen
+def inv_dmidecode_parse_date(value):
+ try:
+ # 10/17/2008
+ return time.mktime(time.strptime(value, "%m/%d/%Y"))
+ except Exception, e:
+ return
+
def inv_dmidecode_parse_bios(lines):
inv_dmidecode_parse_generic("hardware.bios.", lines, {
"Vendor" : "vendor",
"Version" : "version",
- "Release Date" : "date",
+ "Release Date" : ("date", inv_dmidecode_parse_date),
"BIOS Revision" : "revision",
"Firmware Revision" : "firmware",
})
@@ -227,8 +234,15 @@ def inv_dmidecode_parse_generic(node, lines, keyinfo):
node = inv_tree(node)
for line in lines:
if line[0] in keyinfo:
+ key = keyinfo[line[0]]
if line[1] != "Not Specified":
- node[keyinfo[line[0]]] = line[1]
+ value = line[1]
+ if type(key) == tuple:
+ key, transform = key
+ value = transform(value)
+ if value == None:
+ continue
+ node[key] = value
def dmidecode_parse_size(v): # into Bytes (int)