Module: check_mk
Branch: master
Commit: 9b37a9f143f3cc792934d5ea37eb989a4ecc3377
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=9b37a9f143f3cc…
Author: Mathias Kettner <mk(a)mathias-kettner.de>
Date: Thu Jan 9 11:40:07 2014 +0100
FIX mem.used: Prefer statgrab on FreeBSD for supporting more than 4GB
The <tt>check_mk_agent.freebsd<tt> now first tries to find
<tt>statgrab</tt> and prefers
that if found.
---
.werks/403 | 11 +++++++++++
ChangeLog | 1 +
agents/check_mk_agent.freebsd | 18 ++++++++++--------
3 files changed, 22 insertions(+), 8 deletions(-)
diff --git a/.werks/403 b/.werks/403
new file mode 100644
index 0000000..7d2d567
--- /dev/null
+++ b/.werks/403
@@ -0,0 +1,11 @@
+Title: mem.used: Prefer statgrab on FreeBSD for supporting more than 4GB
+Level: 1
+Component: checks
+Class: fix
+State: unknown
+Version: 1.2.5i1
+Date: 1389263935
+Targetversion: future
+
+The <tt>check_mk_agent.freebsd<tt> now first tries to find
<tt>statgrab</tt> and prefers
+that if found.
diff --git a/ChangeLog b/ChangeLog
index bc1eb0e..210825a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -85,6 +85,7 @@
* 0443 FIX: brocade_fcport: cope with firmware that does not provide speed
information...
* 0322 FIX: timemachine: Check now also works if there are spaces in the name of the
backup volume or the hostname
* 0253 FIX: windows agent: fixed crash on processing eventlog records...
+ * 0403 FIX: mem.used: Prefer statgrab on FreeBSD for supporting more than 4GB...
Multisite:
* 0371 Added log class filter to hostsvcevents view
diff --git a/agents/check_mk_agent.freebsd b/agents/check_mk_agent.freebsd
index caa1823..b1627a0 100755
--- a/agents/check_mk_agent.freebsd
+++ b/agents/check_mk_agent.freebsd
@@ -129,14 +129,16 @@ echo '<<<ps>>>'
COLUMNS=10000
ps ax -o user,vsz,rss,pcpu,command | sed -e 1d -e 's/ *\([^ ]*\) *\([^ ]*\) *\([^
]*\) *\([^ ]*\) */(\1,\2,\3,\4) /'
-# Memory Usage
-# currently we'll need sysutils/muse for this.
-if [ -x /usr/local/bin/muse ]
- then
- echo '<<<mem>>>'
-# yes, i don't know sed well.
- muse -k 2>/dev/null | sed 's/Total/MemTotal/' | sed
's/Free/MemFree/'
- swapinfo -k 1K | tail -n 1 | awk '{ print "SwapTotal: "$2"
kB\nSwapFree: "$4" kB" }'
+# Memory Usage. First we try statgrab, since
+# muse does not seem to support >4GB
+if [ -x /usr/local/bin/statgrab ] ; then
+ echo '<<<mem>>>'
+ statgrab -K mem.total mem.free swap.total swap.free | \
+ awk
'{gsub(/swap\./,"Swap");}{gsub(/mem\./,"Mem");}{gsub(/tot/,"Tot");}{gsub(/free/,"Free");}
{ print $1": "$3" kB"}'
+elif [ -x /usr/local/bin/muse ] ; then
+ echo '<<<mem>>>'
+ muse -k 2>/dev/null | sed 's/Total/MemTotal/' | sed
's/Free/MemFree/'
+ swapinfo -k 1K | tail -n 1 | awk '{ print "SwapTotal: "$2"
kB\nSwapFree: "$4" kB" }'
fi