mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
lxc_guests: Monitor randomly generated virtual ethernet devices
This commit is contained in:
parent
b5f957268f
commit
137913e39d
1 changed files with 2 additions and 21 deletions
|
@ -38,13 +38,6 @@ This plugin has been tested with lxc 3 and
|
||||||
lx2 (on Debian buster and Debian jessie,
|
lx2 (on Debian buster and Debian jessie,
|
||||||
respectively).
|
respectively).
|
||||||
|
|
||||||
For the network graphs to work, you need
|
|
||||||
to have in every container's config file
|
|
||||||
a line defining the virtual network interface
|
|
||||||
path (else lxc will use a random name at
|
|
||||||
each container's start); see the lxc_netdev()
|
|
||||||
function below.
|
|
||||||
|
|
||||||
If using lxc 2, make sure you do not have cruft
|
If using lxc 2, make sure you do not have cruft
|
||||||
in your container config files, you can test
|
in your container config files, you can test
|
||||||
it with:
|
it with:
|
||||||
|
@ -116,18 +109,6 @@ get_lxc_cgroup_info() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
lxc_netdev() {
|
|
||||||
local guest_name="$1"
|
|
||||||
|
|
||||||
if [ -f "$lxcpath/$guest_name/config" ]; then
|
|
||||||
# lxc 3 vs < 3
|
|
||||||
(grep -E '^lxc.net.0.veth.pair' "$lxcpath/$guest_name/config" 2>/dev/null \
|
|
||||||
|| grep -E '^lxc.network.veth.pair' "$lxcpath/$guest_name/config"
|
|
||||||
) | awk '{print $NF;}'
|
|
||||||
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
|
||||||
|
@ -259,7 +240,7 @@ EOF
|
||||||
|
|
||||||
for guest_name in $active_guests
|
for guest_name in $active_guests
|
||||||
do
|
do
|
||||||
device=$(lxc_netdev "$guest_name")
|
device=$(lxc-info -n "$guest_name" | grep Link | sed 's/Link:\ \+//g')
|
||||||
if [ -z "$device" ]; then
|
if [ -z "$device" ]; then
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -362,7 +343,7 @@ do_fetch() {
|
||||||
echo "multigraph lxc_net"
|
echo "multigraph lxc_net"
|
||||||
for guest_name in $active_guests
|
for guest_name in $active_guests
|
||||||
do
|
do
|
||||||
device=$(lxc_netdev "$guest_name")
|
device=$(lxc-info -n "$guest_name" | grep Link | sed 's/Link:\ \+//g')
|
||||||
if [ -z "$device" ]; then
|
if [ -z "$device" ]; then
|
||||||
value_up="U"
|
value_up="U"
|
||||||
value_down="U"
|
value_down="U"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue