One of the biggest performance hits caused by the Solaris check_mk_agent script, is the invocation of ‘mdb’, and on pre-Solaris 11.3 systems, it is being invoked twice.
Here is a re-write of the zfs_arc_cache segment of the check_mk_agent script, choosing to use ‘kstat’ by default, and only falling back to ‘mdb’ if ‘kstat’ is not present.
echo ‘<<<zfs_arc_cache>>>’
if type kstat &>/dev/null
then
kstat -p zfs:0:arcstats |
sed -e ‘s/.*arcstats://g’ |
awk ‘{printf “%s = %s\n”, $1, $2;}’
elif type mdb &>/dev/null
then
echo ‘::arc’ | mdb -k
fi