diff options
Diffstat (limited to 'plugins.d')
-rwxr-xr-x | plugins.d/cgroup-name.sh | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/plugins.d/cgroup-name.sh b/plugins.d/cgroup-name.sh index 3d1a2fbe5a..a48b82237d 100755 --- a/plugins.d/cgroup-name.sh +++ b/plugins.d/cgroup-name.sh @@ -128,17 +128,23 @@ if [ -z "${NAME}" ] then # Proxmox VMs - if [[ -f /etc/pve/qemu-server/${BASH_REMATCH[1]}.conf ]] + 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) - if [[ -f /etc/pve/lxc/${BASH_REMATCH[1]}.conf ]] + 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 |