Révision 01edaf00
[network/upnpc] Add hostname in graph titles
Signed-off-by: Olivier Mehani <shtrom@ssji.net>
| plugins/network/upnpc_ | ||
|---|---|---|
| 62 | 62 |
s/.*Packets.*/pkts/p; \ |
| 63 | 63 |
s/.*uptime=.*/uptime/p; \ |
| 64 | 64 |
") |
| 65 |
HOST=$(echo "${DATA}" | sed -n "s#.*desc: http://\([^/:]\+\).*#\1#p")
|
|
| 65 | 66 |
|
| 66 | 67 |
autoconf() {
|
| 67 | 68 |
test -n "${DATA}" && echo yes || echo "no (No UPnP router detected)"
|
| ... | ... | |
| 79 | 80 |
case ${1} in
|
| 80 | 81 |
"uptime") |
| 81 | 82 |
cat << EOF |
| 82 |
graph_title Uplink connection uptime |
|
| 83 |
graph_title Uplink connection uptime (${HOST})
|
|
| 83 | 84 |
graph_args -l 0 |
| 84 | 85 |
graph_category network |
| 85 | 86 |
graph_scale no |
| ... | ... | |
| 91 | 92 |
;; |
| 92 | 93 |
"bitrate") |
| 93 | 94 |
cat << EOF |
| 94 |
graph_title [DEPRECATED] Uplink bitrate |
|
| 95 |
graph_title [DEPRECATED] Uplink bitrate (${HOST})
|
|
| 95 | 96 |
graph_args --base 1000 -l 0 |
| 96 | 97 |
graph_category network |
| 97 | 98 |
graph_vlabel bitrate down (-) / up (+) |
| ... | ... | |
| 102 | 103 |
EOF |
| 103 | 104 |
;; |
| 104 | 105 |
"traffic") |
| 105 |
# ${graph_period} is not a shell variable
|
|
| 106 |
cat << 'EOF' |
|
| 107 |
graph_title Uplink traffic |
|
| 106 |
cat << EOF |
|
| 107 |
graph_title Uplink traffic (${HOST})
|
|
| 108 | 108 |
graph_args --base 1000 -l 0 |
| 109 | 109 |
graph_category network |
| 110 |
graph_vlabel bytes in (-) / out (+) per ${graph_period}
|
|
| 111 | 110 |
EOF |
| 112 | 111 |
if [ "${traffic_remove_max:-false}" != 'true' ]; then
|
| 113 | 112 |
cat << EOF |
| ... | ... | |
| 132 | 131 |
;; |
| 133 | 132 |
"pkts") |
| 134 | 133 |
# ${graph_period} is not a shell variable
|
| 135 |
cat << 'EOF'
|
|
| 136 |
graph_title Uplink packets |
|
| 134 |
cat << EOF
|
|
| 135 |
graph_title Uplink packets (${HOST})
|
|
| 137 | 136 |
graph_args --base 1000 -l 0 |
| 138 | 137 |
graph_category network |
| 139 |
graph_vlabel packets in (-) / out (+) per ${graph_period}
|
|
| 138 |
EOF |
|
| 139 |
# ${graph_period} is not a shell variable
|
|
| 140 |
# shellcheck disable=SC2016 |
|
| 141 |
echo 'graph_vlabel packets in (-) / out (+) per ${graph_period}'
|
|
| 142 |
cat << EOF |
|
| 140 | 143 |
down.label pps |
| 141 | 144 |
down.type DERIVE |
| 142 | 145 |
down.min 0 |
Formats disponibles : Unified diff