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

Plugin lxc: unify whitespace

This commit is contained in:
Lars Kruse 2019-08-11 23:31:16 +02:00
parent c0fe6dc3c7
commit 6696a4d894

View file

@ -110,11 +110,13 @@ function active_guests {
echo $active echo $active
} }
function lxc_cgroup { function lxc_cgroup {
# lxc3 (lxc < 3: may output some warnings if there is cruft in your config dir) # lxc3 (lxc < 3: may output some warnings if there is cruft in your config dir)
lxc-cgroup -o /dev/stdout -l INFO $* | sed 's/^.*lxc_cgroup.c:main:[0-9][0-9]* - //' lxc-cgroup -o /dev/stdout -l INFO $* | sed 's/^.*lxc_cgroup.c:main:[0-9][0-9]* - //'
} }
function lxc_netdev { function lxc_netdev {
local g=$1 dev local g=$1 dev
@ -128,6 +130,7 @@ function lxc_netdev {
fi fi
} }
# find proper sysfs and count it # find proper sysfs and count it
# Debian 6.0: /sys/fs/cgroup/<container>/tasks # Debian 6.0: /sys/fs/cgroup/<container>/tasks
# Ubuntu 12.04 with fstab: /sys/fs/cgroup/lxc/<container>/tasks # Ubuntu 12.04 with fstab: /sys/fs/cgroup/lxc/<container>/tasks
@ -166,6 +169,7 @@ lxc_count_processes () {
return 0 return 0
} }
# --- BASIC DEFINES # --- BASIC DEFINES
active_guests=$(active_guests $exclude) active_guests=$(active_guests $exclude)
@ -218,7 +222,7 @@ graph_category lxc
EOF EOF
for n in $active_guests for n in $active_guests
do do
cat <<EOF cat <<EOF
$(clean_fieldname "cpu_time__${n}").label $n: CPU time $(clean_fieldname "cpu_time__${n}").label $n: CPU time
$(clean_fieldname "cpu_time__${n}").type DERIVE $(clean_fieldname "cpu_time__${n}").type DERIVE
@ -275,7 +279,7 @@ $(clean_fieldname "net__${n}_up").cdef $(clean_fieldname "net__${n}_up"),8,*
$(clean_fieldname "net__${n}_up").min 0 $(clean_fieldname "net__${n}_up").min 0
$(clean_fieldname "net__${n}_up").max $bps $(clean_fieldname "net__${n}_up").max $bps
EOF EOF
done done
cat <<EOF cat <<EOF
@ -286,7 +290,7 @@ graph_vlabel Number of processes
graph_category lxc graph_category lxc
EOF EOF
for n in $active_guests for n in $active_guests
do do
cat <<EOF cat <<EOF
$(clean_fieldname "lxc_proc__${n}").label $n: processes $(clean_fieldname "lxc_proc__${n}").label $n: processes
$(clean_fieldname "lxc_proc__${n}").type GAUGE $(clean_fieldname "lxc_proc__${n}").type GAUGE
@ -330,9 +334,9 @@ fi
echo "multigraph lxc_cpu" echo "multigraph lxc_cpu"
for n in $active_guests for n in $active_guests
do do
for i in user system for i in user system
do do
echo $(clean_fieldname "cpu_${i}__${n}").value $(lxc_cgroup -n "$n" cpuacct.stat | grep $i | awk '{ print $2; }') echo $(clean_fieldname "cpu_${i}__${n}").value $(lxc_cgroup -n "$n" cpuacct.stat | grep $i | awk '{ print $2; }')
done done
done done
@ -345,7 +349,7 @@ done
echo "multigraph lxc_logins" echo "multigraph lxc_logins"
for n in $active_guests for n in $active_guests
do do
echo $(clean_fieldname "logins__${n}").value $(lxc-attach -n "$n" users | wc -w | bc) echo $(clean_fieldname "logins__${n}").value $(lxc-attach -n "$n" users | wc -w | bc)
done done