muninlite/plugins/if_
runesk 2f8d3ffd06 SF#1736919
Changed type to DERIVE and added min values to 0. Added check for
ethtool to check if max value could be calculated


git-svn-id: svn://svn.code.sf.net/p/muninlite/code/muninlite@11 35caa317-6b62-4e8a-81c0-b04f0c356266
2007-06-15 12:07:51 +00:00

28 lines
1.3 KiB
Text

config_if() {
echo "graph_order down up"
echo "graph_title $1 traffic"
echo "graph_args --base 1000"
echo "graph_vlabel bits in (-) / out (+) per \${graph_period}"
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 usuitable for most production environments. To avoid this problem, use the ip_ plugin instead."
echo "down.label received"
echo "down.type DERIVE"
echo "down.min 0"
echo "down.graph no"
echo "down.cdef down,8,*"
echo "up.label bps"
echo "up.type DERIVE"
echo "up.min 0"
echo "up.negative down"
echo "up.cdef up,8,*"
if ethtool $1 >/dev/null 2>&1; then
MAX=$(($(ethtool $1 | grep Speed | sed -e 's/[[:space:]]\{1,\}/ /g' -e 's/^ //' -e 's/M.*//' | cut -d\ -f2) * 1000000))
echo "up.max $MAX"
echo "down.max $MAX"
fi
}
fetch_if() {
IINFO=$(grep "$1:" /proc/net/dev | cut -d: -f2 | sed -e 's/ / /g')
echo "down.value" $(echo $IINFO | cut -d\ -f1)
echo "up.value" $(echo $IINFO | cut -d\ -f9)
}