Module: check_mk
Branch: master
Commit: cb6f008ebb8b1f19aae208d6aecfb863b199eee1
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=cb6f008ebb8b1f…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Thu May 8 16:18:58 2014 +0200
mk_inventory: windows inventory check now included, install date added to data
---
.werks/610 | 8 ++++++++
ChangeLog | 1 +
agents/windows/plugins/mk_inventory.ps1 | 29 +++++++++++++++++++++++++++++
inventory/win_wmi_software | 3 ++-
web/plugins/views/inventory.py | 3 ++-
5 files changed, 42 insertions(+), 2 deletions(-)
diff --git a/.werks/610 b/.werks/610
new file mode 100644
index 0000000..1f7757d
--- /dev/null
+++ b/.werks/610
@@ -0,0 +1,8 @@
+Title: mk_inventory: windows inventory check now included, install date added to data
+Level: 2
+Component: inv
+Version: 1.2.5i3
+Date: 1399558285
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index f6d99a3..f2e6bd3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -111,6 +111,7 @@
HW/SW-Inventory:
* 0913 lnx_distro: Now able to detect SuSE distributions...
+ * 0610 mk_inventory: windows inventory check now included, install date added to
data
* 0886 FIX: Fix exception on non-UTF-8 encoded characters in software list
diff --git a/agents/windows/plugins/mk_inventory.ps1
b/agents/windows/plugins/mk_inventory.ps1
new file mode 100644
index 0000000..b4ec784
--- /dev/null
+++ b/agents/windows/plugins/mk_inventory.ps1
@@ -0,0 +1,29 @@
+$name = (Get-Item env:\Computername).Value
+$separator = "|"
+
+# Processor
+write-host "<<<win_cpuinfo:sep(58)>>>"
+Get-WmiObject Win32_Processor -ComputerName $name | Select
Name,Manufacturer,Caption,DeviceID,MaxClockSpeed,DataWidth,L2CacheSize,L3CacheSize,NumberOfCores,NumberOfLogicalProcessors,Status
+
+# OS Version
+write-host "<<<win_os:sep(58)>>>"
+Get-WmiObject Win32_OperatingSystem -ComputerName $name -Recurse | foreach-object {
write-host -separator $separator $_.csname, $_.caption, $_.version,
$_.servicepackmajorversion, $_.ServicePackMinorVersion }
+
+# Installed Software
+write-host "<<<win_wmi_software:sep(124)>>>"
+Get-WmiObject Win32_Product -ComputerName $name | foreach-object { write-host -separator
$separator $_.Name, $_.Vendor, $_.Version, $_.InstallDate }
+
+## Search Registry
+write-host "<<<win_reg_uninstall:sep(124)>>>"
+Get-ChildItem "HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall"
-Recurse | foreach-object { write-host -separator $separator $_.PSChildName }
+
+## Search exes
+write-host "<<<win_exefiles:sep(124)>>>"
+$paths = @("d:\", "c:\Program Files", "c:\Program Files
(x86)", "c:\Progs")
+foreach ($item in $paths)
+{
+ if ((Test-Path $item -pathType container))
+ {
+ Get-ChildItem -Path $item -include *.exe -Recurse | foreach-object { write-host
-separator $separator $_.Fullname, $_.Length }
+ }
+}
diff --git a/inventory/win_wmi_software b/inventory/win_wmi_software
index 01eb091..68872ff 100644
--- a/inventory/win_wmi_software
+++ b/inventory/win_wmi_software
@@ -36,11 +36,12 @@
def inv_win_wmi_software(info):
paclist = inv_tree("software.packages:")
- for pacname, vendor, version in info:
+ for pacname, vendor, version, install_date in info:
entry = {
"name" : pacname,
"version" : version,
"vendor" : vendor,
+ "install_date" : install_date,
"package_type" : "wmi",
}
paclist.append(entry)
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index 48c65e9..7764ae8 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -579,6 +579,7 @@ inventory_displayhints.update({
".software.packages:*.summary" : { "title" :
_("Description"), },
".software.packages:*.version" : { "title" :
_("Version"), },
".software.packages:*.package_version" : { "title" :
_("Package Version"), },
+ ".software.packages:*.install_date" : { "title" :
_("Install Date"), },
".software.packages:*.size" : { "title" :
_("Size"), "paint" : "count" },
})
@@ -812,7 +813,7 @@ for name, title, sortfunc in [
( "arch", _("CPU Architecture"), cmp ),
( "package_type", _("Type"), cmp ),
( "version", _("Version"), cmp_version ),
- ( "package_version", _("Package Version"), cmp_version ),
+ ( "install_date", _("Install Date"), cmp ),
]:
declare_swpacs_columns(name, title, sortfunc)