#!/bin/sh # -*- sh -*- # # Wildcard-plugin to monitor network interfaces. To monitor an # interface, link if_ to this file. E.g. # # ln -s /usr/local/share/munin/plugins/if_ /usr/local/etc/munin/plugins/if_em0 # # ...will monitor em0 interface. # # Magic markers (optional - used by munin-config and some installation # scripts): # #%# family=auto #%# capabilities=autoconf suggest INTERFACE=${0##*if_} IFCOUNTERS="/usr/local/bin/ifcounters" if [ "$1" = "autoconf" ]; then if [ -x /sbin/ifconfig -o -x ${IFCOUNTERS} ]; then echo yes exit 0 else echo "no (${IFCOUNTERS} not found)" exit 0 fi fi if [ "$1" = "suggest" ]; then if [ -x /sbin/ifconfig ] then ifconfig -l | sed -Ee 's/[[:<:]](pfsync|faith|pf(log|sync)|lo|plip|carp|enc|fwe)[^ ]*//g' | xargs -n 1 echo 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. IMPORTANT: Since the data source for this plugin use 32bit counters, this plugin is really unreliable and unsuitable for most 100Mb (or faster) interfaces, where bursts are expected to exceed 50Mbps. This means that this plugin is unsuitable for most production environments." echo 'rbytes.label received' echo 'rbytes.type DERIVE' echo 'rbytes.graph no' echo 'rbytes.cdef rbytes,8,*' echo 'rbytes.min 0' echo 'obytes.label bps' echo 'obytes.type DERIVE' echo 'obytes.negative rbytes' echo 'obytes.cdef obytes,8,*' echo 'obytes.min 0' echo 'obytes.draw AREA' echo "obytes.info Traffic sent (+) and received (-) on the $INTERFACE network interface." exit 0 fi ${IFCOUNTERS} -b ${INTERFACE}