mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 14:16:00 +00:00
Plugin lxc: simplify implementation of function "active_guests"
This commit is contained in:
parent
276e96c0dd
commit
46626b9953
1 changed files with 4 additions and 11 deletions
|
@ -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
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue