1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-22 14:16:00 +00:00

[network/upnpc_traffic] Show max bitrate

Deprecate bitrate mode in suggest, but keep support for it so as not to
break existing installations.

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
Olivier Mehani 2019-09-25 22:17:54 +10:00 committed by Lars Kruse
parent 5382722fdb
commit 3212af2eed

View file

@ -20,7 +20,11 @@ Linux systems with upnpc installed (miniupnpc package).
=head1 CONFIGURATION =head1 CONFIGURATION
None needed. If you do not want to show the link maximum bitrates, add the following
plugin-configuration:
[upnpc*]
env.traffic_remove_max true
=head1 AUTHOR =head1 AUTHOR
@ -54,7 +58,6 @@ DATA="$(upnpc -s)"
SUPPORTED_MODES=$( SUPPORTED_MODES=$(
echo "${DATA}" | sed -n " \ echo "${DATA}" | sed -n " \
s/.*Bytes.*/traffic/p; \ s/.*Bytes.*/traffic/p; \
s/.*MaxBitRate.*/bitrate/p; \
s/.*Packets.*/pkts/p; \ s/.*Packets.*/pkts/p; \
s/.*uptime=.*/uptime/p; \ s/.*uptime=.*/uptime/p; \
") ")
@ -85,7 +88,7 @@ EOF
;; ;;
"bitrate") "bitrate")
cat << EOF cat << EOF
graph_title Uplink bitrate graph_title [DEPRECATED] Uplink bitrate
graph_args --base 1000 -l 0 graph_args --base 1000 -l 0
graph_category network graph_category network
graph_vlabel bitrate down (-) / up (+) graph_vlabel bitrate down (-) / up (+)
@ -99,15 +102,27 @@ EOF
# ${graph_period} is not a shell variable # ${graph_period} is not a shell variable
cat << 'EOF' cat << 'EOF'
graph_title Uplink traffic graph_title Uplink traffic
graph_args --base 1024 -l 0 graph_args --base 1000 -l 0
graph_category network graph_category network
graph_vlabel bytes in (-) / out (+) per ${graph_period} graph_vlabel bytes in (-) / out (+) per ${graph_period}
down.label Bps EOF
if [ "${traffic_remove_max:-false}" != 'true' ]; then
cat << EOF
maxdown.label bps (max)
maxup.label bps (max)
maxdown.graph no
maxup.negative maxdown
EOF
fi
cat << EOF
down.label bps
down.type DERIVE down.type DERIVE
down.min 0 down.min 0
up.label Bps down.cdef down,8,*
up.label bps
up.type DERIVE up.type DERIVE
up.min 0 up.min 0
up.cdef up,8,*
down.graph no down.graph no
up.negative down up.negative down
EOF EOF
@ -145,7 +160,12 @@ fetch () {
echo "${DATA}" | sed -n "s/^MaxBitRateDown : \([0-9]\+\) bps.*MaxBitRateUp \([0-9]\+\) bps.*/down.value \1\nup.value \2/p" echo "${DATA}" | sed -n "s/^MaxBitRateDown : \([0-9]\+\) bps.*MaxBitRateUp \([0-9]\+\) bps.*/down.value \1\nup.value \2/p"
;; ;;
"traffic") "traffic")
echo ${DATA} | sed -n "s/^Bytes:\s*Sent:\s*\([0-9]\+\).*Recv:\s*\([0-9]\+\).*/up.value \1\ndown.value \2/p" echo "${DATA}" | sed -n "
s/^Bytes:\s*Sent:\s*\([0-9]\+\).*Recv:\s*\([0-9]\+\).*/up.value \1\ndown.value \2/p"
if [ "${traffic_remove_max:-false}" != 'true' ]; then
echo "${DATA}" | sed -n "
s/^MaxBitRateDown : \([0-9]\+\) bps.*MaxBitRateUp \([0-9]\+\) bps.*/maxdown.value \1\nmaxup.value \2/p"
fi
;; ;;
"pkts") "pkts")
echo "${DATA}" | sed -n "s/^Packets:\s*Sent:\s*\([0-9]\+\).*Recv:\s*\([0-9]\+\).*/up.value \1\ndown.value \2/p" echo "${DATA}" | sed -n "s/^Packets:\s*Sent:\s*\([0-9]\+\).*Recv:\s*\([0-9]\+\).*/up.value \1\ndown.value \2/p"