#!/bin/sh
#
# $Log$
# Revision 1.3  2004/05/20 19:02:38  jimmyo
# Set categories on a bunch of plugins
#
# Revision 1.2  2004/05/15 21:33:30  jimmyo
# "Upped" som plugins from contrib/manual to manual or auto.
#
# 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.3  2003/11/07 17:43:16  jimmyo
# Cleanups and log entries
#
#%# family=auto
#%# capabilites=autoconf


if [ "$1" = "auto" ]; then
	echo 'yes'
	exit 0
fi

if [ "$1" = "config" ]; then

	echo 'graph_title Processes'
	echo 'graph_order total sleeping stopped zombie runnable running'
	echo 'graph_category processes'
	echo 'total.draw AREA'
	echo 'total.label total'
	echo 'sleeping.label sleeping'
	echo 'sleeping.draw AREA'
	echo 'stopped.label stopped'
	echo 'stopped.draw STACK'
	echo 'zombie.label zombie'
	echo 'zombie.draw STACK'
	echo 'runnable.label runnable'
	echo 'runnable.draw STACK'
	echo 'running.label running'
	echo 'running.draw STACK'

        exit 0
fi

/usr/bin/ps -el | awk '
{ total++; stat[$2]++ }
END {
print "total.value "    0+total;
print "running.value "  0+stat["O"];
print "sleeping.value " 0+stat["S"];
print "runnable.value " 0+stat["R"];
print "stopped.value "  0+stat["T"];
print "zombie.value "   0+stat["Z"];
}'


syntax highlighted by Code2HTML, v. 0.9.1