Module: check_mk
Branch: master
Commit: 8a5b30d1513f3e51b69336cab2584ed0d5dcfca2
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=8a5b30d1513f3e…
Author: Ronny Bruska <rb(a)mathias-kettner.de>
Date: Thu Mar 7 20:18:57 2019 +0100
7197 FIX Solaris Agent: fixed problem with leading spaces in wc command output
The output of "wc -l" on solaris can lead to leading spaces.
In that case the check "cpu.threads" can not parse the agent output and will
fail.
This has been fixed.
Change-Id: I164f2837f12abccaf442245f0220519865d7044d
---
.werks/7197 | 12 ++++++++++++
agents/check_mk_agent.solaris | 2 +-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/.werks/7197 b/.werks/7197
new file mode 100644
index 0000000..19e9281
--- /dev/null
+++ b/.werks/7197
@@ -0,0 +1,12 @@
+Title: Solaris Agent: fixed problem with leading spaces in wc command output
+Level: 1
+Component: checks
+Compatible: compat
+Edition: cre
+Version: 1.6.0i1
+Date: 1551986037
+Class: fix
+
+The output of "wc -l" on solaris can lead to leading spaces.
+In that case the check "cpu.threads" can not parse the agent output and will
fail.
+This has been fixed.
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 1c5bc66..38dfa3d 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -286,7 +286,7 @@ fi
# Simulated Output of Linux /proc/cpu
echo '<<<cpu>>>'
load=$(uptime|sed -e 's;.*average: \([0-9]\{1,\}\.[0-9]\{1,\}\),
\([0-9]\{1,\}\.[0-9]\{1,\}\), \([0-9]\{1,\}\.[0-9]\{1,\}\).*;\1 \2 \3;')
-nthreads=$(ps -AL | wc -l)
+nthreads=$(($(ps -AL | wc -l)))
procs=$(($(psrinfo | wc -l)))
echo $load 1/$nthreads $$ $procs