Created
December 9, 2012 13:33
-
-
Save ftnk/4244904 to your computer and use it in GitHub Desktop.
munin plugin for Solaris kernel memory usage
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# munin plugin for Solaris kernel memory usage | |
# | |
#%# family=auto | |
#%# capabilities=autoconf | |
GREP=/bin/grep | |
EGREP=/bin/egrep | |
AWK=/bin/awk | |
SED=/bin/sed | |
SUDO=/bin/sudo | |
MDB=/bin/mdb | |
if [ "$1" = "config" ]; then | |
echo "graph_title Solaris Kernel Memory Usage" | |
echo "graph_args --lower-limit 0" | |
echo 'graph_category system' | |
echo 'graph_vlabel %' | |
echo 'kernel.label Kernel' | |
echo 'kernel.draw AREA' | |
echo 'kernel.type GAUGE' | |
echo 'kernel.min 0' | |
echo 'kernel.max 100' | |
echo 'zfs.label ZFS File Data' | |
echo 'zfs.draw STACK' | |
echo 'zfs.type GAUGE' | |
echo 'zfs.min 0' | |
echo 'zfs.max 100' | |
echo 'anon.label Anon' | |
echo 'anon.draw STACK' | |
echo 'anon.type GAUGE' | |
echo 'anon.min 0' | |
echo 'anon.max 100' | |
echo 'exec.label Exec and libs' | |
echo 'exec.draw STACK' | |
echo 'exec.type GAUGE' | |
echo 'exec.min 0' | |
echo 'exec.max 100' | |
echo 'pagecache.label Page cache' | |
echo 'pagecache.draw STACK' | |
echo 'pagecache.type GAUGE' | |
echo 'pagecache.min 0' | |
echo 'pagecache.max 100' | |
echo 'cachelist.label Free (cachelist)' | |
echo 'cachelist.draw STACK' | |
echo 'cachelist.type GAUGE' | |
echo 'cachelist.min 0' | |
echo 'cachelist.max 100' | |
echo 'freelist.label Free (freelist)' | |
echo 'freelist.draw STACK' | |
echo 'freelist.type GAUGE' | |
echo 'freelist.min 0' | |
echo 'freelist.max 100' | |
exit 0 | |
fi; | |
output() { | |
echo "kernel.value $1" | |
echo "zfs.value $2" | |
echo "anon.value $3" | |
echo "exec.value $4" | |
echo "pagecache.value $5" | |
echo "cachelist.value $6" | |
echo "freelist.value $7" | |
} | |
values=`echo '::memstat ' | ${SUDO} ${MDB} -k | grep %$ | ${AWK} '{print $NF}' | sed -e 's/%//'` | |
output $values |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment