|
Server : Apache/2.2.2 (Fedora) System : Linux App1.pathumtani.go.th 2.6.20-1.2320.fc5smp #1 SMP Tue Jun 12 19:40:16 EDT 2007 i686 User : apache ( 48) PHP Version : 5.2.9 Disable Function : NONE Directory : /usr/local/src/munin-1.2.6/node/node.d.sunos/ |
Upload File : |
#!/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/plugins/if_ /etc/munin/node.d/if_eth0
#
# ...will monitor eth0.
#
# Any device found in /usr/bin/kstat can be monitored.
#
# $Log$
# Revision 1.5 2004/12/10 10:47:50 jimmyo
# Change name from ${scale} to ${graph_period}, to be more consistent.
#
# Revision 1.4 2004/12/09 22:12:56 jimmyo
# Added "graph_period" option, to make "graph_sums" usable.
#
# Revision 1.3 2004/05/20 19:02:38 jimmyo
# Set categories on a bunch of plugins
#
# Revision 1.2 2004/04/30 16:43:00 jimmyo
# Cleaned up Solaris 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/11/07 22:12:51 jimmyo
# Changed deprecated plugin options
#
# Revision 1.2 2003/11/07 17:43:16 jimmyo
# Cleanups and log entries
#
#
#
# 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/kstat ]; then
echo yes
exit 0
else
echo "no (/usr/bin/kstat not found)"
exit 1
fi
fi
if [ "$1" = "suggest" ]; then
if [ -x /usr/bin/kstat ]; then
kstat -p -s '/^rbytes$/' | awk -F: '{ print $3 }'
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 'rbytes.label received'
echo 'rbytes.type COUNTER'
echo 'rbytes.max 2000000000'
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.max 2000000000'
exit 0
fi;
kstat -p -n $INTERFACE -s '/^[ro]bytes$/' | awk -F: '
{
split($4, four, "\t")
print four[1] ".value", four[2]
}'