Import of pkgsrc-2013Q2

This commit is contained in:
2013-09-26 17:14:40 +02:00
commit 785076ae39
74991 changed files with 4380255 additions and 0 deletions

View File

@@ -0,0 +1,144 @@
#!/bin/sh
#
# Plugin to monitor CPU usage.
#
# Usage: Place in /etc/munin/node.d/ (or link it there using ln -s)
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log: cpu.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 - used by installation scripts and
# munin-config:
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /sbin/sysctl ]; then
/sbin/sysctl kern.cp_time > /dev/null
if [ $? = "0" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
STATUNITS=`/sbin/sysctl -n kern.clockrate | cut -f15 -d' '`
PERCENT=`/sbin/sysctl -n hw.ncpu | awk '{print ($1)*100}'`
NCPU=`/sbin/sysctl -n hw.ncpu`
if [ "$scaleto100" = yes ]; then
CDEF="${STATUNITS},/,100,*,$NCPU,/"
PERCENT=100
else
CDEF="${STATUNITS},/,100,*"
PERCENT=$(($NCPU*100))
fi
# SYSWARNING=$PERCENT*30/100
# SYSCRITICAL=$PERCENT*50/100
# INTWARNING=$PERCENT*80/100
# USRWARNING=$PERCENT*80/100
echo 'graph_title CPU usage (' $NCPU ' CPUs)'
echo 'graph_order system interrupt user idle nice'
echo "graph_args --base 1000 -r --lower-limit 0 --upper-limit $PERCENT "
echo 'graph_vlabel %'
echo 'graph_scale no'
echo 'graph_info This graph shows how CPU time is spent.'
echo 'graph_category system'
echo 'graph_period second'
echo 'system.label system'
echo 'system.draw AREA'
echo 'system.max 5000'
echo 'system.type DERIVE'
echo 'system.min 0'
# echo "system.warning $SYSWARNING"
# echo "system.critical $SYSCRITICAL"
echo 'system.info CPU time spent by the kernel in system activities'
echo "system.cdef system,$CDEF"
echo 'interrupt.label interrupt'
echo 'interrupt.draw STACK'
echo 'interrupt.max 5000'
# echo "interrupt.warning $INTWARNING"
echo 'interrupt.type DERIVE'
echo 'interrupt.min 0'
echo 'interrupt.info CPU time spent by the kernel processing interrupts'
echo "interrupt.cdef interrupt,$CDEF"
echo 'user.label user'
echo 'user.draw STACK'
echo 'user.max 5000'
# echo "user.warning $USRWARNING"
echo 'user.type DERIVE'
echo 'user.info CPU time spent by normal programs and daemons'
echo 'user.min 0'
echo "user.cdef user,$CDEF"
echo 'idle.label idle'
echo 'idle.draw STACK'
echo 'idle.max 5000'
echo 'idle.type DERIVE'
echo 'idle.info Idle CPU time'
echo 'idle.min 0'
echo "idle.cdef idle,$CDEF"
echo 'nice.label nice'
echo 'nice.draw STACK'
echo 'nice.max 5000'
echo 'nice.type DERIVE'
echo 'nice.info CPU time spent by nice(1)d programs'
echo 'nice.min 0'
echo "nice.cdef nice,$CDEF"
exit 0
fi
/sbin/sysctl kern.cp_time | awk '{
gsub(",", "");
split($0, a);
print "system.value " a[10];
print "interrupt.value " a[13];
print "user.value " a[4];
print "idle.value " a[16];
print "nice.value " a[7];
}'

View File

@@ -0,0 +1,79 @@
#!/bin/sh
#
# Script to monitor disk usage.
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log: df.in,v $
# Revision 1.2 2010/10/27 18:23:13 shattered
# Also ignore null and union filesystems, bump 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 - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
MAXLABEL=20
TYPES=noprocfs,devfs,fdescfs,ptyfs,kernfs,nfs,null,union
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Filesystem usage (in %)'
echo 'graph_args --upper-limit 100 -l 0'
echo 'graph_vlabel %'
echo 'graph_category disk'
echo 'graph_info This graph shows disk usage on the machine.'
mfs=0
/bin/df -P -t $TYPES | tail +2 | grep -v "//" | while read i; do
case $i in
mfs:*) name=mfs$mfs; mfs=`expr $mfs + 1`;;
*) name=`echo $i | awk '{ gsub("[^a-zA-Z0-9_]", "_", $1); print $1 }'` ;;
esac
echo -n "$name.label "
echo $i | awk "{
dir=\$6;
if (length(dir) <= $MAXLABEL)
print dir
else
printf (\"...%s\n\", substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))
print \"$name.info \" \$6 \" -> \" \$1;
}"
echo "$name.warning 92"
echo "$name.critical 98"
done
exit 0
fi
mfs=0
/bin/df -P -t $TYPES | tail +2 | grep -v "//" | while read i; do
case $i in
mfs:*) name=mfs$mfs; mfs=`expr $mfs + 1`;;
*) name=`echo $i | awk '{ gsub("[^a-zA-Z0-9_]", "_", $1); print $1 }'` ;;
esac
echo -n "$name.value "
echo $i | awk '{ print $5 }' | cut -f1 -d%
done

View File

