Skip to content

Commit

Permalink
Allow customizing the list of monitored network interfaces (#18)
Browse files Browse the repository at this point in the history
* 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.

* Add examples for config with INTERFACE_NAMES_OVERRIDE

* Fix "parameter not set" error

./muninlite: 651: INTERFACE_NAMES_OVERRIDE: parameter not set

* Make example more portable

Co-authored-by: Kenyon Ralph <[email protected]>

* Remove example code as requested

---------

Co-authored-by: Kenyon Ralph <[email protected]>
  • Loading branch information
daald and kenyon authored Jan 13, 2025
1 parent 0d7e824 commit 1b9e7ae
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions muninlite.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# the following variables are added to the top of the assembled muninlite script
NTP_PEER="pool.ntp.org"
DF_IGNORE_FILESYSTEM_REGEX="(none|unknown|rootfs|iso9660|squashfs|udf|romfs|ramfs|debugfs|cgroup_root|devtmpfs)"

#INTERFACE_NAMES_OVERRIDE="eth0"
6 changes: 5 additions & 1 deletion muninlite.in
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down

0 comments on commit 1b9e7ae

Please sign in to comment.