[area/collectors] Added support for libvirtd LXC containers to the `cgroup-name.sh` cgroup name normalization script (#11006)
Co-authored-by: Ilya Mashchenko <ilya@netdata.cloud>
Endre Szabo committed
Apr 22, 2021 at 09:27 UTC
ddc36cc36fe14c1078d7ed12f66fa5b6b3be8f08
1 file changed
+8
collectors/cgroups.plugin/cgroup-name.sh.in
+8
@@ -428,6 +428,14 @@ if [ -z "${NAME}" ]; then
428
# systemd-nspawn
429
NAME="$(echo "${CGROUP}" | sed 's/.*machine.slice[_\/]\(.*\)\.service/\1/g')"
430
431
+ elif [[ ${CGROUP} =~ machine.slice_machine.*-lxc ]]; then
432
+ # libvirtd / lxc containers
433
+ # examples:
434
+ # before: machine.slice machine-lxc/x2d969/x2dhubud0xians01.scope
435
+ # after: lxc/hubud0xians01
436
+ # before: machine.slice_machine-lxc/x2d969/x2dhubud0xians01.scope/libvirt_init.scope
437
+ # after: lxc/hubud0xians01/libvirt_init
438
+ NAME="lxc/$(echo "${CGROUP}" | sed 's/machine.slice_machine.*-lxc//; s/\/x2d[[:digit:]]*//; s/\/x2d//g; s/\.scope//g')"
439
elif [[ ${CGROUP} =~ machine.slice_machine.*-qemu ]]; then
440
# libvirtd / qemu virtual machines
441
# NAME="$(echo ${CGROUP} | sed 's/machine.slice_machine.*-qemu//; s/\/x2d//; s/\/x2d/\-/g; s/\.scope//g')"