@@ -0,0 +1,94 @@
#!/bin/sh
#
# Plugin to monitor inode-usage.
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log: df_inode.in,v $
# Revision 1.2 2010/10/27 18:23:13 shattered
# Also ignore null and union filesystems, bump 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 - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
MAXLABEL=20
TYPES=noprocfs,devfs,fdescfs,ptyfs,kernfs,nfs,null,union
print_values() {
mfs=0
/bin/df -P -i -t $TYPES | tail +2 | grep -v "//" | \
while read i; do
case $i in
mfs:*) name=mfs$mfs; mfs=`expr $mfs + 1`;;
*) name=`echo $i | awk '{
gsub("[^a-zA-Z0-9_]", "_", $1); print $1 }'`
;;
esac
echo -n "$name.value "
echo $i | awk '{ print $8 }' | cut -f1 -d%
done
}
if [ "$1" = "autoconf" ]; then
if [ "`print_values`" = "" ] ; then
echo no
exit 1
else
echo yes
exit 0
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Inode usage (in %)'
echo 'graph_args --upper-limit 100 -l 0'
echo 'graph_vlabel %'
echo 'graph_category disk'
echo 'graph_info This graph shows the inode usage for the partitions of types that use inodes.'
/bin/df -P -i -t $TYPES | tail +2 | grep -v "//" | awk "
BEGIN {
mfs = 0
}
{
name = \$1
dir = \$9
if (\$1 ~ /^mfs:/) {
name = \"mfs\" mfs
mfs = mfs + 1
} else {
gsub(/[^a-zA-Z0-9_]/, \"_\", name)
}
if (length(dir) <= $MAXLABEL)
print name \".label \" dir
else
printf (\"%s.label ...%s\n\", name, substr (dir, length(dir)-$MAXLABEL+4, $MAXLABEL-3))
print name \".info \" dir \" -> \" name
print name \".warning 92\"
print name \".critical 98\"
}"
exit 0
fi
print_values

View File

@@ -0,0 +1,75 @@
#!/bin/sh
#
# Plugin to monitor the number of forks per second on the machine.
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log: forks.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 - used by munin-config and som installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /usr/bin/vmstat ]; then
echo yes
exit 0
else
echo "no (no /usr/bin/vmstat executable)"
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Fork rate'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel forks / ${graph_period}'
echo 'graph_category processes'
echo 'graph_info This graph shows the number of forks (new processes started) per second.'
echo 'forks.label forks'
echo 'forks.type DERIVE'
echo 'forks.min 0'
echo 'forks.max 100000'
echo 'forks.info The number of forks per second.'
echo 'forkblk.label forks blocked parent'
echo 'forkblk.type DERIVE'
echo 'forkblk.min 0'
echo 'forkblk.max 100000'
echo 'forkblk.info The number of forks which blocked the parent process.'
echo 'forksh.label shared addrs w. parent'
echo 'forksh.type DERIVE'
echo 'forksh.min 0'
echo 'forksh.max 100000'
echo 'forksh.info The number of forks which shared address space with the parent process.'
exit 0
fi
vmstat -s | awk '
/forks total$/ { print "forks.value " $1; }
/forks blocked parent$/ { print "forkblk.value " $1; }
/forks shared address space with parent$/ { print "forksh.value " $1; }
'

View File

@@ -0,0 +1,80 @@
#!/bin/sh
#
# Wildcard-plugin to monitor network interfaces. To monitor an
# interface, link if_<interface> to this file. E.g.
#
# ln -s /usr/share/munin/node/plugins-auto/if_ /etc/munin/node.d/if_eth0
#
# ...will monitor eth0.
#
# Any device found in /usr/bin/netstat can be monitored.
#
# $Log: if_.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.
#
#
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf suggest
INTERFACE=`basename $0 | sed 's/^if_//g'`
if [ "$1" = "autoconf" ]; then
if [ -x /usr/bin/netstat ]; then
echo yes
exit 0
else
echo "no (/usr/bin/netstat not found)"
exit 1
fi
fi
if [ "$1" = "suggest" ]; then
if [ -x /usr/bin/netstat ]; then
netstat -i -b | sed -n -e '/^faith/d' -e '/^lo0/d' -e '/<Link.*>/s/\** .*//p'
exit 0
else
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo "graph_order rbytes obytes"
echo "graph_title $INTERFACE traffic"
echo 'graph_args --base 1000'
echo 'graph_vlabel bits per ${graph_period} in (-) / out (+)'
echo 'graph_category network'
echo "graph_info This graph shows the traffic of the $INTERFACE network interface. Please note that the traffic is shown in bits per second, not bytes."
echo 'rbytes.label received'
echo 'rbytes.type COUNTER'
echo 'rbytes.graph no'
echo 'rbytes.cdef rbytes,8,*'
echo 'obytes.label bps'
echo 'obytes.type COUNTER'
echo 'obytes.negative rbytes'
echo 'obytes.cdef obytes,8,*'
echo "obytes.info Traffic sent (+) and received (-) on the $INTERFACE network interface."
exit 0
fi;
/usr/bin/netstat -i -b -I $INTERFACE | awk '
/<Link.*>/ {
print "rbytes.value ", $5;
print "obytes.value ", $6;
}'

View File

@@ -0,0 +1,76 @@
#!/bin/sh
#
# Wildcard-plugin to monitor network interfaces. To monitor an
# interface, link if_<interface> to this file. E.g.
#
# ln -s /usr/share/munin/node/plugins-auto/if_ /etc/munin/node.d/if_eth0
#
# ...will monitor eth0.
#
# Any device found in /usr/bin/netstat can be monitored.
#
# $Log: if_errcoll_.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.
#
#
#
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf suggest
INTERFACE=`basename $0 | sed 's/^if_errcoll_//g'`
if [ "$1" = "autoconf" ]; then
if [ -x /usr/bin/netstat ]; then
echo yes
exit 0
else
echo "no (/usr/bin/netstat not found)"
exit 1
fi
fi
if [ "$1" = "suggest" ]; then
if [ -x /usr/bin/netstat ]; then
netstat -i -b | sed -n -e '/^faith/d' -e '/^lo0/d' -e '/<Link.*>/s/\** .*//p'
exit 0
else
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo "graph_order ierrors oerrors collisions"
echo "graph_title $INTERFACE Errors & Collisions"
echo 'graph_args --base 1000'
echo 'graph_vlabel events / ${graph_period}'
echo 'graph_category network'
echo "graph_info This graph shows the amount of errors and collisions on the $INTERFACE network interface."
echo 'ierrors.label Input Errors'
echo 'ierrors.type COUNTER'
echo 'oerrors.label Output Errors'
echo 'oerrors.type COUNTER'
echo 'collisions.label Collisions'
echo 'collisions.type COUNTER'
exit 0
fi;
/usr/bin/netstat -i -I $INTERFACE | awk '
/<Link.*>/ {
print "ierrors.value", $6;
print "oerrors.value", $8;
print "collisions.value", $9;
}'

View File

@@ -0,0 +1,104 @@
#!/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; }
'

View File

@@ -0,0 +1,117 @@
#!/bin/sh
#
# Plugin for watching io-bound traffic (in bytes) on disks.
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log: iostat.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 - used by munin-config and som installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /usr/sbin/iostat ]; then
echo yes
exit 0
else
echo "no (no /usr/sbin/iostat executable)"
exit 1
fi
fi
nf=`/usr/sbin/iostat -I -x | tail -1 | awk '{ print NF }'`
if [ $nf -eq 5 ]; then
oldformat=true
else
oldformat=false
fi
if [ "$1" = "config" ]; then
echo 'graph_title IOstat by bytes'
echo 'graph_args --base 1024 -l 0 '
if ! $oldformat; then
echo 'graph_vlabel MB per ${graph_period} read (-) / written (+)'
else
echo 'graph_vlabel MB per ${graph_period} read+written'
fi
echo 'graph_category disk'
echo 'graph_info This graph shows the I/O to and from block devices'
drives=`/usr/sbin/iostat -I -x | awk '
/^device/ { next; }
// { print $1; }'`
echo -n 'graph_order'
for d in $drives; do
if $oldformat; then
echo -n ' '${d}'_io'
else
echo -n ' '${d}'_read '${d}'_write'
fi
done
echo
if $oldformat; then
for d in $drives; do
echo "${d}_io.label ${d}"
echo "${d}_io.info I/O on device ${d}"
echo "${d}_io.type DERIVE"
echo "${d}_io.max 2000"
echo "${d}_io.min 0"
done
else
for d in $drives; do
echo "${d}_read.label ${d}"
echo "${d}_read.type DERIVE"
echo "${d}_read.max 2000"
echo "${d}_read.min 0"
echo "${d}_read.graph no"
echo "${d}_write.label ${d}"
echo "${d}_write.info I/O on device ${d}"
echo "${d}_write.type DERIVE"
echo "${d}_write.max 2000"
echo "${d}_write.min 0"
echo "${d}_write.negative ${d}_read"
done
fi
exit 0
fi
if $oldformat; then
/usr/sbin/iostat -I -x | awk '
/^device/ { next; }
{
print $1 "_io.value " int($5);
}
'
else
/usr/sbin/iostat -I -x | awk '
/^device/ { next; }
{
print $1 "_read.value " int($5);
print $1 "_write.value " int($9);
}
'
fi

