mirror of
https://github.com/Stichting-MINIX-Research-Foundation/pkgsrc-ng.git
synced 2025-09-12 22:13:47 -04:00
103 lines
2.3 KiB
Bash
Executable File
103 lines
2.3 KiB
Bash
Executable File
#!/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: vmstat.in,v $
|
|
# 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.
|
|
#
|
|
#
|
|
#
|
|
#
|
|
# Magick markers (optional):
|
|
#%# family=auto
|
|
#%# capabilities=autoconf
|
|
|
|
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
if [ -x /usr/bin/vmstat ]; then
|
|
if /usr/bin/vmstat 1 1 2>/dev/null >/dev/null; then
|
|
echo yes
|
|
exit 0
|
|
else
|
|
echo no
|
|
exit 1
|
|
fi
|
|
else
|
|
echo no
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
/usr/bin/vmstat -t -c 1 >/dev/null 2>&1
|
|
if [ $? -eq 0 ]; then
|
|
new=true
|
|
else
|
|
new=false
|
|
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.'
|
|
|
|
echo 'running.label running'
|
|
echo 'running.info processes on CPU or waiting for CPU'
|
|
echo 'running.type GAUGE'
|
|
|
|
echo 'sleep.label sleep'
|
|
echo 'sleep.info processes waiting for some event'
|
|
echo 'sleep.type GAUGE'
|
|
|
|
if $new; then
|
|
echo 'diskwait.label diskwait'
|
|
echo 'diskwait.info processes waiting for disk i/o activity'
|
|
echo 'diskwait.type GAUGE'
|
|
|
|
echo 'pagewait.label pagewait'
|
|
echo 'pagewait.info processes waiting for page-in'
|
|
echo 'pagewait.type GAUGE'
|
|
|
|
else
|
|
echo 'iowait.label wait'
|
|
echo 'iowait.info processes blocked for resources (i/o, paging, etc.)'
|
|
echo 'iowait.type GAUGE'
|
|
|
|
fi
|
|
exit 0
|
|
fi
|
|
|
|
if $new; then
|
|
/usr/bin/vmstat -t -c 1 | tail -1 | awk '// {
|
|
print "running.value " $1;
|
|
print "diskwait.value " $2;
|
|
print "pagewait.value " $3;
|
|
print "sleep.value " $4;
|
|
print "swapped.value " $5;
|
|
}'
|
|
else
|
|
/usr/bin/vmstat -c 1 | tail -1 | awk '// {
|
|
print "running.value " $1;
|
|
print "iowait.value " $2;
|
|
print "sleep.value " $3;
|
|
}'
|
|
fi
|