Module: check_mk
Branch: master
Commit: f2c32c4ba6f6f91386fd39636523909827ae17a6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f2c32c4ba6f6f9…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Mon Sep 1 16:45:14 2014 +0200
#0655 FIX win_cpuinfo and mk_inventory.ps1 agent: unit of CPU speed fixed, fixes for long
output lines in agent
---
.werks/655 | 9 +++++++++
ChangeLog | 1 +
agents/windows/plugins/mk_inventory.ps1 | 23 ++++++++++++++++-------
inventory/win_cpuinfo | 2 +-
4 files changed, 27 insertions(+), 8 deletions(-)
diff --git a/.werks/655 b/.werks/655
new file mode 100644
index 0000000..c68934d
--- /dev/null
+++ b/.werks/655
@@ -0,0 +1,9 @@
+Title: win_cpuinfo and mk_inventory.ps1 agent: unit of CPU speed fixed, fixes for long
output lines in agent
+Level: 1
+Component: inv
+Compatible: compat
+Version: 1.2.5i6
+Date: 1409582610
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 529707a..234a3f4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -102,6 +102,7 @@
* 0652 windows software inventory gives some more details about OS and installed
software...
NOTE: Please refer to the migration notes!
* 0653 script to extract hw/sw inventory data in csv format...
+ * 0655 FIX: win_cpuinfo and mk_inventory.ps1 agent: unit of CPU speed fixed, fixes
for long output lines in agent
1.2.5i5:
diff --git a/agents/windows/plugins/mk_inventory.ps1
b/agents/windows/plugins/mk_inventory.ps1
index 8882b5a..97b8b3d 100644
--- a/agents/windows/plugins/mk_inventory.ps1
+++ b/agents/windows/plugins/mk_inventory.ps1
@@ -27,7 +27,9 @@ $until = [int]($epoch -replace ",.*", "") + $delay +
600
# Processor
write-host "<<<win_cpuinfo:sep(58):persist($until)>>>"
-Get-WmiObject Win32_Processor -ComputerName $name | Select
Name,Manufacturer,Caption,DeviceID,MaxClockSpeed,AddressWidth,L2CacheSize,L3CacheSize,Architecture,NumberOfCores,NumberOfLogicalProcessors,CurrentVoltage,Status
+$cpu = Get-WmiObject Win32_Processor -ComputerName $name
+$cpu_vars = @(
"Name","Manufacturer","Caption","DeviceID","MaxClockSpeed","AddressWidth","L2CacheSize","L3CacheSize","Architecture","NumberOfCores","NumberOfLogicalProcessors","CurrentVoltage","Status"
)
+foreach ( $entry in $cpu ) { foreach ( $item in $cpu_vars) { write-host $item
":" $entry.$item } }
# OS Version
write-host "<<<win_os:sep(124):persist($until)>>>"
@@ -38,20 +40,27 @@ Get-WmiObject Win32_OperatingSystem -ComputerName $name -Recurse |
foreach-objec
# BIOS
write-host "<<<win_bios:sep(58):persist($until)>>>"
-Get-WmiObject win32_bios -ComputerName $name | Select
Manufacturer,Name,SerialNumber,InstallDate,BIOSVersion,ListOfLanguages,PrimaryBIOS,ReleaseDate,SMBIOSBIOSVersion,SMBIOSMajorVersion,SMBIOSMinorVersion
+$bios = Get-WmiObject win32_bios -ComputerName $name
+$bios_vars= @(
"Manufacturer","Name","SerialNumber","InstallDate","BIOSVersion","ListOfLanguages","PrimaryBIOS","ReleaseDate","SMBIOSBIOSVersion","SMBIOSMajorVersion","SMBIOSMinorVersion"
)
+foreach ( $entry in $bios ) { foreach ( $item in $bios_vars) { write-host $item
":" $entry.$item } }
# System
write-host "<<<win_system:sep(58):persist($until)>>>"
-Get-WmiObject Win32_SystemEnclosure -ComputerName $name | Select
Manufacturer,Name,Model,HotSwappable,InstallDate,PartNumber,SerialNumber
+$system = Get-WmiObject Win32_SystemEnclosure -ComputerName $name
+$system_vars = @(
"Manufacturer","Name","Model","HotSwappable","InstallDate","PartNumber","SerialNumber"
)
+foreach ( $entry in $system ) { foreach ( $item in $system_vars) { write-host $item
":" $entry.$item } }
# Hard-Disk
write-host "<<<win_disks:sep(58):persist($until)>>>"
-Get-WmiObject win32_diskDrive -ComputerName $name | select
Manufacturer,InterfaceType,Model,Name,SerialNumber,Size,MediaType,Signature
+$disk = Get-WmiObject win32_diskDrive -ComputerName $name
+$disk_vars = @(
"Manufacturer","InterfaceType","Model","Name","SerialNumber","Size","MediaType","Signature"
)
+foreach ( $entry in $disk ) { foreach ( $item in $disk_vars) { write-host $item
":" $entry.$item } }
# Graphics Adapter
write-host "<<<win_video:sep(58):persist($until)>>>"
-Get-WmiObject Win32_VideoController -ComputerName $name | Select Name, Description,
Caption, AdapterCompatibility, VideoModeDescription, VideoProcessor, DriverVersion,
DriverDate, MaxMemorySupported
-
+$adapters=Get-WmiObject Win32_VideoController -ComputerName $name
+$adapter_vars = @( "Name", "Description", "Caption",
"AdapterCompatibility", "VideoModeDescription",
"VideoProcessor", "DriverVersion", "DriverDate",
"MaxMemorySupported")
+foreach ( $entry in $adapters ) { foreach ( $item in $adapter_vars) { write-host $item
":" $entry.$item } }
# Installed Software
write-host "<<<win_wmi_software:sep(124):persist($until)>>>"
@@ -67,7 +76,7 @@ foreach ($path in $paths) {
# Search exes
write-host "<<<win_exefiles:sep(124):persist($until)>>>"
-$paths = @("d:\", "c:\Program Files", "c:\Program Files
(x86)", "c:\Progs")
+$paths = @("c:\Program Files (x86)")
foreach ($item in $paths)
{
if ((Test-Path $item -pathType container))
diff --git a/inventory/win_cpuinfo b/inventory/win_cpuinfo
index 94dac5b..96600ab 100644
--- a/inventory/win_cpuinfo
+++ b/inventory/win_cpuinfo
@@ -44,7 +44,7 @@ def win_cpuinfo_parse_speed(v): # into Hz (float)
return None
parts = v.split()
if len(parts) == 1:
- return float(parts[0])
+ return float(parts[0]) * 1000000.0 # seems to be in MHz as default
elif parts[1] == "GHz":
return float(parts[0]) * 1000000000.0
elif parts[1] == "MHz":