summaryrefslogtreecommitdiffstats
path: root/plugins.d
diff options
context:
space:
mode:
authorCosta Tsaousis <costa@tsaousis.gr>2017-06-19 20:37:00 +0300
committerGitHub <noreply@github.com>2017-06-19 20:37:00 +0300
commitb419ed34da7cdff853af7c7dfae30ee69853ac67 (patch)
treeee377112ed24008fd7837f001d9e8a54ac30a365 /plugins.d
parent7de06baeef1371495d06452afc14fe5289b2f64c (diff)
parent74e3145a04b715b1cafadeb3e640fa20941e17b5 (diff)
Merge pull request #2355 from efaden/master
Added cgroup name processing for Proxmox LXC and VM
Diffstat (limited to 'plugins.d')
-rwxr-xr-xplugins.d/cgroup-name.sh22
1 files changed, 22 insertions, 0 deletions
diff --git a/plugins.d/cgroup-name.sh b/plugins.d/cgroup-name.sh
index 40a87497c3..a48b82237d 100755
--- a/plugins.d/cgroup-name.sh
+++ b/plugins.d/cgroup-name.sh
@@ -124,6 +124,28 @@ if [ -z "${NAME}" ]
# libvirtd / qemu virtual machines
NAME="$(echo ${CGROUP} | sed 's/machine.slice_machine.*-qemu//; s/\/x2d//; s/\/x2d/\-/g; s/\.scope//g')"
+ elif [[ "${CGROUP}" =~ qemu.slice_([0-9]+).scope && -d /etc/pve ]]
+ then
+
+ # Proxmox VMs
+ FILENAME="/etc/pve/qemu-server/${BASH_REMATCH[1]}.conf"
+ if [[ -f $FILENAME && -r $FILENAME ]]
+ then
+ NAME=$(grep -e '^name: ' /etc/pve/qemu-server/${BASH_REMATCH[1]}.conf | head -1 | sed -rn 's|\s*name\s*:\s*(.*)?$|\1|p')
+ else
+ error "proxmox config file missing $FILENAME or netdata does not have read access. Please ensure netdata is a member of www-data group."
+ fi
+ elif [[ "${CGROUP}" =~ lxc_([0-9]+) && -d /etc/pve ]]
+ then
+
+ # Proxmox Container (LXC)
+ FILENAME="/etc/pve/lxc/${BASH_REMATCH[1]}.conf"
+ if [ -f $FILENAME && -r $FILENAME ]]
+ then
+ NAME=$(grep -e '^hostname: ' /etc/pve/lxc/${BASH_REMATCH[1]}.conf | head -1 | sed -rn 's|\s*hostname\s*:\s*(.*)?$|\1|p')
+ else
+ error "proxmox config file missing $FILENAME or netdata does not have read access. Please ensure netdata is a member of www-data group."
+ fi
fi
[ -z "${NAME}" ] && NAME="${CGROUP}"