diff options
author | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-03-13 00:21:09 +0200 |
---|---|---|
committer | Costa Tsaousis (ktsaou) <costa@tsaousis.gr> | 2017-03-13 00:21:09 +0200 |
commit | eeefaf8a88b26bcc540bc59cf2171ac10a4f736f (patch) | |
tree | 2da6c4dbddb654f1d8bfba70006ef9421ceacb67 | |
parent | 111fe53e19aa54e8a5fad4cce795c0783cc9257c (diff) |
automatic naming for libvirtd virtual machines; fixes #1045
-rwxr-xr-x | plugins.d/cgroup-name.sh | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/plugins.d/cgroup-name.sh b/plugins.d/cgroup-name.sh index 9bb3bcabbe..a1e3abe081 100755 --- a/plugins.d/cgroup-name.sh +++ b/plugins.d/cgroup-name.sh @@ -98,6 +98,8 @@ if [ -z "${NAME}" ] then if [[ "${CGROUP}" =~ ^.*docker[-_/\.][a-fA-F0-9]+[-_\.]?.*$ ]] then + # docker containers + DOCKERID="$( echo "${CGROUP}" | sed "s|^.*docker[-_/]\([a-fA-F0-9]\+\)[-_\.]\?.*$|\1|" )" # echo "DOCKERID=${DOCKERID}" @@ -117,6 +119,11 @@ if [ -z "${NAME}" ] info "docker container '${DOCKERID}' is named '${NAME}'" fi fi + elif [[ "${CGROUP}" =~ machine.slice_machine.*-qemu ]] + then + # libvirtd / qemu virtual machines + + NAME="$(echo ${CGROUP} | sed 's/machine.slice_machine.*-qemu//; s/\/x2d//; s/\/x2d/\-/g; s/\.scope//g')" fi [ -z "${NAME}" ] && NAME="${CGROUP}" |