#!/bin/sh # # Plugin to monitor CPU usage. # # Usage: Place in /etc/munin/node.d/ (or link it there using ln -s) # # Parameters understood: # # config (required) # autoconf (optional - used by munin-config) # # $Log$ # Revision 1.4 2004/11/21 00:17:12 jimmyo # Changed a lot of plugins so they use DERIVE instead of COUNTER. # # Revision 1.3 2004/05/20 19:02:38 jimmyo # Set categories on a bunch of plugins # # Revision 1.2 2004/04/30 16:43:00 jimmyo # Cleaned up Solaris plugins. # # Revision 1.1 2004/01/02 18:50:01 jimmyo # Renamed occurrances of lrrd -> munin # # Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo # Import of LRRD CVS tree after renaming to Munin # # Revision 1.2 2003/11/07 17:43:16 jimmyo # Cleanups and log entries # # # # Magic markers - optional - used by installation scripts and # munin-config: # #%# family=auto #%# capabilities=autoconf if [ "$1" = "autoconf" ]; then if [ -x /usr/bin/kstat ]; then echo yes exit 0 else echo no exit 1 fi fi if [ "$1" = "config" ]; then echo 'graph_title Paging Out' echo 'graph_order pgout pgpgout pgfree scan' echo "graph_args --base 1000" echo 'graph_category system' echo 'pgout.label pgout' echo 'pgout.draw LINE2' echo 'pgout.type DERIVE' echo 'pgout.min 0' echo 'pgout.max 1000000000' echo 'pgpgout.label pgpgout' echo 'pgpgout.draw LINE2' echo 'pgpgout.type DERIVE' echo 'pgpgout.min 0' echo 'pgpgout.max 1000000000' echo 'pgfree.label pgfree' echo 'pgfree.draw LINE2' echo 'pgfree.type DERIVE' echo 'pgfree.min 0' echo 'pgfree.max 1000000000' echo 'scan.label scan' echo 'scan.draw LINE2' echo 'scan.type DERIVE' echo 'scan.min 0' echo 'scan.max 1000000000' exit 0 fi kstat -p -c misc -m cpu_stat -s '/^(pgout|pgpgout|dfree|scan)$/' | sed -e 's/.*://' | awk ' BEGIN { map["pgout"] = "pgout" map["pgpgout"] = "pgpgout" map["dfree"] = "pgfree" map["scan"] = "scan" } length(map[$1]) > 0 { sum[map[$1]] += $2 } END { for (item in sum) { print item ".value", sum[item] } }'