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

Plugin lxc: simplify implementation of function "active_guests"

This commit is contained in:
Lars Kruse 2019-08-12 01:08:22 +02:00
parent 276e96c0dd
commit 46626b9953

View file

@ -95,20 +95,13 @@ cgrouppath=${cgrouppath:-}
# --- FUNCTIONS # --- FUNCTIONS
function active_guests { function active_guests {
local guest_name i ok local excludes="$1"
local guest_name
for guest_name in $(lxc-ls) for guest_name in $(lxc-ls)
do do
# handle optional exclude list in $1 # handle optional exclude list in $1
ok=1 if ! echo "$excludes" | grep -qwF "$guest_name"; then
for i in $1 if lxc-info -n "$guest_name" --state 2>/dev/null | grep -qw RUNNING; then
do
if [ "$i" = "$guest_name" ]; then
ok=0
fi
done
if [ "$ok" = 1 ]; then
if lxc-info -n "$guest_name" 2>&1 | grep -qs RUNNING; then
echo "$guest_name" echo "$guest_name"
fi fi
fi fi