mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +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
|
||||
|
||||
function active_guests {
|
||||
local guest_name i ok
|
||||
local excludes="$1"
|
||||
local guest_name
|
||||
for guest_name in $(lxc-ls)
|
||||
do
|
||||
# handle optional exclude list in $1
|
||||
ok=1
|
||||
for i in $1
|
||||
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
|
||||
if ! echo "$excludes" | grep -qwF "$guest_name"; then
|
||||
if lxc-info -n "$guest_name" --state 2>/dev/null | grep -qw RUNNING; then
|
||||
echo "$guest_name"
|
||||
fi
|
||||
fi
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue