Module: check_mk
Branch: master
Commit: b50b3e03cd46be2e6b87f9aaf3e470a0f524d718
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=b50b3e03cd46be…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Jan 25 15:18:35 2016 +0100
#2955 FIX cpu.loads: Fixed monitoring on some AIX systems
---
.werks/2955 | 9 +++++++++
ChangeLog | 1 +
agents/check_mk_agent.aix | 2 +-
checks/cpu | 13 ++++++++++++-
4 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/.werks/2955 b/.werks/2955
new file mode 100644
index 0000000..4bf1223
--- /dev/null
+++ b/.werks/2955
@@ -0,0 +1,9 @@
+Title: cpu.loads: Fixed monitoring on some AIX systems
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i4
+Date: 1453731493
+Class: fix
+
+
diff --git a/ChangeLog b/ChangeLog
index 15af17f..4a0d03e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -213,6 +213,7 @@
* 2952 FIX: netextreme_psu_out: Fixed crash in case of phase can not be found
anymore
* 2953 FIX: netextreme_psu_in: Fixed discovery of Power Supply Input checks
* 2954 FIX: netextreme_temp: Fixed temperature checking
+ * 2955 FIX: cpu.loads: Fixed monitoring on some AIX systems
Multisite:
* 2684 Added icons for downloading agent data / walks of hosts...
diff --git a/agents/check_mk_agent.aix b/agents/check_mk_agent.aix
index 5247bf8..7a4f35f 100755
--- a/agents/check_mk_agent.aix
+++ b/agents/check_mk_agent.aix
@@ -176,7 +176,7 @@ mpstat -a | tail -n1
echo '<<<cpu>>>'
load=`uptime|sed -e 's;.*average: \([[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\),
\([[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\), \([[:digit:]]\{1,\}\.[[:digit:]]\{1,\}\);\1 \2
\3;'`
ps=`ps -eo thcount | awk '{SUM+=$1} END {print SUM}'`
-procs=`vmstat|grep lcpu|sed -e 's;.* lcpu=\([[:digit:]]\{1,4\}\) .*;\1;'`
+procs=`vmstat|grep lcpu|sed -e 's;.*lcpu=\([[:digit:]]\{1,4\}\).*;\1;'`
echo $load 1/$ps $$ $procs
diff --git a/checks/cpu b/checks/cpu
index 0d67753..617b003 100644
--- a/checks/cpu
+++ b/checks/cpu
@@ -47,7 +47,18 @@ def inventory_cpu_load(info):
def check_cpu_load(item, params, info):
if len(info[0]) >= 6:
- num_cpus = int(info[0][5])
+ # There have been broken AIX agents for a long time which produced data like
follows.
+ # Newer agents deal with this, but to be nice to old agents: deal with it.
+ # <<<cpu>>>
+ # 0.00 0.00 0.00 1/97 8913088 aixxyz configuration: @lcpu=8 @mem=24576MB
@ent=0.20
+ line = " ".join(info[0])
+ if "lcpu=" in line:
+ for part in info[0]:
+ if "lcpu=" in part:
+ num_cpus = int(part.split("=", 1)[1])
+ break
+ else:
+ num_cpus = int(info[0][5])
else:
num_cpus = 1