Module: check_mk
Branch: master
Commit: 7a26118ea46ebbd5ef2e176b0ff6237041601204
URL:
http://git.mathias-kettner.de/git/?p=check_mk.git;a=commit;h=7a26118ea46ebb…
Author: Lars Michelsen <lm(a)mathias-kettner.de>
Date: Mon Dec 10 08:26:00 2018 +0100
6927 FIX MAC OS X agent: Fixed missing root filesystem when using apfs
OS X systems since 10.13 High Sierra can format disks using APFS. The
OS X agent was only reporting hfs filesystems in the past. This lead
to e.g. a missing root filesystem on newer OS X installations.
FEED-3094
Change-Id: Ib7a5138251011df617f24b1e9737abd01b7ac090
---
.werks/6927 | 13 +++++++++++++
agents/check_mk_agent.macosx | 14 ++++++++++----
2 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/.werks/6927 b/.werks/6927
new file mode 100644
index 0000000..0bc9318
--- /dev/null
+++ b/.werks/6927
@@ -0,0 +1,13 @@
+Title: MAC OS X agent: Fixed missing root filesystem when using apfs
+Level: 1
+Component: checks
+Class: fix
+Compatible: compat
+Edition: cre
+State: unknown
+Version: 1.6.0i1
+Date: 1544426643
+
+OS X systems since 10.13 High Sierra can format disks using APFS. The
+OS X agent was only reporting hfs filesystems in the past. This lead
+to e.g. a missing root filesystem on newer OS X installations.
diff --git a/agents/check_mk_agent.macosx b/agents/check_mk_agent.macosx
index 20bcfcc..d997dce 100755
--- a/agents/check_mk_agent.macosx
+++ b/agents/check_mk_agent.macosx
@@ -58,8 +58,12 @@ echo "LocalDirectory: $LOCALDIR"
osver="$(uname -r)"
-echo '<<<df>>>';
-df -kPt hfs | sed -e 's/^\([^ ][^ ]*\) \(.*\)$/\1 hfs \2/' | sed 1d
+echo '<<<df>>>'
+df -kPT hfs,apfs | sed 1d | \
+while read DEV REST; do
+ TYPE=$(diskutil info "$DEV" | grep '^\s*Type' | cut -d: -f2 | tr -d
'[:space:]')
+ echo "$DEV $TYPE $REST"
+done
echo '<<<cpu>>>';
echo `sysctl -n vm.loadavg | tr -d '{}'` `top -l 1 -n 1 | egrep ^Processes: |
@@ -90,8 +94,10 @@ echo '<<<ps>>>'
ps ax -o user,vsz,rss,pcpu,command | sed -e 1d -e 's/ *\([^ ]*\) *\([^ ]*\) *\([^
]*\) *\([^ ]*\) */(\1,\2,\3,\4) /'
# NTP seems to be enabled as a default
-echo '<<<ntp>>>'
-ntpq -np | sed -e 1,2d -e 's/^\(.\)/\1 /' -e 's/^ /%/'
+if which ntpq >/dev/null; then
+ echo '<<<ntp>>>'
+ ntpq -np | sed -e 1,2d -e 's/^\(.\)/\1 /' -e 's/^ /%/'
+fi
# TCP Conn stats
echo '<<<tcp_conn_stats>>>'