mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-11 21:42:39 -04:00
105 lines
3.2 KiB
Bash
Executable File
105 lines
3.2 KiB
Bash
Executable File
#!/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/node.d/
|
|
#
|
|
# $Log: interrupts.in,v $
|
|
# Revision 1.2 2006/06/08 18:59:26 he
|
|
# Remove installation of the documentation from this package, to be
|
|
# provided by the soon-to-be-committed munin-doc package.
|
|
#
|
|
# Other minor changes:
|
|
# o Remove comented-out bits from package Makefile
|
|
# o Re-ordered variables reported by NetBSD's cpu plugin script
|
|
# o Use shorter legend text in NetBSD's interrupts plugin script
|
|
#
|
|
# Bumped package revision.
|
|
#
|
|
# Revision 1.1.1.1 2006/06/04 20:53:57 he
|
|
# Import the client version of the Munin system monitoring/graphing
|
|
# tool -- project homepage is at http://munin.sourceforge.net/
|
|
#
|
|
# This package has added support for NetBSD, via a number of new plugin
|
|
# scripts where specific steps needs to be taken to collect information.
|
|
#
|
|
# I also modified the ntp_ plugin script to make it possible to not
|
|
# plot the NTP poll delay, leaving just jitter and offset, which IMO
|
|
# produces a more telling graph.
|
|
#
|
|
#
|
|
#
|
|
# Magic markers (optional - only used by munin-config and some
|
|
# installation scripts):
|
|
#
|
|
#%# family=auto
|
|
#%# capabilities=autoconf
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
if [ -x /usr/bin/vmstat ]; 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 'devint.info Device interrupts come from hardware (exceptions, NMI, IRQ)'
|
|
echo 'softint.info Software interrupts are typically deferred processing from hardware interrupts'
|
|
|
|
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 'devint.label device intrs'
|
|
echo 'softint.label software intrs'
|
|
echo 'ctx.label context switches'
|
|
|
|
# Specify type
|
|
echo 'devint.type DERIVE'
|
|
echo 'softint.type DERIVE'
|
|
echo 'ctx.type DERIVE'
|
|
|
|
# Set max (should always be done with counters) Note: this is max
|
|
# per second.
|
|
echo 'devint.max 100000'
|
|
echo 'softint.max 100000'
|
|
echo 'ctx.max 100000'
|
|
|
|
echo 'devint.min 0'
|
|
echo 'softint.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
|
|
|
|
vmstat -s | awk '
|
|
/device interrupts$/ { print "devint.value " $1; }
|
|
/context switches$/ { print "ctx.value " $1; }
|
|
/software interrupts$/ { print "softint.value " $1; }
|
|
'
|