View File

@@ -0,0 +1,117 @@
#!/bin/sh
#
# Plugin for watching io-bound traffic (in transfers) on disks.
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log: iostat_ops.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 - used by munin-config and som installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /usr/sbin/iostat ]; then
echo yes
exit 0
else
echo "no (no /usr/sbin/iostat executable)"
exit 1
fi
fi
nf=`/usr/sbin/iostat -I -x | tail -1 | awk '{ print NF }'`
if [ $nf -eq 5 ]; then
oldformat=true
else
oldformat=false
fi
if [ "$1" = "config" ]; then
echo 'graph_title IOstat by transfers'
echo 'graph_args --base 1000 -l 0 '
if ! $oldformat; then
echo 'graph_vlabel Xfers per ${graph_period} read (-) / written (+)'
else
echo 'graph_vlabel Xfers per ${graph_period} read+written'
fi
echo 'graph_category disk'
echo 'graph_info This graph shows the I/O to and from block devices'
drives=`/usr/sbin/iostat -I -x | awk '
/^device/ { next; }
// { print $1; }'`
echo -n 'graph_order'
for d in $drives; do
if $oldformat; then
echo -n ' ' ${d}'_io'
else
echo -n ' ' ${d}'_read ' ${d}'_write '
fi
done
echo
if $oldformat; then
for d in $drives; do
echo "${d}_io.label ${d}"
echo "${d}_io.info I/O on device ${d}"
echo "${d}_io.type DERIVE"
echo "${d}_io.max 20000"
echo "${d}_io.min 0"
done
else
for d in $drives; do
echo "${d}_read.label ${d}"
echo "${d}_read.type DERIVE"
echo "${d}_read.max 20000"
echo "${d}_read.min 0"
echo "${d}_read.graph no"
echo "${d}_write.label ${d}"
echo "${d}_write.info I/O on device ${d}"
echo "${d}_write.type DERIVE"
echo "${d}_write.max 20000"
echo "${d}_write.min 0"
echo "${d}_write.negative ${d}_read"
done
fi
exit 0
fi
if $oldformat; then
/usr/sbin/iostat -I -x | awk '
/^device/ { next; }
{
print $1 "_io.value " $3;
}
'
else
/usr/sbin/iostat -I -x | awk '
/^device/ { next; }
{
print $1 "_read.value " $3;
print $1 "_write.value " $7;
}
'
fi

View File

@@ -0,0 +1,84 @@
#! /bin/sh
#
# Plugin to monitor the individual interrupt sources.
#
# Usage: Link or copy into /etc/munin/node.d/
#
# $Log: irqstats.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.
#
#
#
# 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
intr_sources () {
/usr/bin/vmstat -i | awk '
/^interrupt/ { next; }
/^Total/ { next; }
{
s=substr($0, 1, 24);
gsub(" *$", "", s);
gsub(" ", "_", s);
print s;
}
'
}
# If run with the "config"-parameter, give out information on how the
# graphs should look.
if [ "$1" = "config" ]; then
echo 'graph_title Individual interrupts'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel interrupts / ${graph_period}'
echo 'graph_category system'
echo -n 'graph_order '
for i in `intr_sources`; do
echo -n ' intr_'${i}
done
echo
for i in `intr_sources`; do
# echo 'intr_'${i}'.draw LINE'
echo 'intr_'${i}'.label' `echo $i | sed -e 's/_/ /g'`
echo 'intr_'${i}'.info Interrupt' `echo $i | sed -e 's/_/ /g'`
echo 'intr_'${i}'.type DERIVE'
echo 'intr_'${i}'.min 0'
done
exit 0
fi
/usr/bin/vmstat -i | awk '
/^interrupt/ { next; }
/^Total/ { next; }
/[0-9]/{
s=substr($0, 1, 24);
gsub(" *$", "", s);
gsub(" ", "_", s);
print "intr_" s ".value " $(NF-1);
}
'

View File

@@ -0,0 +1,122 @@
#!/bin/sh
#
# Plugin to monitor the load average on a system.
#
# Usage: Link or copy into /etc/munin/node.d/
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
# $Log: load.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.
#
#
#
#
#%# family=auto
#%# capabilities=autoconf
# If run with the "autoconf"-parameter, give our opinion on wether we
# should be run on this system or not. This is optinal, and only used by
# munin-config. In the case of this plugin, we should most probably
# always be included.
if [ "$1" = "autoconf" ]; then
if [ -x /sbin/sysctl ]; then
/sbin/sysctl vm.loadavg > /dev/null
if [ $? = "0" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
else
echo no
exit 1
fi
fi
NCPU=`/sbin/sysctl -n hw.ncpu`
# If we fail for some reason, default to 1 cpu
if [ $? != 0 ]; then NCPU=1; fi
# If run with the "config"-parameter, give out information on how the
# graphs should look.
if [ "$1" = "config" ]; then
# The host name this plugin is for. (Can be overridden to have
# one machine answer for several)
# The title of the graph
echo 'graph_title Load average'
# 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 load'
# We want Cur/Min/Avg/Max unscaled (i.e. 0.42 load instead of
# 420 milliload)
echo 'graph_noscale true'
# The category of the plugin. Defaults to "other".
echo 'graph_category system'
# The fields. "label" is used in the legend. "label" is the only
# required subfield.
echo 'load.label load'
# These two are optional. They are only used if you have
# configured your munin to tell a Nagios-server about any
# problems
echo 'load.warning ' $((10 * $NCPU))
echo 'load.critical 120'
# This one is purely to add an explanation to the web page. The first
# one is for the graph itself, while the second one is for the field
# "load".
echo 'graph_info The load average of the machine describes how many processes are in the run-queue (scheduled to run "immediately").'
echo 'load.info Average load for the five minutes.'
# Last, if run with the "config"-parameter, quit here (don't
# display any data)
exit 0
fi
# If not run with any parameters at all (or only unknown ones), do the
# real work - i.e. display the data. Almost always this will be
# "value" subfield for every data field.
echo -n "load.value "
/sbin/sysctl vm.loadavg | cut -f3 -d' '
# How could this plugin have been written in its simplest form?
# Something like this:
#
# ---------------------
# #!/bin/sh
#
# if [ "$1" = "config" ]; then
# echo "graph_title Load average"
# echo 'graph_args --base 1000 -l 0'
# echo 'graph_vlabel load'
# echo "load.label load"
# exit 0
# fi
# echo -n "load.value "
# cut -f1 -d' ' < /proc/loadavg
# ---------------------
#
# Except for the Nagios-warnings (which most people don't have any need
# for) and things used by installation scripts and munin-config (which
# you don't need if you don't plan on submitting your plugin to the
# pacakge), the two versions will work identically.

View File

@@ -0,0 +1,89 @@
#!/bin/sh
#
# Plugin to monitor memory usage.
#
# Parameters:
#
# config (required)
# autoconf (optional - only used by munin-config)
#
# $Log: memory.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.
#
#
#
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /sbin/sysctl ]; then
/sbin/sysctl hw.pagesize > /dev/null
if [ $? = "0" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
else
echo no
exit 1
fi
fi
PAGESIZE=`/sbin/sysctl -n hw.pagesize`
MEMSIZE=`vmstat -s | awk '/pages managed/ { print $1 }'`
MEMMAX=`echo 2k $PAGESIZE $MEMSIZE '*p' | dc`
if [ "$1" = "config" ]; then
echo 'graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit '$MEMMAX
echo 'graph_title Memory usage'
echo 'graph_category system'
echo 'graph_info This graph shows what the machine uses its memory for.'
echo 'graph_order active inactive wired kernel free'
echo 'active.label active'
echo 'active.info pages recently statistically used'
echo 'active.draw AREA'
echo 'inactive.label inactive'
echo 'inactive.info pages recently statistically unused'
echo 'inactive.draw STACK'
echo 'wired.label wired'
echo 'wired.info pages that are fixed into memory'
echo 'wired.draw STACK'
echo 'kernel.label kernel'
echo 'kernel.info pages used by the kernel'
echo 'kernel.draw STACK'
echo 'free.label free'
echo 'free.info pages without data content'
echo 'free.draw STACK'
exit 0
fi
vmstat -s | awk -v bpp=$PAGESIZE '
/pages managed$/ { managed = $1; }
/pages free$/ { free = $1; print "free.value " $1 * bpp; }
/pages active$/ { active = $1; print "active.value " $1 * bpp; }
/pages inactive$/ { inactive = $1; print "inactive.value " $1 * bpp; }
/pages wired$/ { wired = $1; print "wired.value " $1 * bpp; }
END { kernel = managed - wired - inactive - active - free;
print "kernel.value " kernel * bpp; }'

View File

@@ -0,0 +1,143 @@
#! /bin/sh
#
# Plugin to monitor NetBSD kernel memory pool usage.
#
# Parameters:
#
# config (required)
# autoconf (optional - only used by munin-config)
#
# $Log: memory_pools.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.
#
#
#
#
# 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
PAGESIZE=`/sbin/sysctl -n hw.pagesize`
KMEM=`vmstat -s | awk -v bpp=$PAGESIZE '
/pages managed$/ { managed = $1; }
/pages free$/ { free = $1; }
/pages active$/ { active = $1; }
/pages inactive$/ { inactive = $1;}
/pages wired$/ { wired = $1; }
END { kernel = managed - wired - inactive - active - free;
print kernel * bpp; }'`
if [ "$1" = "config" ]; then
echo 'graph_args --base 1024 -l 0 --vertical-label Bytes'
echo 'graph_title Kernel Pool Memory usage'
echo 'graph_category system'
echo 'graph_info This graph shows the kernel memory pool usage'
echo 'graph_order vnode ncache ffsino mbufs rest bufpl bufs'
echo 'vnode.label vnodes'
echo 'vnode.info vnode cache'
echo 'vnode.draw AREA'
echo 'ncache.label ncache'
echo 'ncache.info namei cache'
echo 'ncache.draw STACK'
echo 'ffsino.label ffs-i'
echo 'ffsino.info FFS inode cache'
echo 'ffsino.draw STACK'
echo 'mbufs.label mbufs'
echo 'mbufs.info network buffers (mbufs + mbuf clusters)'
echo 'mbufs.draw STACK'
echo 'rest.label rest'
echo 'rest.info sum of other memory pools'
echo 'rest.draw STACK'
echo 'bufpl.label bufpl'
echo 'bufpl.info buffer pool'
echo 'bufpl.draw STACK'
echo 'bufs.label bufs'
echo 'bufs.info buffer pools, for file metadata'
echo 'bufs.draw STACK'
exit 0
fi
vmstat -m -W > /dev/null 2>&1
if [ $? -eq 0 ]; then
vmstat -m -W 2>/dev/null | awk '
/^Memory resource pool statistics/ { inpool=1; next; }
/^In use/ { inpool=0; next; }
/^Name/ { next; }
/^vnodepl/ && inpool { vnode = $10 * $11; next; }
/^ncachepl/ && inpool { ncache = $10 * $11; next; }
/^ffsinopl/ && inpool { ffsino = $10 * $11; next; }
/^dino1pl/ && inpool { dinopl = $10 * $11; next; }
/^buf.*k / && inpool { bufk += $10 * $11; next; }
/^bufpl/ && inpool { bufpl = $10 * $11; next; }
/^mbpl/ && inpool { mbufs += $10 * $11; next; }
/^mclpl/ && inpool { mbufs += $10 * $11; next; }
$16 != "0x200" && $16 != "0x600" && inpool { rest += $10 * $11; }
END {
print "bufs.value " bufk;
print "bufpl.value " bufpl;
print "vnode.value " vnode;
print "ncache.value " ncache;
print "ffsino.value " ffsino;
print "mbufs.value " mbufs;
print "rest.value " rest;
}'
else
# Need to guess size of pool pages, may not be correct
# for small-memory machines (< 16MB)
vmstat -m 2>/dev/null | awk -v bpp=$PAGESIZE '
/^Memory resource pool statistics/ { inpool=1; next; }
/^In use/ { inpool=0; next; }
/^Name/ { next; }
/^vnodepl/ && inpool { vnode = $8 * bpp; next; }
/^ncachepl/ && inpool { ncache = $8 * bpp; next; }
/^ffsinopl/ && inpool { ffsino = $8 * bpp; next; }
/^dino1pl/ && inpool { dinopl = $8 * bpp; next; }
/^buf.*k / && inpool { bufk += $8 * 65536; next; }
/^bufpl/ && inpool { bufpl = $8 * bpp; next; }
/^mbpl/ && inpool { mbufs += $8 * bpp; next; }
/^mclpl/ && inpool { mbufs += $8 * bpp; next; }
/^kvakernel/ { next; }
/^kvakmem/ { next; }
inpool { rest += $8 * bpp; }
END {
print "bufs.value " bufk;
print "bufpl.value " bufpl;
print "vnode.value " vnode;
print "ncache.value " ncache;
print "ffsino.value " ffsino;
print "mbufs.value " mbufs;
print "rest.value " rest;
}'
fi

View File

@@ -0,0 +1,88 @@
#! /bin/sh
#
# Plugin to monitor memory usage by type.
#
# Parameters:
#
# config (required)
# autoconf (optional - only used by munin-config)
#
# $Log: memory_types.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.
#
#
#
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /sbin/sysctl ]; then
if /sbin/sysctl hw.pagesize > /dev/null 2>&1; then
echo yes
exit 0
else
echo no
exit 1
fi
else
echo no
exit 1
fi
fi
PAGESIZE=`/sbin/sysctl -n hw.pagesize`
MEMSIZE=`vmstat -s | awk '/pages managed/ { print $1 }'`
MEMMAX=`echo 2k $PAGESIZE $MEMSIZE '*p' | dc`
if [ "$1" = "config" ]; then
echo 'graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit '$MEMMAX
echo 'graph_title Memory usage by category'
echo 'graph_category system'
echo 'graph_info This graph shows how the machine uses its memory.'
echo 'graph_order exec anon file kernel free'
echo 'exec.label exec'
echo 'exec.info memory for cached executables'
echo 'exec.draw AREA'
echo 'anon.label anon'
echo 'anon.info anonymous memory'
echo 'anon.draw STACK'
echo 'file.label file'
echo 'file.info memory for cached non-executable files'
echo 'file.draw STACK'
echo 'kernel.label kernel'
echo 'kernel.info memory used by the kernel'
echo 'kernel.draw STACK'
echo 'free.label free'
echo 'free.info free memory'
echo 'free.draw STACK'
exit 0
fi
vmstat -s | awk -v bpp=$PAGESIZE '
/pages managed$/ { managed = $1; }
/pages free$/ { free = $1; print "free.value " $1 * bpp; }
/anonymous pages$/{ anon = $1; print "anon.value " $1 * bpp; }
/cached file pages$/{ file = $1; print "file.value " $1 * bpp; }
/cached executable pages$/{ exec = $1; print "exec.value " $1 * bpp; }
END { kernel = managed - anon - file - exec - free;
print "kernel.value " kernel * bpp; }'

