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

Added handling of multiple lxc.network.veth.pair-lines

This commit is contained in:
Niklas Yann Wettengel 2015-08-03 15:37:42 +02:00
parent 7f94d4d68e
commit 9cc4259f6e

View file

@ -66,14 +66,16 @@ for guest in `ls $lxcpath`; do
continue; continue;
fi fi
if [ -f "$lxcpath/$guest/config" ]; then if [ -f "$lxcpath/$guest/config" ]; then
device=`grep '^lxc\.network\.veth\.pair[ \t]*=[ \t]*' $lxcpath/$guest/config | \ devices=`grep '^lxc\.network\.veth\.pair[ \t]*=[ \t]*' $lxcpath/$guest/config | \
awk '{ split($0, a, /=/); gsub(/[ \t]/, "", a[2]); print a[2]; }'` awk '{ split($0, a, /=/); gsub(/[ \t]/, "", a[2]); print a[2]; }'`
if [ -n "$device" ]; then if [ -n "$devices" ]; then
device_re=`echo $device | sed -e 's/\./\\\\./g'` for device in $devices; do
if [ `grep -c "^ *$device_re:" /proc/net/dev` -eq 1 ]; then device_re=`echo $device | sed -e 's/\./\\\\./g'`
actives="$actives $guest" if [ `grep -c "^ *$device_re:" /proc/net/dev` -eq 1 ]; then
eval "dev_$(clean_fieldname $guest)=$device" actives="$actives $guest"
fi eval "dev_$(clean_fieldname $guest)=$device"
fi
done
fi fi
fi fi
done done