Allow customizing the list of monitored network interfaces

This is a simple way to customize the selection of network interfaces. If INTERFACE_NAMES_OVERRIDE is set in muninlite.conf, that list is used instead of auto-detection. As muninlite.conf
itself is also a script, it is even possible to write a custom command.
This feature is helpful in environments with virtual machines or containers, like docker or lxc where there are lots of br-*, veth*, lxcbr* etc interfaces where monitoring doesn't make much
sense. I didn't find a way to reliably filter physical interfaces.
This commit is contained in:
Daniel Alder 2023-12-13 15:16:20 +01:00
parent a2f1745477
commit c14b6ccaec
1 changed files with 5 additions and 1 deletions

View File

@ -78,7 +78,11 @@ RES=""
for PLUG in $PLUGINS; do
case "$PLUG" in
if_|if_err_)
interface_names=$(sed 's/^ *//; s/:.*$//; / /d; /^lo$/d' /proc/net/dev)
if [ -z "$INTERFACE_NAMES_OVERRIDE" ]; then
interface_names=$(sed 's/^ *//; s/:.*$//; / /d; /^lo$/d' /proc/net/dev)
else
interface_names="$INTERFACE_NAMES_OVERRIDE"
fi
for INTER in $interface_names; do
INTERRES=$(echo "$INTER" | sed -e 's/\./VLAN/' -e 's/\-/_/g')
RES="$RES ${PLUG}${INTERRES}"