Module: check_mk
Branch: master
Commit: 23fcc184fc1454926d9589bd9795a62c8b5d50f6
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=23fcc184fc1454…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Wed May 25 10:22:36 2016 +0200
3577 FIX Solaris agent: Fixed performance issue introduced with #3389
---
.werks/3577 | 10 ++++++++++
ChangeLog | 1 +
agents/check_mk_agent.solaris | 11 ++++++++---
3 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/.werks/3577 b/.werks/3577
new file mode 100644
index 0000000..29ad630
--- /dev/null
+++ b/.werks/3577
@@ -0,0 +1,10 @@
+Title: Solaris agent: Fixed performance issue introduced with #3389
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+State: unknown
+Version: 1.2.9i1
+Date: 1464164530
+
+
diff --git a/ChangeLog b/ChangeLog
index 1ab73e7..fe153e1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -232,6 +232,7 @@
* 3605 FIX: kemp_loadmaster_ha, kemp_loadmaster_realserver, kemp_loadmaster_services:
fixed discovery if data is wrong or incomplete
* 3607 FIX: wut_webtherm: fixed missing sensor data if only decimal comma marked
values are available
* 3613 FIX: Fix vertical scaling of graph for disk utilization from 0...1% to
0...100%
+ * 3577 FIX: Solaris agent: Fixed performance issue introduced with #3389
Multisite:
* 3187 notification view: new filter for log command via regex
diff --git a/agents/check_mk_agent.solaris b/agents/check_mk_agent.solaris
index 17ce30e..420d0e7 100755
--- a/agents/check_mk_agent.solaris
+++ b/agents/check_mk_agent.solaris
@@ -211,11 +211,16 @@ if [ -x /usr/ucb/ps ]; then
STATS=${LINE%) *}
PID=${STATS##*,}
+ # Directly use ps output when line is too slow to be stripped
+ if [ ${#LINE} -lt 100 ]; then
+ echo "$LINE"
+ continue
+ fi
+
CMD=$(echo "$UCB_PS" | grep "^[ ]*$PID " | head -n1 | \
awk '{ s = ""; for (i = 5; i <= NF; i++) s = s $i "
"; print s }')
- # Only use the ucb ps line when it's not empty (process might already been
gone) and the
- # ps line is long enough the be potentially stripped.
- if [ -z "$CMD" ] || [ ${#LINE} -lt 100 ]; then
+ # Only use the ucb ps line when it's not empty (process might already been
gone)
+ if [ -z "$CMD" ]; then
echo "$LINE"
else
echo "${STATS}) ${CMD}"