a couple of his OpenBSD-specific plugins. Munin the monitoring tool surveys all your computers and remembers what it saw. It presents all the information in graphs through a web interface. Its emphasis is on plug and play capabilities. After completing an installation a high number of monitoring plugins will be playing with no more effort. Using Munin you can easily monitor the performance of your computers, networks, SANs, applications, weather measurements and whatever comes to mind. It makes it easy to determine "what's different today" when a performance problem crops up. It makes it easy to see how you're doing capacity-wise on any resources.
72 lines
1.7 KiB
Bash
Executable File
72 lines
1.7 KiB
Bash
Executable File
#!/bin/sh
|
|
#
|
|
# $OpenBSD: if_pps_,v 1.1.1.1 2009/11/17 11:11:21 sthen Exp $
|
|
#
|
|
# Wildcard-plugin to monitor network interfaces. To monitor an
|
|
# interface, link if_<interface> to this file. E.g.
|
|
#
|
|
# ln -s ${PREFIX}/libexec/munin/plugins/if_pps_ \
|
|
# ${SYSCONFDIR}/munin/plugins/if_bge0
|
|
#
|
|
# ...will monitor bge0.
|
|
#
|
|
# Any device found in /usr/bin/netstat can be monitored.
|
|
#
|
|
# Magic markers (optional - used by munin-config and some installation
|
|
# scripts):
|
|
#
|
|
#%# family=auto
|
|
#%# capabilities=autoconf suggest
|
|
|
|
|
|
INTERFACE=`basename $0 | sed 's/^if_pps_//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 -n | sed -n -e '/^faith/d' -e '/^lo[0-9]/d' -e '/^pflog/d' -e '/<Link>/s/\** .*//p'
|
|
exit 0
|
|
else
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
if [ "$1" = "config" ]; then
|
|
echo "graph_order rpkt opkt"
|
|
echo "graph_title $INTERFACE packets"
|
|
echo 'graph_args --base 1000'
|
|
echo 'graph_vlabel packets/${graph_period} in (-) out (+)'
|
|
echo 'graph_category network'
|
|
echo "graph_info This graph shows the traffic of the $INTERFACE network interface."
|
|
echo 'rpkt.label received'
|
|
echo 'rpkt.type DERIVE'
|
|
echo 'rpkt.min 0'
|
|
echo 'rpkt.graph no'
|
|
echo 'opkt.label pps'
|
|
echo 'opkt.type DERIVE'
|
|
echo 'opkt.min 0'
|
|
echo 'opkt.negative rpkt'
|
|
echo "opkt.info Packets sent (+) and received (-)."
|
|
exit 0
|
|
fi;
|
|
|
|
/usr/bin/netstat -i -n -I $INTERFACE | awk '
|
|
/<Link>/ {
|
|
if (NF == 8) {
|
|
print "rpkt.value", $4;
|
|
print "opkt.value", $6;
|
|
} else {
|
|
print "rpkt.value", $5;
|
|
print "opkt.value", $7;
|
|
}
|
|
}'
|