View File

@@ -0,0 +1,94 @@
#!/bin/sh
#
# Plugin to monitor network connections.
#
# Parameters:
#
# config (required)
# autoconf (optional - only used by munin-config)
#
# $Log: netstat.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.
#
#
#
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if ( netstat -s 2>/dev/null >/dev/null ); then
echo yes
exit 0
else
if [ $? -eq 127 ]
then
echo "no (netstat program not found)"
exit 1
else
echo no
exit 1
fi
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Netstat'
echo 'graph_args -l 0 --base 1000'
echo 'graph_vlabel active connections per ${graph_period}'
echo 'graph_category network'
echo 'graph_period second'
echo 'graph_info This graph shows the TCP activity of all the network interfaces combined.'
echo 'active.label active'
echo 'active.type DERIVE'
echo 'active.min 0'
echo 'active.max 50000'
echo 'active.info The number of active TCP openings per second.'
echo 'passive.label passive'
echo 'passive.type DERIVE'
echo 'passive.min 0'
echo 'passive.max 50000'
echo 'passive.info The number of passive TCP openings per second.'
echo 'failed.label failed'
echo 'failed.type DERIVE'
echo 'failed.min 0'
echo 'failed.max 50000'
echo 'failed.info The number of failed TCP connection attempts per second.'
echo 'resets.label resets'
echo 'resets.type DERIVE'
echo 'resets.min 0'
echo 'resets.max 50000'
echo 'resets.info The number of TCP connection resets.'
echo 'established.label established'
echo 'established.type DERIVE'
echo 'established.min 0'
echo 'established.max 50000'
echo 'established.info The number of currently open connections.'
exit 0
fi
netstat -s | awk '
/connection requests/ { print "active.value " $1 }
/connection accepts/ { print "passive.value " $1 }
/bad connection/ { print "failed.value " $1 }
/reset/ { print "resets.value " $1 }
/connections established/ { print "established.value " $1 }'

View File

