Module: check_mk
Branch: master
Commit: 57255cf24dc8bafb00bff36b833ea7122b6fbc14
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=57255cf24dc8ba…
Author: Christian Zigotzky <info(a)xenosoft.de>
Date: Tue May 29 12:36:53 2012 +0200
New Agent for MacOS
---
agents/check_mk_agent.macosx | 72 ++++++++++++++++++++++++++++++++++++++++++
1 files changed, 72 insertions(+), 0 deletions(-)
diff --git a/agents/check_mk_agent.macosx b/agents/check_mk_agent.macosx
new file mode 100755
index 0000000..7f143e9
--- /dev/null
+++ b/agents/check_mk_agent.macosx
@@ -0,0 +1,72 @@
+#!/bin/sh
+# +------------------------------------------------------------------+
+# | ____ _ _ __ __ _ __ |
+# | / ___| |__ ___ ___| | __ | \/ | |/ / |
+# | | | | '_ \ / _ \/ __| |/ / | |\/| | ' / |
+# | | |___| | | | __/ (__| < | | | | . \ |
+# | \____|_| |_|\___|\___|_|\_\___|_| |_|_|\_\ |
+# | |
+# | Copyright Mathias Kettner 2010 mk(a)mathias-kettner.de |
+# +------------------------------------------------------------------+
+#
+# This file is part of Check_MK.
+# The official homepage is at
http://mathias-kettner.de/check_mk.
+#
+# check_mk is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation in version 2. check_mk is distributed
+# in the hope that it will be useful, but WITHOUT ANY WARRANTY; with-
+# out even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE. See the GNU General Public License for more de-
+# ails. You should have received a copy of the GNU General Public
+# License along with GNU Make; see the file COPYING. If not, write
+# to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+# Boston, MA 02110-1301 USA.
+#
+# NOTE: This agent has beed adapted from the Check_MK linux agent.
+
+# Remove locale settings to eliminate localized outputs where possible
+# Author: Christian Zigotzky <info(a)xenosoft.de>
+export LC_ALL=C
+unset LANG
+
+export MK_LIBDIR="/to/be/changed"
+export MK_CONFDIR="/to/be/changed"
+
+echo '<<<check_mk>>>'
+echo Version: 1.2.0b5
+echo AgentOS: macosx
+
+osver="$(uname -r)"
+
+echo '<<<df>>>';
+df -kPt hfs | sed -e 's/^\([^ ][^ ]*\) \(.*\)$/\1 hfs \2/' | sed 1d
+
+echo '<<<cpu>>>';
+echo `sysctl -n vm.loadavg | tr -d '{}'` `top -l 1 -n 1 | egrep ^Processes: |
+awk '{print $4"/"$2;}'` `echo 'echo $$' | bash` `sysctl -n
hw.ncpu`
+
+echo '<<<uptime>>>';
+echo `date +%s` - `sysctl -n kern.boottime | cut -d' ' -f 4,7 | tr ','
'.' |
+tr -d ' '` | bc
+
+echo '<<<netctr>>>';
+date +'%s'; netstat -inb | egrep -v '(^Name|lo|plip)' | grep Link | awk
'{
+print
$1,$7,$5,$6,"0","0","0","0","0",$10,$8,$9,"0","0",$11,"0","0";
}'
+
+echo '<<<ps>>>'
+ps ax -o user,vsz,rss,pcpu,command | sed -e 1d -e 's/ *\([^ ]*\) *\([^ ]*\) *\([^
]*\) *\([^ ]*\) */(\1,\2,\3,\4) /'
+
+# MK's Remote Plugin Executor
+if [ -e "/etc/mrpe.cfg" ]
+then
+ echo '<<<mrpe>>>'
+ grep -Ev '^[[:space:]]*($|#)' "/etc/mrpe.cfg" | \
+ while read descr cmdline
+ do
+ PLUGIN=${cmdline%% *}
+ OUTPUT=$(eval "$cmdline")
+ echo "(${PLUGIN##*/}) $descr $? $OUTPUT" | tr \\n \\1
+ echo
+ done
+fi