Module: check_mk
Branch: master
Commit: a061673df67d85d1031daf312cecc93b459aaa4f
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=a061673df67d85…
Author: Goetz Golla <gg(a)mathias-kettner.de>
Date: Fri Jul 4 12:42:24 2014 +0200
inventory now read the kernel version and architecture for linux and windows
---
.werks/625 | 8 ++++++++
ChangeLog | 1 +
agents/plugins/mk_inventory.linux | 14 +++++++++++---
inventory/lnx_uname | 9 ++++-----
inventory/win_os | 2 +-
web/plugins/views/inventory.py | 2 +-
6 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/.werks/625 b/.werks/625
new file mode 100644
index 0000000..3e70ba1
--- /dev/null
+++ b/.werks/625
@@ -0,0 +1,8 @@
+Title: inventory now read the kernel version and architecture for linux and windows
+Level: 1
+Component: inv
+Version: 1.2.5i5
+Date: 1404470499
+Class: feature
+
+
diff --git a/ChangeLog b/ChangeLog
index 0d6e465..d447ed0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -52,6 +52,7 @@
* 0988 FIX: livedump: Fix exception in case no contact groups are defined for a
service
HW/SW-Inventory:
+ * 0625 inventory now read the kernel version and architecture for linux and windows
* 0167 FIX: mk_inventory.linux: Changed field separator from pipe to tab...
* 1005 FIX: Fix exception when using pretty-print output format
* 0946 FIX: hw/sw inventory: fixed display bug for byte fields with the value 0...
diff --git a/agents/plugins/mk_inventory.linux b/agents/plugins/mk_inventory.linux
index 2f2ece1..75a1e8d 100755
--- a/agents/plugins/mk_inventory.linux
+++ b/agents/plugins/mk_inventory.linux
@@ -31,17 +31,25 @@ then
echo -n "$f|" ; tr \\n \| < $f | sed 's/|$//' ; echo
fi
done
-
+
# CPU Information. We need just the first one
if [ -e /proc/cpuinfo ] ; then
echo "<<<lnx_cpuinfo:sep(58):persist($UNTIL)>>>"
- sed 's/[[:space:]]*:[[:space:]]*/:/' < /proc/cpuinfo | grep -v
'^flags'
+ sed 's/[[:space:]]*:[[:space:]]*/:/' < /proc/cpuinfo
fi
-
+
# Information about main board, memory, etc.
if type dmidecode >/dev/null ; then
echo "<<<dmidecode:sep(58):persist($UNTIL)>>>"
dmidecode -q | sed 's/\t/:/g'
fi
+
+ # Information about kernel architecture
+ if type uname >/dev/null ; then
+ echo "<<<lnx_uname:persist($UNTIL)>>>"
+ uname -m
+ uname -r
+ fi
+
fi
diff --git a/inventory/lnx_uname b/inventory/lnx_uname
index 314156a..73b8492 100644
--- a/inventory/lnx_uname
+++ b/inventory/lnx_uname
@@ -30,11 +30,10 @@
def inv_lnx_uname(info):
node = inv_tree("software.os.")
- line = info[0]
- if len(line) >= 6:
- node["kernel"] = line[1:6]
- if len(line) >= 13:
- node["arch"] = line[-2]
+ if len(info) >= 1:
+ node["arch"] = info[0][0]
+ if len(info) >= 2:
+ node["kernel_version"] = info[1][0]
inv_info['lnx_uname'] = {
"inv_function" : inv_lnx_uname,
diff --git a/inventory/win_os b/inventory/win_os
index 98f7eb6..37c4439 100644
--- a/inventory/win_os
+++ b/inventory/win_os
@@ -33,7 +33,7 @@ def inv_win_os(info):
line = info[0]
if len(line) == 6:
node["name"] = line[1]
- node["kernel"] = line[2]
+ node["kernel_version"] = line[2]
if line[3] == "64-Bit":
node["arch"] = "x86_64"
else:
diff --git a/web/plugins/views/inventory.py b/web/plugins/views/inventory.py
index 9d51510..95027fa 100644
--- a/web/plugins/views/inventory.py
+++ b/web/plugins/views/inventory.py
@@ -577,7 +577,7 @@ inventory_displayhints.update({
".software." : { "title" :
_("Software"), "icon" : "software" },
".software.os." : { "title" :
_("Operating System") },
".software.os.name" : { "title" :
_("Name"), "short" : _("Operating System") },
- ".software.os.kernel" : { "title" :
_("Kernel Version"), "short" : _("Kernel") },
+ ".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") },
".software.packages:" : { "title" :
_("Packages"), "icon" : "packages", "render":
render_inv_dicttable,