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

[network/upnpc_] Add multigraph support

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

View file

@ -8,7 +8,8 @@
upnpc_ - Plugin to monitor routers via UPnP upnpc_ - Plugin to monitor routers via UPnP
This plugin uses the upnpc utility (package miniupnpc in Debian), to monitor an This plugin uses the upnpc utility (package miniupnpc in Debian), to monitor an
router using UPnP. It can monitor the following aspects, and plot them as separate graphs: router using UPnP. It can monitor the following aspects, and plot them as
separate graphs, or a single multigraph (if linked at upnpc or upnpc_multi:
* uptime: how long the link has been up; * uptime: how long the link has been up;
* bitrate: the up and downlink bitrate (e.g., sync speed for DSL); * bitrate: the up and downlink bitrate (e.g., sync speed for DSL);
* traffic: the actual up and downstream traffic rate; * traffic: the actual up and downstream traffic rate;
@ -66,10 +67,12 @@ autoconf() {
test -n "${DATA}" && echo yes || echo "no (No UPnP router detected)" test -n "${DATA}" && echo yes || echo "no (No UPnP router detected)"
} }
suggest () { suggest () {
for mode in ${SUPPORTED_MODES}; do for mode in ${SUPPORTED_MODES}; do
echo "${mode}" echo "${mode}"
done done
echo "multi"
} }
config () { config () {
@ -144,6 +147,14 @@ down.graph no
up.negative down up.negative down
EOF EOF
;; ;;
"multi"|"upnpc")
echo "multigraph ${PLUGIN_NAME}"
config "traffic"
for mode in ${SUPPORTED_MODES}; do
echo "multigraph ${PLUGIN_NAME}.${mode}"
config "${mode}"
done
;;
*) *)
echo "unknown mode '${1}'" >&2 echo "unknown mode '${1}'" >&2
exit 1 exit 1
@ -170,6 +181,14 @@ fetch () {
"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"
;; ;;
"multi"|"upnpc")
echo "multigraph ${PLUGIN_NAME}"
fetch "traffic"
for mode in ${SUPPORTED_MODES}; do
echo "multigraph ${PLUGIN_NAME}.${mode}"
fetch "${mode}"
done
;;
*) *)
echo "unknown mode '${1}'" >&2 echo "unknown mode '${1}'" >&2
exit 1 exit 1