@@ -0,0 +1,82 @@
#!/bin/sh
#
# Plugin to monitor NFS client traffic
#
# $Log: nfs_client.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.
#
#
#
#%# family=auto
#%# capabilities=autoconf
getnames () {
/usr/bin/nfsstat -c | awk '
/RPC Counts/ { coll = 1; next; }
/RPC Info/ { exit 0; }
/[a-z]/ && coll {
for (n = 1; n <= NF; n++) {
print $n
}
}
'
}
if [ "$1" = "autoconf" ]; then
if [ -x /usr/bin/nfsstat ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title NFS Client'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel requests / ${graph_period}'
echo 'graph_total total'
echo 'graph_category NFS'
for a in `getnames` ; do
echo "$a.label $a"
echo "$a.type DERIVE"
echo "$a.min 0"
done
exit 0
fi
/usr/bin/nfsstat -c | awk '
/RPC Counts/ { coll=1; next; }
/RPC Info/ { exit 0; }
/[a-z]/ && coll {
for (n in names) {
names[n] = ""
}
for (n = 1; n <= NF; n++) {
names[n] = $n
}
}
/[0-9]/ && coll {
for (n = 1; n <= NF/2; n++) {
name = names[n]
values[name] = $((n - 1) * 2 + 1)
}
}
END {
for (v in values) {
print v ".value " values[v];
}
}
'

View File

@@ -0,0 +1,82 @@
#!/bin/sh
#
# Plugin to monitor NFS server traffic
#
# $Log: nfsd.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.
#
#
#
#%# family=auto
#%# capabilities=autoconf
getnames () {
/usr/bin/nfsstat -s | awk '
/RPC Counts/ { coll = 1; next; }
/Server Errors/ { exit 0; }
/[a-z]/ && coll {
for (n = 1; n <= NF; n++) {
print $n
}
}
'
}
if [ "$1" = "autoconf" ]; then
if [ -x /usr/bin/nfsstat ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title NFS Server'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel requests / ${graph_period}'
echo 'graph_total total'
echo 'graph_category NFS'
for a in `getnames` ; do
echo "$a.label $a"
echo "$a.type DERIVE"
echo "$a.min 0"
done
exit 0
fi
/usr/bin/nfsstat -s | awk '
/RPC Counts/ { coll=1; next; }
/Server Errors/ { exit 0; }
/[a-z]/ && coll {
for (n in names) {
names[n] = ""
}
for (n = 1; n <= NF; n++) {
names[n] = $n
}
}
/[0-9]/ && coll {
for (n = 1; n <= NF/2; n++) {
name = names[n]
values[name] = $((n - 1) * 2 + 1)
}
}
END {
for (v in values) {
print v ".value " values[v];
}
}
'

View File

@@ -0,0 +1,81 @@
#!/bin/sh
#
# Plugin to monitor the number of open files in the system.
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log: open_files.in,v $
# Revision 1.2 2008/10/15 13:13:09 he
# Convert from using an input-less awk job (how did that ever work?)
# to using shell arithmetic, which should be more light-weight and should
# not pose a danger of hanging.
#
# 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 (Used by munin-config and some installation scripts.
# Optional):
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /usr/sbin/pstat ]; then
/usr/sbin/pstat -T | grep files > /dev/null
if [ $? = "0" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
else
echo no
exit 1
fi
fi
eval `/usr/sbin/pstat -T | awk '/files/ {
split($1, a, "/");
print "filemax=" a[2];
print "openfiles=" a[1];
}'`
if [ "$1" = "config" ]; then
echo 'graph_title File table usage'
echo 'graph_args --base 1000 -l 0'
echo 'graph_vlabel number of open files'
echo 'graph_category system'
echo 'graph_info This graph monitors the Linux open files table.'
echo 'used.label open files'
echo 'used.info The number of currently open files.'
echo 'max.label max open files'
echo 'max.info The maximum supported number of open files.'
echo "used.warning $(($filemax * 92/100))"
echo "used.critical $(($filemax * 98/100))"
exit 0
fi
echo 'max.value ' $filemax
echo 'used.value ' $openfiles

View File

@@ -0,0 +1,52 @@
#!/bin/sh
#
# Plugin to monitor the number of processes on the machine. Much like
# doing a "ps | wc -l".
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log: processes.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 - used by munin-config and som installation
# scripts):
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
echo yes
exit 0
fi
if [ "$1" = "config" ]; then
echo 'graph_title Number of Processes'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel number of processes'
echo 'graph_category processes'
echo 'graph_info This graph shows the number of processes in the system.'
echo 'processes.label processes'
echo 'processes.info The current number of processes.'
echo 'processes.draw LINE2'
exit 0
fi
echo -n "processes.value "
ps ax | wc -l

View File

@@ -0,0 +1,144 @@
#!/bin/sh
#
# Plugin to monitor various environment sensors provided by envstat(8)
# on NetBSD
#
# Requirements:
# - envsys(4) driver configured and supported hardware present
# - envstat(8) program present
#
# Parameters supported:
#
# config
# autoconf
# suggest
#
# $Log: sensors_.in,v $
# Revision 1.2 2006/07/21 23:28:37 abs
# Use PKG_SYSCONFSUBDIR so PKG_SYSCONFBASE can be set
# Use REPLACE_PERL on all plugins
# Adjust sensors_ to work with NetBSD 3
# Bump PKGREVISION
#
# 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.
#
#
#
#%# family=auto
#%# capabilities="autoconf suggest"
if [ "$1" = "autoconf" ]; then
if [ -x /usr/sbin/envstat ]; then
if /usr/sbin/envstat -r >/dev/null 2>&1; then
echo yes
exit 0
else
echo no '(no sensors available via envstat(8))'
exit 1
fi
else
echo no '(/usr/sbin/envstat not executable)'
exit 1
fi
fi
if [ "$1" = "suggest" ]; then
/usr/sbin/envstat -r | awk '
/degC$/ { temp=1; }
/RPM$/ { fans=1; }
/V$/ { volt=1; }
END {
if (temp) {
print "temp";
}
if (fans) {
print "fans";
}
if (volt) {
print "volt";
}
}'
exit 0
fi
envstat_config()
{
/usr/sbin/envstat -r | awk -v "lookfor=$1" -F: '
BEGIN { p=0 }
match($0, lookfor "$") {
l=$1
gsub("[^A-Za-z0-9\\-]", "", $1);
print tolower(lookfor) "_" tolower($1) ".label " l;
p=1;
}
END {
if (!p) {
exit 1;
}
}'
if [ $? != 0 ]; then
echo "No $1 sensors found" >&2
exit 1
fi
}
envstat_value()
{
/usr/sbin/envstat -r | awk -v "lookfor=$1" -F: '
match($0, lookfor "$") {
gsub("[^A-Za-z0-9\\-]", "", $1);
sub(" *", "", $2);
sub(" .*", "", $2);
print tolower(lookfor) "_" tolower($1) ".value " $2;
}
'
}
if [ "$1" = "config" ]; then
case $0 in
*sensors_temp)
echo 'graph_title Temperatures'
echo 'graph_vtitle deg Celcius'
echo 'graph_args --base 1000 -l 0'
envstat_config degC
;;
*sensors_fans)
echo 'graph_title Fans'
echo 'graph_vtitle RPM'
echo 'graph_args --base 1000 -l 0'
envstat_config RPM
;;
*sensors_volt)
echo 'graph_title Voltages'
echo 'graph_vtitle Volt'
echo 'graph_args --base 1000 --logarithmic'
envstat_config V
;;
esac
echo 'graph_category sensors'
exit 0
fi
case $0 in
*sensors_temp)
envstat_value degC
;;
*sensors_fans)
envstat_value RPM
;;
*sensors_volt)
envstat_value V
;;
esac

