#!/bin/sh # # Plugin to monitor the number of procs in io-sleep and other wait # states. Uses `vmstat`. # # Parameters: # # config (required) # autoconf (optional - used by munin-config) # # $Log$ # Revision 1.4.2.1 2005/01/28 14:51:22 lupe # Add graph_info and some filed.info # # Revision 1.5 2005/01/28 14:47:31 lupe # Add graph_info and some filed.info # # Revision 1.4 2004/11/28 09:43:54 lupe # 6-CURRENT support # # Revision 1.3 2004/05/20 19:02:36 jimmyo # Set categories on a bunch of plugins # # Revision 1.2 2004/02/01 18:59:54 lupe # FreeBSD 5 compatibility. # # Revision 1.1 2004/01/02 18:50:00 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 # # # # Magick markers (optional): #%# family=auto #%# capabilities=autoconf OSV=`/sbin/sysctl -n kern.osrelease | cut -f1 -d.` if [ "$1" = "autoconf" ]; then if [ "$OSV" -ge "5" ]; then /sbin/sysctl -n vm.vmtotal 2>/dev/null >/dev/null RESULT=$? NAME=/sbin/sysctl else /usr/bin/vmstat 1 1 2>/dev/null >/dev/null RESULT=$? NAME=/usr/bin/vmstat fi if [ $RESULT -eq 0 ]; then echo yes exit 0 else if [ $RESULT -eq 127 ]; then echo "no (could not run \"$NAME\")" exit 1 else echo no exit 1 fi fi fi if [ "$1" = "config" ]; then echo 'graph_title VMstat' echo 'graph_args --base 1000 -l 0' echo 'graph_vlabel process states' echo 'graph_category processes' echo 'graph_info This graph shows number of processes in each state.' if [ "$OSV" -ge "5" ]; then echo 'running.label running' echo 'running.info processes on CPU or waiting for CPU' echo 'running.type GAUGE' echo 'diskwait.label diskwait' echo 'diskwait.info processes waiting for disk activity' echo 'diskwait.type GAUGE' echo 'pagewait.label pagewait' echo 'pagewait.info processes waiting for page-in' echo 'pagewait.type GAUGE' echo 'sleep.label sleep' echo 'sleep.info processes waiting for some event' echo 'sleep.type GAUGE' else echo 'wait.label wait' echo 'wait.type GAUGE' echo 'sleep.label sleep' echo 'sleep.type GAUGE' fi exit 0 fi if [ "$OSV" -ge "5" ]; then /sbin/sysctl -n vm.vmtotal | awk ' /^Processes:/ { print "running.value", $3; print "diskwait.value", $6; print "pagewait.value", $9; print "sleep.value", $11+0; }' else vmstat 1 2| awk 'END { print "wait.value " $1 "\nsleep.value " $2 }' fi