[checkmk-commits] Check_MK Git: check_mk: #2246 FIX Linux CPU Inventory: Fixed wrong number of CPUs when first CPU is not in first slot

Lars Michelsen lm at mathias-kettner.de
Tue Apr 28 10:08:53 CEST 2015


Module: check_mk
Branch: master
Commit: 831f4a0712aedc5f5ac4c0296a71257a20c1d428
URL:    http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=831f4a0712aedc5f5ac4c0296a71257a20c1d428

Author: Lars Michelsen <lm at mathias-kettner.de>
Date:   Tue Apr 28 10:08:47 2015 +0200

#2246 FIX Linux CPU Inventory: Fixed wrong number of CPUs when first CPU is not in first slot

---

 .werks/2246            |   10 ++++++++++
 ChangeLog              |    1 +
 inventory/aix_packages |    2 ++
 inventory/lnx_cpuinfo  |    6 ++++--
 4 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/.werks/2246 b/.werks/2246
new file mode 100644
index 0000000..91491e5
--- /dev/null
+++ b/.werks/2246
@@ -0,0 +1,10 @@
+Title: Linux CPU Inventory: Fixed wrong number of CPUs when first CPU is not in first slot
+Level: 1
+Component: inv
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.7i1
+Date: 1430208490
+
+
diff --git a/ChangeLog b/ChangeLog
index cba4d20..a6a4584 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -534,6 +534,7 @@
     * 2108 FIX: win_bios win_disks win_system win_video: these inventory checks can now handle colons in the output
     * 2197 FIX: win_reg_uninstall: Fix exception in case of invalid output line...
     * 2224 FIX: Fixed sorting in inventory based views...
+    * 2246 FIX: Linux CPU Inventory: Fixed wrong number of CPUs when first CPU is not in first slot
 
 
 1.2.6b1:
diff --git a/inventory/aix_packages b/inventory/aix_packages
index 199c177..b606c6d 100644
--- a/inventory/aix_packages
+++ b/inventory/aix_packages
@@ -40,6 +40,8 @@ def inv_aix_packages(info):
         return # Empty section
 
     paclist = inv_tree("software.packages:")
+    if not info:
+        return
     headers = info[0]
     headers[0] = headers[0].lstrip("#")
     for line in info[1:]:
diff --git a/inventory/lnx_cpuinfo b/inventory/lnx_cpuinfo
index c7c3f03..47e7449 100644
--- a/inventory/lnx_cpuinfo
+++ b/inventory/lnx_cpuinfo
@@ -58,7 +58,7 @@
 def inv_lnx_cpuinfo(info):
     node = inv_tree("hardware.cpu.")
     num_threads_total = 0
-    num_sockets = 0
+    sockets = set([])
     for varname, value in info:
         if varname == "cpu cores":
             node["cores_per_cpu"] = int(value)
@@ -80,13 +80,15 @@ def inv_lnx_cpuinfo(info):
         elif varname == "processor":
             num_threads_total = int(value) + 1
         elif varname == "physical id":
-            num_sockets = int(value) + 1
+            sockets.add(int(value))
         elif varname == "flags":
             if re.search(" lm ", value):
                 node["arch"] = "x86_64"
             else:
                 node["arch"] = "i386"
 
+    num_sockets = len(sockets)
+
     if num_threads_total:
         node.setdefault("cores_per_cpu", 1)
         node.setdefault("threads_per_cpu", 1)



More information about the checkmk-commits mailing list