View File

@@ -0,0 +1,74 @@
#!/bin/sh
#
# Plugin to monitor swap IO in number of blocks per second.
#
# Parameters:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log: swap.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.
#
#
#
#
# Magic markers (used by munin-config and some installation scripts (i.e.
# optional)):
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /usr/bin/vmstat ]; then
/usr/bin/vmstat -s | grep 'swap ins' > /dev/null
if [ $? = "0" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Swap in/out'
echo 'graph_args -l 0 --base 1000'
echo 'graph_vlabel pages per ${graph_period} in (-) / out (+)'
echo 'graph_category system'
echo 'graph_info This graph shows the swap activity of the system.'
echo 'swap_in.label swap'
echo 'swap_in.type DERIVE'
echo 'swap_in.min 0'
echo 'swap_in.max 100000'
echo 'swap_in.graph no'
echo 'swap_out.label swap'
echo 'swap_out.type DERIVE'
echo 'swap_out.min 0'
echo 'swap_out.max 100000'
echo 'swap_out.negative swap_in'
exit 0
fi
vmstat -s | awk '
/swap ins$/ { print "swap_in.value " $1; }
/swap outs$/ { print "swap_out.value " $1; }
'

View File

@@ -0,0 +1,53 @@
#! /bin/sh
#
# Plugin to monitor swap usage.
#
# Parameters:
#
# config (required)
# autoconf (optional - only used by munin-config)
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /sbin/sysctl ]; then
if /sbin/sysctl hw.pagesize > /dev/null 2>&1; then
echo yes
exit 0
else
echo no
exit 1
fi
else
echo no
exit 1
fi
fi
PAGESIZE=`/sbin/sysctl -n hw.pagesize`
if [ "$1" = "config" ]; then
echo 'graph_args --base 1024 -l 0 --vertical-label Bytes'
echo 'graph_title Swap usage'
echo 'graph_category system'
echo 'graph_info This graph shows how the machine uses its swap.'
echo 'graph_order size used'
echo 'size.label swap size'
echo 'size.draw AREA'
echo 'used.label swap used'
echo 'used.draw AREA'
exit 0
fi
vmstat -s | awk -v bpp=$PAGESIZE '
/swap pages in use$/ { print "used.value " $1 * bpp; }
/swap pages$/ { print "size.value " $1 * bpp; }
'

View File

@@ -0,0 +1,63 @@
#!/bin/sh
#
# Plugin to measure uptime. Especially the average and max values on the
# bigger graphs (yearly) can be interesting.
#
# $Log: uptime.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.
#
#
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /sbin/sysctl ]; then
if /sbin/sysctl kern.boottime >/dev/null 2>&1; then
if [ -x /bin/date ]; then
echo yes
exit 0
else
echo no '(no /bin/date)'
exit 1
fi
else
echo no '(sysctl kern.boottime failed)' 2>&1
exit 1
fi
else
echo no '(no /sbin/sysctl)'
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Uptime'
echo 'graph_args --base 1000 -l 0 '
echo 'graph_vlabel uptime in days'
echo 'uptime.label uptime'
echo 'uptime.draw AREA'
exit 0
fi
boottime=`/sbin/sysctl -n kern.boottime`
now=`/bin/date +%s`
awk -v boottime=$boottime -v now=$now </dev/null '
END {
printf "uptime.value %.2f\n", (now - boottime) / 86400;
}'

View File

@@ -0,0 +1,102 @@
#!/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