|
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/ |
Upload File : |
#!/bin/sh
#
# Skeleton-plugin to monitor ipac-ng rules. To monitor an
# rule, copy ipac-ng and edit variables.
#
# $Log$
# Revision 1.2 2004/06/28 12:08:54 jimmyo
# Plugin bugfixes from Jacques Caruso, in linux/iostat_ios and generic/ipacng.
#
# Revision 1.1 2004/05/06 22:42:35 jimmyo
# Added plugin ipac-ng, contributed by Arturas Slajus.
#
#
# Magic markers (optional - used by munin-config and some installation
# scripts):
#
#%# family=contrib
#%# capabilities=autoconf
# Visible name of graph
TITLE="traffic"
# perlre(1) expressions passed to ipacsum -f. For more info
# `man ipacsum`, `man perlre`.
UP="upload rule"
DOWN="download rule"
if [ "$1" = "autoconf" ]; then
if [ -x /usr/sbin/fetchipac ] && [ -x /usr/sbin/ipacsum ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo "graph_order down up"
echo "graph_title $TITLE"
echo 'graph_args --base 1000'
echo 'graph_vlabel b/s in (-) / out (+)'
echo 'down.label received'
echo 'down.graph no'
# Divide it by 1500 seconds (5m), to get b/s
echo 'down.cdef down,1500,/'
echo 'up.label b/s'
echo 'up.negative down'
echo 'up.cdef up,1500,/'
exit 0
fi;
fetchipac || error=1
if [ "$error" != "1" ]; then
ipacsum -s 5m -x -f "$UP" | tail -n 1 | cut -d : -f 2 | awk \
{'print "up.value " $1'}
ipacsum -s 5m -x -f "$DOWN" | tail -n 1 | cut -d : -f 2 | awk \
{'print "down.value " $1'}
else
echo 'up.value 0'
echo 'down.value 0'
fi