Module: check_mk
Branch: master
Commit: 2b8e2c8ba34a0fa4fcf06275494d0969d24b3017
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=2b8e2c8ba34a0f…
Author: Simon Betz <si(a)mathias-kettner.de>
Date: Fri May 5 13:51:12 2017 +0200
4595 lnx_distro, lnx_packages: Both inventory plugins now support Gentoo Linux
Change-Id: I5b7d8b45174731923403effebe1c92ecf3aeac65
---
.werks/4595 | 10 ++++++++++
agents/plugins/mk_inventory.linux | 8 +++++++-
inventory/lnx_distro | 12 ++++++++++++
inventory/lnx_packages | 8 ++++++++
4 files changed, 37 insertions(+), 1 deletion(-)
diff --git a/.werks/4595 b/.werks/4595
new file mode 100644
index 0000000..7ed9df1
--- /dev/null
+++ b/.werks/4595
@@ -0,0 +1,10 @@
+Title: lnx_distro, lnx_packages: Both inventory plugins now support Gentoo Linux
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.5.0i1
+Date: 1493984967
+Class: feature
+
+
diff --git a/agents/plugins/mk_inventory.linux b/agents/plugins/mk_inventory.linux
index 1dca0c8..8906739 100755
--- a/agents/plugins/mk_inventory.linux
+++ b/agents/plugins/mk_inventory.linux
@@ -50,9 +50,15 @@ then
rpm -qa --qf '%{NAME}\t%{VERSION}\t%{ARCH}\trpm\t%{SUMMARY}\t-\n'
fi
+ # List Gentoo packages
+ if type equery >/dev/null; then
+ echo "<<<lnx_packages:sep(124):persist($UNTIL)>>>"
+ equery -C list --format
'$category/$name|$fullversion|$mask2|ebuild|Repository $repo|installed' \* | head
-n -1
+ fi
+
# Information about distribution
echo "<<<lnx_distro:sep(124):persist($UNTIL)>>>"
- for f in
{/etc/{oracle-release,debian_version,lsb-release,redhat-release,SuSE-release},/usr/share/cma/version}
; do
+ for f in
{/etc/{oracle-release,debian_version,gentoo-release,lsb-release,redhat-release,SuSE-release},/usr/share/cma/version}
; do
if [ -e $f ] ; then
echo -n "$f|" ; tr \\n \| < $f | sed 's/|$//' ; echo
break
diff --git a/inventory/lnx_distro b/inventory/lnx_distro
index df5e7d6..a8575de 100644
--- a/inventory/lnx_distro
+++ b/inventory/lnx_distro
@@ -51,6 +51,8 @@ def inv_lnx_distro(info):
inv_lnx_parse_lsb_release(node, line[1:])
elif line[0] == '/etc/debian_version':
inv_lnx_parse_debian(node, line[1])
+ elif line[0] == '/etc/gentoo-release':
+ inv_lnx_parse_gentoo(node, line[1])
elif line[0] == '/etc/redhat-release':
if line[1].startswith("Oracle"):
inv_lnx_parse_oracle_vm_server_release(node, line[1])
@@ -168,6 +170,16 @@ def inv_lnx_parse_cma(node, line):
del node["code_name"]
+def inv_lnx_parse_gentoo(node, line):
+ node["type"] = "linux"
+ node["name"] = line
+ node["vendor"] = "Gentoo"
+ parts = line.split(" ")
+ node["version"] = parts.pop(-1)
+ if "code_name" in node:
+ del node["code_name"]
+
+
inv_info['lnx_distro'] = {
"inv_function" : inv_lnx_distro,
}
diff --git a/inventory/lnx_packages b/inventory/lnx_packages
index a01fd40..8699018 100644
--- a/inventory/lnx_packages
+++ b/inventory/lnx_packages
@@ -30,6 +30,14 @@
# zlib1g:i386|1:1.2.7.dfsg-13|i386|deb|compression library - runtime|install ok
installed
# zlib1g-dev:amd64|1:1.2.7.dfsg-13|amd64|deb|compression library - development|install ok
installed
+# Example for Gentoo
+# sys-libs/ncurses|6.0-r1|amd64|ebuild|Repository gentoo|installed
+# sys-libs/pam|1.2.1|amd64|ebuild|Repository gentoo|installed
+# sys-libs/readline|6.3_p8-r3|amd64|ebuild|Repository gentoo|installed
+# sys-libs/slang|2.3.0|amd64|ebuild|Repository gentoo|installed
+# sys-libs/timezone-data|2016h|amd64|ebuild|Repository gentoo|installed
+# sys-libs/zlib|1.2.11|amd64|ebuild|Repository gentoo|installed
+
# Example for RPM
# gpg-pubkey|307e3d54|(none)|rpm|gpg(SuSE Package Signing Key <build(a)suse.de>)|
# gpg-pubkey|1d061a62|(none)|rpm|gpg(build(a)novell.com (Novell Linux Products)
<support(a)novell.com>)|