mirror of
https://github.com/munin-monitoring/muninlite.git
synced 2024-11-16 16:48:33 +01:00
e6f5722a04
Nowadays network interfaces have names like docker0, team0, ip_vti0, eno, wlp61s0 and so on. Including word "Interface" in beginning of graph_title groups these graphs together in web interface, not randomly before/after other network-graphs (ipconntrack, firewall, ...). See commit 70711831c44 in munin repository for similar change.
32 lines
1.5 KiB
Text
32 lines
1.5 KiB
Text
config_if() {
|
|
INTERFACE=$1
|
|
echo "graph_order down up"
|
|
echo "graph_title Interface $INTERFACE 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 [ -n "$(which ethtool)" ] && [ -x "$(which ethtool)" ]; then
|
|
MAX_MBPS=$(ethtool "$INTERFACE" 2>/dev/null | grep "Speed: [0-9]\+Mb/s$" | sed 's/[^0-9]//g')
|
|
if [ -n "$MAX_MBPS" ]; then
|
|
echo "up.max $((MAX_MBPS * 1024 * 1024))"
|
|
echo "down.max $((MAX_MBPS * 1024 * 1024))"
|
|
fi
|
|
fi
|
|
}
|
|
fetch_if() {
|
|
INTERFACE=$1
|
|
IINFO=$(grep "^ *$INTERFACE:" /proc/net/dev | cut -d ":" -f 2 | sed -e 's/ */ /g' -e 's/^[ \t]*//')
|
|
echo "down.value" "$(echo "$IINFO" | cut -d " " -f 1)"
|
|
echo "up.value" "$(echo "$IINFO" | cut -d " " -f 9)"
|
|
}
|