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

Plugin lxc: clarify variable names used in functions

This commit is contained in:
Lars Kruse 2019-08-12 00:49:27 +02:00
parent da8a74fdcb
commit 9cdea3c305

View file

@ -95,21 +95,21 @@ cgrouppath=${cgrouppath:-}
# --- FUNCTIONS # --- FUNCTIONS
function active_guests { function active_guests {
local g active i ok local guest_name active i ok
for g in $(lxc-ls | sort -u) for guest_name in $(lxc-ls | sort -u)
do do
# handle optional exclude list in $1 # handle optional exclude list in $1
ok=1 ok=1
for i in $1 for i in $1
do do
if [ "$i" = "$g" ]; then if [ "$i" = "$guest_name" ]; then
ok=0 ok=0
fi fi
done done
if [ "$ok" = 1 ]; then if [ "$ok" = 1 ]; then
if lxc-info -n "$g" 2>&1 | grep -qs RUNNING; then if lxc-info -n "$guest_name" 2>&1 | grep -qs RUNNING; then
active="$active $g" active="$active $guest_name"
fi fi
fi fi
done done
@ -125,12 +125,12 @@ function lxc_cgroup {
function lxc_netdev { function lxc_netdev {
local g=$1 dev local guest_name="$1"
if [ -f "$lxcpath/$g/config" ]; then if [ -f "$lxcpath/$guest_name/config" ]; then
# lxc 3 vs < 3 # lxc 3 vs < 3
(egrep '^lxc.net.0.veth.pair' "$lxcpath/$g/config" 2>/dev/null \ (egrep '^lxc.net.0.veth.pair' "$lxcpath/$guest_name/config" 2>/dev/null \
|| egrep '^lxc.network.veth.pair' "$lxcpath/$g/config" || egrep '^lxc.network.veth.pair' "$lxcpath/$guest_name/config"
) | awk '{print $NF;}' ) | awk '{print $NF;}'
fi fi
} }