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

[network/upnpc] Add hostname in graph titles

Signed-off-by: Olivier Mehani <shtrom@ssji.net>
This commit is contained in:
Olivier Mehani 2019-09-25 22:35:14 +10:00 committed by Lars Kruse
parent 076545b5f6
commit 01edaf0086

View file

@ -62,6 +62,7 @@ SUPPORTED_MODES=$(
s/.*Packets.*/pkts/p; \ s/.*Packets.*/pkts/p; \
s/.*uptime=.*/uptime/p; \ s/.*uptime=.*/uptime/p; \
") ")
HOST=$(echo "${DATA}" | sed -n "s#.*desc: http://\([^/:]\+\).*#\1#p")
autoconf() { autoconf() {
test -n "${DATA}" && echo yes || echo "no (No UPnP router detected)" test -n "${DATA}" && echo yes || echo "no (No UPnP router detected)"
@ -79,7 +80,7 @@ config () {
case ${1} in case ${1} in
"uptime") "uptime")
cat << EOF cat << EOF
graph_title Uplink connection uptime graph_title Uplink connection uptime (${HOST})
graph_args -l 0 graph_args -l 0
graph_category network graph_category network
graph_scale no graph_scale no
@ -91,7 +92,7 @@ EOF
;; ;;
"bitrate") "bitrate")
cat << EOF cat << EOF
graph_title [DEPRECATED] Uplink bitrate graph_title [DEPRECATED] Uplink bitrate (${HOST})
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 (+)
@ -102,12 +103,10 @@ up.negative down
EOF EOF
;; ;;
"traffic") "traffic")
# ${graph_period} is not a shell variable cat << EOF
cat << 'EOF' graph_title Uplink traffic (${HOST})
graph_title Uplink traffic
graph_args --base 1000 -l 0 graph_args --base 1000 -l 0
graph_category network graph_category network
graph_vlabel bytes in (-) / out (+) per ${graph_period}
EOF EOF
if [ "${traffic_remove_max:-false}" != 'true' ]; then if [ "${traffic_remove_max:-false}" != 'true' ]; then
cat << EOF cat << EOF
@ -132,11 +131,15 @@ EOF
;; ;;
"pkts") "pkts")
# ${graph_period} is not a shell variable # ${graph_period} is not a shell variable
cat << 'EOF' cat << EOF
graph_title Uplink packets graph_title Uplink packets (${HOST})
graph_args --base 1000 -l 0 graph_args --base 1000 -l 0
graph_category network graph_category network
graph_vlabel packets in (-) / out (+) per ${graph_period} EOF
# ${graph_period} is not a shell variable
# shellcheck disable=SC2016
echo 'graph_vlabel packets in (-) / out (+) per ${graph_period}'
cat << EOF
down.label pps down.label pps
down.type DERIVE down.type DERIVE
down.min 0 down.min 0