mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
381101d222
Normal rate monitoring should be preformed on parent HTB classes/queues. SFQ classes are dynamically allocated (as queues fill) and given random names and this messes up charts.
66 lines
2.0 KiB
Bash
Executable File
66 lines
2.0 KiB
Bash
Executable File
#!/bin/sh
|
|
# -*- sh -*-
|
|
#
|
|
# This plugin is based on the if_ plugin.
|
|
#
|
|
# Parameters
|
|
# None
|
|
#
|
|
# Magic markers (optional - used by munin-config and some installation
|
|
# scripts):
|
|
#
|
|
#%# family=manual
|
|
#%# capabilities=autoconf suggest
|
|
|
|
|
|
DEVICE=${0##*/tc_drops_}
|
|
|
|
mytc() {
|
|
tc -s class show dev $1 | tr "\n," "| " | sed "s/ \+/ /g" | sed "s/ |/|/g" | sed "s/| /|/g" | sed "s/||/\n/g" | sed "s/|/ /g" | tr ":" "_" | grep -v -i sfq | sort -n
|
|
}
|
|
|
|
case $1 in
|
|
autoconf)
|
|
if [ -r /proc/net/dev ]; then
|
|
echo yes
|
|
exit 0
|
|
else
|
|
echo "no (/proc/net/dev not found)"
|
|
exit 1
|
|
fi
|
|
;;
|
|
suggest)
|
|
if [ -r /proc/net/dev ]; then
|
|
awk '
|
|
/^ *(eth|tap|bond|wlan|ath|ra|sw)[0-9]+:/ {
|
|
split($0, a, /: */);
|
|
gsub(/^ +/,"",a[1]);
|
|
if (($2 > 0) || ($10 > 0)) print a[1]; }' /proc/net/dev
|
|
|
|
# egrep '^ *(eth|tap|bond|wlan|ath|ra|sw)[0-9]+:' /proc/net/dev | cut -f1 -d: | sed 's/ //g'
|
|
fi
|
|
exit 0
|
|
;;
|
|
config)
|
|
|
|
echo "graph_order `mytc $DEVICE | awk '{ print $2 "_" $3 "_drops" }' | sort -n | tr "\n" " "`"
|
|
echo "graph_title $DEVICE TC traffic drops"
|
|
echo 'graph_args --base 1000'
|
|
echo 'graph_vlabel bits per ${graph_period}'
|
|
echo 'graph_category network'
|
|
echo "graph_info This graph shows the TC classes traffic drops of the $DEVICE network interface, epxressed in packets."
|
|
|
|
# mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 "_drops.label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 "_drops.type COUNTER\n" $2 "_" $3 "_" $4 "_drops.min 0\n" $2 "_" $3 "_" $4 "_drops.cdef " $2 "_" $3 "_" $4 ",8,*" }'
|
|
mytc $DEVICE | tr "_" " " | awk '{ print $2 "_" $3 "_" $4 "_drops.label " $2 "/" $3 ":" $4 "\n" $2 "_" $3 "_" $4 "_drops.type COUNTER\n" $2 "_" $3 "_" $4 "_drops.min 0" }'
|
|
exit 0
|
|
;;
|
|
esac
|
|
|
|
# the root(s)
|
|
mytc $DEVICE | grep -v " parent " | awk "{ print \$2 \"_\" \$3 \"_drops.value \" \$19}"
|
|
|
|
# the child(s)
|
|
mytc $DEVICE | grep " parent " | awk "{ print \$2 \"_\" \$3 \"_drops.value \" \$24}"
|
|
|
|
exit 0
|