Module: check_mk
Branch: master
Commit: f37145e2dc88f8faff05dfe646f99a5e9bdc0247
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=f37145e2dc88f8…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Tue Aug 11 09:23:54 2015 +0200
#2492 FIX check_mk_agent.linux: avoid problems with crashing waitmax after Ubuntu update
Some users have reported that after an update of their Ubuntu target hosts, the command
<tt>/usr/bin/waitmax</tt>, which is shipped with the Check_MK Agent, actually
segfaults
the program being run with it. This could be related to the fact that
<tt>waitmax</tt>
is statically linked in order to be independent of 32/64 bits and of the libc in use.
The agent now looks if <tt>/usr/bin/timeout</tt> exists and prefers that over
<tt>waitmax</tt>.
<tt>timeout</tt> has been introduced in the coreutils version 8+. It is
missing e.g.
on RedHat 5.X, so <tt>waitmax</tt> is still needed for a couple of years...
---
.werks/2492 | 16 ++++++++++++++++
ChangeLog | 1 +
agents/check_mk_agent.linux | 13 +++++++++++--
3 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/.werks/2492 b/.werks/2492
new file mode 100644
index 0000000..aed5b51
--- /dev/null
+++ b/.werks/2492
@@ -0,0 +1,16 @@
+Title: check_mk_agent.linux: avoid problems with crashing waitmax after Ubuntu update
+Level: 2
+Component: checks
+Compatible: compat
+Version: 1.2.7i3
+Date: 1439277549
+Class: fix
+
+Some users have reported that after an update of their Ubuntu target hosts, the command
+<tt>/usr/bin/waitmax</tt>, which is shipped with the Check_MK Agent, actually
segfaults
+the program being run with it. This could be related to the fact that
<tt>waitmax</tt>
+is statically linked in order to be independent of 32/64 bits and of the libc in use.
+
+The agent now looks if <tt>/usr/bin/timeout</tt> exists and prefers that over
<tt>waitmax</tt>.
+<tt>timeout</tt> has been introduced in the coreutils version 8+. It is
missing e.g.
+on RedHat 5.X, so <tt>waitmax</tt> is still needed for a couple of years...
diff --git a/ChangeLog b/ChangeLog
index 9beb2d7..7364270 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -110,6 +110,7 @@
* 2504 FIX: cups_queues: Fixed wrong queue discovery on hosts running apcupsd
* 2506 FIX: Diskstat summary: Ignoring stats from LVM devices
* 2455 FIX: raritan_pdu_inlet: Fixed scaling...
+ * 2492 FIX: check_mk_agent.linux: avoid problems with crashing waitmax after Ubuntu
update...
Multisite:
* 2385 SEC: Fixed possible reflected XSS on all GUI pages where users can produce
unhandled exceptions...
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index 8302fb4..3889213 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -64,6 +64,17 @@ else
exec </dev/null 2>/dev/null
fi
+# Prefer (relatively) new /usr/bin/timeout from coreutils against
+# our shipped waitmax. waitmax is statically linked and crashes on
+# some Ubuntu versions recently.
+if type timeout >/dev/null 2>&1 ; then
+ function waitmax () {
+ timeout "$@"
+ }
+ export -f waitmax
+fi
+
+
# Runs a command asynchronous by use of a cache file. Usage:
# run_cached [-s] NAME MAXAGE
# -s creates the section header <<<$NAME>>>
@@ -254,8 +265,6 @@ fi
# Number of TCP connections in the various states
echo '<<<tcp_conn_stats>>>'
-# waitmax 10 netstat -nt | awk ' /^tcp/ { c[$6]++; } END { for (x in c) { print x,
c[x]; } }'
-# New implementation: netstat is very slow for large TCP tables
cat /proc/net/tcp /proc/net/tcp6 2>/dev/null | awk ' /:/ { c[$4]++; } END { for (x
in c) { print x, c[x]; } }'
# Linux Multipathing