Module: check_mk
Branch: master
Commit: 0141f263c75d889c0a1a255d526ecf678a2b9e3b
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=0141f263c75d88…
Author: Sven Rueß <sr(a)mathias-kettner.de>
Date: Fri Feb 27 17:06:18 2015 +0100
#1952 check_mk_agent.linux: integrated runas plugin in check_mk_agent.linux
Integrated runas plugin into check_mk_agent.linux. Installation of Monitoring
Agents can be customized with WATO Monitoring Agents.
---
.werks/1952 | 10 +++++++++
ChangeLog | 1 +
agents/check_mk_agent.linux | 50 +++++++++++++++++++++++++++++++++++++++++++
3 files changed, 61 insertions(+)
diff --git a/.werks/1952 b/.werks/1952
new file mode 100644
index 0000000..e99fe96
--- /dev/null
+++ b/.werks/1952
@@ -0,0 +1,10 @@
+Title: check_mk_agent.linux: integrated runas plugin in check_mk_agent.linux
+Level: 1
+Component: checks
+Compatible: compat
+Version: 1.2.7i1
+Date: 1425052736
+Class: feature
+
+Integrated runas plugin into check_mk_agent.linux. Installation of Monitoring
+Agents can be customized with WATO Monitoring Agents.
diff --git a/ChangeLog b/ChangeLog
index 78350d6..fb03494 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -99,6 +99,7 @@
* 1891 apc_symmetra: Now supports setting levels on remaining battery time...
* 1892 hp_procurve_mem: Now supports setting levels in WATO...
NOTE: Please refer to the migration notes!
+ * 1952 check_mk_agent.linux: integrated runas plugin in check_mk_agent.linux...
* 1457 FIX: logins: new check renamed from "users" check...
NOTE: Please refer to the migration notes!
* 1762 FIX: lnx_thermal: Now ignoring trip points with level 0...
diff --git a/agents/check_mk_agent.linux b/agents/check_mk_agent.linux
index a067ed7..524b3d4 100755
--- a/agents/check_mk_agent.linux
+++ b/agents/check_mk_agent.linux
@@ -597,6 +597,56 @@ then
done
fi
+# MK's runas Executor
+if [ -e "$MK_CONFDIR/runas.cfg" ]
+then
+ grep -Ev '^[[:space:]]*($|#)' "$MK_CONFDIR/runas.cfg" | \
+ while read type user include
+ do
+ if [ -d $include -o \( "$type" == "mrpe" -a -f $include \) ]
; then
+ PREFIX=""
+ if [ "$user" != "-" ] ; then
+ PREFIX="su $user -c "
+ fi
+
+ # mrpe includes
+ if [ "$type" == "mrpe" ] ; then
+ echo "<<<mrpe>>>"
+ grep -Ev '^[[:space:]]*($|#)' "$include" | \
+ while read descr cmdline
+ do
+ PLUGIN=${cmdline%% *}
+
+ if [ -n "$PREFIX" ] ; then
+ cmdline="$PREFIX\"$cmdline\""
+ fi
+
+ OUTPUT=$(eval "$cmdline")
+ echo -n "(${PLUGIN##*/}) $descr $? $OUTPUT" | tr \\n \\1
+ echo
+ done
+
+ # local and plugin includes
+ elif [ "$type" == "local" -o "$type" ==
"plugin" ] ; then
+ if [ "$type" == "local" ] ; then
+ echo "<<<local>>>"
+ fi
+
+ find $include -executable -type f | \
+ while read filename
+ do
+ if [ -n "$PREFIX" ] ; then
+ cmdline="$PREFIX\"$filename\""
+ else
+ cmdline=$filename
+ fi
+
+ $cmdline
+ done
+ fi
+ fi
+ done
+fi
# Local checks
echo '<<<local>>>'