Module: check_mk
Branch: master
Commit: 8d293483a9b0b640f455c3927e8664f466cf6350
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8d293483a9b0b6…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Thu Oct 16 09:01:35 2014 +0200
#0661 hw/sw-inventory: install date of software packages no longer in unix timestamps but
date format
Please redo an inventory
---
.werks/661 | 9 +++++++++
ChangeLog | 2 ++
inventory/win_exefiles | 8 +++++++-
inventory/win_reg_uninstall | 9 ++++++---
web/plugins/views/inventory.py | 11 +++++++++--
5 files changed, 33 insertions(+), 6 deletions(-)
diff --git a/.werks/661 b/.werks/661
new file mode 100644
index 0000000..1cec5c2
--- /dev/null
+++ b/.werks/661
@@ -0,0 +1,9 @@
+Title: hw/sw-inventory: install date of software packages no longer in unix timestamps
but date format
+Level: 1
+Component: inv
+Compatible: incomp
+Version: 1.2.5i6
+Date: 1413442748
+Class: feature
+
+Please redo an inventory
diff --git a/ChangeLog b/ChangeLog
index 284746f..753e9c7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -173,6 +173,8 @@
NOTE: Please refer to the migration notes!
* 0653 script to extract hw/sw inventory data in csv format...
* 0660 mk_inventory-ps1: new uses the Install Location as path for win_reg_uninstall
+ * 0661 hw/sw-inventory: install date of software packages no longer in unix
timestamps but date format...
+ NOTE: Please refer to the migration notes!
* 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"...
diff --git a/inventory/win_exefiles b/inventory/win_exefiles
index c9935a0..5a67862 100644
--- a/inventory/win_exefiles
+++ b/inventory/win_exefiles
@@ -35,11 +35,17 @@ def inv_win_exefiles(info):
paclist = inv_tree("software.packages:")
for full_name, write_time, size, description, product_version, product_name in info:
parts = full_name.split('\\')
+ # 14.02.2014 23:12:04
+ if re.match("^\d{2}\.\d{2}\.20\d{2} \d{2}:\d{2}:\d{2}", write_time):
+ install_date = int(time.mktime(time.strptime(write_time, "%d.%m.%Y
%H:%M:%S")))
+ else:
+ install_date = write_time
+
entry = {
"name" : parts[-1],
"path" : "\\".join(parts[:-1]),
"package_type" : "exe",
- "install_date" : write_time,
+ "install_date" : install_date,
"size" : int(size),
"version" : product_version,
"summary" : description,
diff --git a/inventory/win_reg_uninstall b/inventory/win_reg_uninstall
index ecf87f4..ed21209 100644
--- a/inventory/win_reg_uninstall
+++ b/inventory/win_reg_uninstall
@@ -33,8 +33,11 @@ def inv_win_reg_uninstall(info):
for line in info:
display_name, publisher, path, pacname, version, estimated_size, date = line
install_date = ""
- if len(date) == 8 and re.match("^20", date):
+ if re.match("^20\d{6}", date):
install_date = int(time.mktime(time.strptime(date, "%Y%m%d")))
+ size = saveint(estimated_size)
+ if size == 0:
+ size = None
entry = {
"name" : pacname,
@@ -42,9 +45,9 @@ def inv_win_reg_uninstall(info):
"vendor" : publisher,
"summary" : display_name,
"install_date" : install_date,
- "size" : estimated_size,
+ "size" : size,
"path" : path,
- "package_type" : "reg_uninstall",
+ "package_type" : "registry",
}
paclist.append(entry)
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index 411e30c..bd6c5b6 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -375,6 +375,13 @@ def inv_paint_timestamp(stamp):
else:
return "", ""
+def inv_paint_date(stamp):
+ if stamp:
+ date_painted = time.strftime("%Y-%m-%d", time.localtime(stamp))
+ return "Date", "%s" % date_painted
+ else:
+ return "", ""
+
inventory_displayhints.update({
"." : { "title" :
_("Inventory") },
".hardware." : { "title" :
_("Hardware"), "icon" : "hardware", },
@@ -433,7 +440,7 @@ inventory_displayhints.update({
".software.os.version" : { "title" :
_("Version"), },
".software.os.vendor" : { "title" :
_("Vendor"), },
".software.os.type" : { "title" :
_("Type"), }, # e.g. "linux"
- ".software.os,install_date" : { "title" :
_("Install Date"), "paint" : "timestamp" },
+ ".software.os.install_date" : { "title" :
_("Install Date"), "paint" : "date" },
".software.os.kernel_version" : { "title" :
_("Kernel Version"), "short" : _("Kernel") },
".software.os.arch" : { "title" :
_("Kernel Architecture"), "short" : _("Architecture") },
".software.os.service_pack" : { "title" :
_("Service Pack"), "short" : _("Service Pack") },
@@ -448,7 +455,7 @@ inventory_displayhints.update({
".software.packages:*.version" : { "title" :
_("Version"), },
".software.packages:*.vendor" : { "title" :
_("Publisher"), },
".software.packages:*.package_version" : { "title" :
_("Package Version"), },
- ".software.packages:*.install_date" : { "title" :
_("Install Date"), },
+ ".software.packages:*.install_date" : { "title" :
_("Install Date"), "paint" : "date"},
".software.packages:*.size" : { "title" :
_("Size"), "paint" : "count" },
".software.packages:*.path" : { "title" :
_("Path"), },
})