1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
|
#!/bin/sh
#
# Wildcard-script to monitor network interfaces. To monitor an
# interface, link vlan_<interface> to this file. E.g.
#
# ln /usr/share/munin/node/plugins-contrib/vlan_ /etc/munin/node.d/vlan_eth0_1
#
# ...will monitor eth0.1
#
# Parameters:
#
# config
# autoconf
# suggest
#
# $Log$
# Revision 1.5 2004/12/10 10:47:49 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/11/21 00:17:12 jimmyo
# Changed a lot of plugins so they use DERIVE instead of COUNTER.
#
# Revision 1.2 2004/05/20 19:02:37 jimmyo
# Set categories on a bunch of 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:50 jimmyo
# Changed deprecated plugin options
#
# Revision 1.2 2003/11/07 17:43:16 jimmyo
# Cleanups and log entries
#
#
#
#%# family=manual
#%# capabilities=autoconf suggest
INTERFACE=`basename $0 | sed 's/^vlan_//g' | tr '_' '.'`
if [ "$1" = "autoconf" ]; then
if [ -d /proc/net/vlan -a -r /proc/net/vlan -a -x /proc/net/vlan ]
then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "suggest" ]; then
if [ -d /proc/net/vlan -a -r /proc/net/vlan -a -x /proc/net/vlan ]
then
for file in /proc/net/vlan/*
do
if [ ! "$file" = "/proc/net/vlan/config" ]
then
basename $file | tr '.' '_'
fi
done
fi
exit 0
fi
if [ "$1" = "config" ]; then
echo "graph_order received transmitted"
echo "graph_title VLAN $INTERFACE Traffic"
echo 'graph_args --base 1024'
echo 'graph_vlabel bits per ${graph_period} in (-) / out (+)'
echo 'graph_category network'
echo 'received.label bps'
echo 'received.type DERIVE'
echo 'received.min 0'
echo 'received.graph no'
echo 'received.cdef received,8,*'
echo 'received.draw AREA'
echo 'transmitted.label bps'
echo 'transmitted.type DERIVE'
echo 'transmitted.min 0'
echo 'transmitted.negative received'
echo 'transmitted.cdef transmitted,8,*'
echo 'transmitted.draw AREA'
exit 0
fi;
awk "/bytes received/ { print \"received.value \" \$4 } /bytes transmitted/ { print \"transmitted.value \" \$4 }" < /proc/net/vlan/$INTERFACE
|