1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

lxc_guests: Monitor randomly generated virtual ethernet devices

This commit is contained in:
Sebastian L 2020-11-18 15:28:24 +01:00 committed by Lars Kruse
parent b5f957268f
commit 137913e39d

View file

@ -38,13 +38,6 @@ This plugin has been tested with lxc 3 and
lx2 (on Debian buster and Debian jessie,
respectively).
For the network graphs to work, you need
to have in every container's config file
a line defining the virtual network interface
path (else lxc will use a random name at
each container's start); see the lxc_netdev()
function below.
If using lxc 2, make sure you do not have cruft
in your container config files, you can test
it with:
@ -116,18 +109,6 @@ get_lxc_cgroup_info() {
}
lxc_netdev() {
local guest_name="$1"
if [ -f "$lxcpath/$guest_name/config" ]; then
# lxc 3 vs < 3
(grep -E '^lxc.net.0.veth.pair' "$lxcpath/$guest_name/config" 2>/dev/null \
|| grep -E '^lxc.network.veth.pair' "$lxcpath/$guest_name/config"
) | awk '{print $NF;}'
fi
}
# find proper sysfs and count it
# Debian 6.0: /sys/fs/cgroup/<container>/tasks
# Ubuntu 12.04 with fstab: /sys/fs/cgroup/lxc/<container>/tasks
@ -259,7 +240,7 @@ EOF
for guest_name in $active_guests
do
device=$(lxc_netdev "$guest_name")
device=$(lxc-info -n "$guest_name" | grep Link | sed 's/Link:\ \+//g')
if [ -z "$device" ]; then
continue
fi
@ -362,7 +343,7 @@ do_fetch() {
echo "multigraph lxc_net"
for guest_name in $active_guests
do
device=$(lxc_netdev "$guest_name")
device=$(lxc-info -n "$guest_name" | grep Link | sed 's/Link:\ \+//g')
if [ -z "$device" ]; then
value_up="U"
value_down="U"