summaryrefslogtreecommitdiffstats
path: root/plugins.d
diff options
context:
space:
mode:
authorEric Faden <efaden@gmail.com>2017-06-18 12:39:42 -0400
committerEric Faden <efaden@gmail.com>2017-06-18 12:39:42 -0400
commit74e3145a04b715b1cafadeb3e640fa20941e17b5 (patch)
tree81cbd2ed9cb07865392f83c0d5d32d9e1a103eaf /plugins.d
parent7769e402a5fdd626ec2d58215652a31d956a3c26 (diff)
Adding handling case where config file doesn't exist or don't have www-data permissions.
Diffstat (limited to 'plugins.d')
-rwxr-xr-xplugins.d/cgroup-name.sh10
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