#!/bin/sh # # Plugin to monitor the number of interrupts and context switches on a system. # # Idea and base from Ragnar Wisløff. # # Usage: Link or copy into /etc/munin/plugins # # $Log$ # Revision 1.6 2004/12/10 10:47:49 jimmyo # Change name from ${scale} to ${graph_period}, to be more consistent. # # Revision 1.5 2004/12/09 22:12:56 jimmyo # Added "graph_period" option, to make "graph_sums" usable. # # 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/09/25 22:29:16 jimmyo # Added info fields to a bunch of plugins. # # Revision 1.2 2004/05/20 13:57:12 jimmyo # Set categories to some of the 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.3 2003/12/06 16:24:34 jimmyo # Plugin interrupts: context switch graphing added by Mike Fedyk # # Revision 1.2 2003/11/07 17:43:16 jimmyo # Cleanups and log entries # # # Magic markers (optional - only used by munin-config and some # installation scripts): # #%# family=auto #%# capabilities=autoconf if [ "$1" = "autoconf" ]; then if [ -r /proc/stat ]; then echo yes exit 0 else echo no exit 1 fi fi # If run with the "config"-parameter, give out information on how the # graphs should look. if [ "$1" = "config" ]; then # The title of the graph echo 'graph_title Interrupts & context switches' # Arguments to "rrdtool graph". In this case, tell it that the # lower limit of the graph is '0', and that 1k=1000 (not 1024) echo 'graph_args --base 1000 -l 0' # The Y-axis label echo 'graph_vlabel interrupts & ctx switches / ${graph_period}' # Graph category echo 'graph_category system' # Graph information echo 'graph_info This graph shows the number of interrupts and context switches on the system. These are typically high on a busy system.' echo 'intr.info Interrupts are events that alter sequence of instructions executed by a processor. They can come from either hardware (exceptions, NMI, IRQ) or software.' echo 'ctx.info A context switch occurs when a multitasking operatings system suspends the currently running process, and starts executing another.' # The fields. "label" is used in the legend. "label" is the only # required subfield. echo 'intr.label interrupts' echo 'ctx.label context switches' # Specify type echo 'intr.type DERIVE' echo 'ctx.type DERIVE' # Set max (should always be done with counters) Note: this is max # per second. echo 'intr.max 100000' echo 'ctx.max 100000' echo 'intr.min 0' echo 'ctx.min 0' # Last, if run with the "config"-parameter, quit here (don't # display any data) exit 0 fi # The real work sed 's/intr/intr.value/;s/ctxt/ctx.value/' < /proc/stat \ | egrep 'intr|ctx' \ | awk '{ print $1" "$2 }'