[collectd] Collectd Exec Plugin Permission denied for script

Matthias Runge mrunge at matthias-runge.de
Mon Dec 28 12:46:53 CET 2020

On 28/12/2020 01:45, Kiran G wrote:
> I am testing the collectd Exec plugin using sample scripts before using 
> it for my end purpose. But I am facing issues with the sample script 
> <https://gist.github.com/apeckham/f783aa297516663f5c56> itself.
> This is the error:
> |collectd[4585]: exec plugin: Failed to execute 
> ``/home/ec2-user/magic_level.sh'': Permission denied |
> More info:
> |$cat /home/ec2-user/magic_level.sh #!/bin/bash 
> INTERVAL="${COLLECTD_INTERVAL:-60}" while sleep "$INTERVAL"; do echo 
> "PUTVAL \"$HOSTNAME/exec-magic/gauge-magic_level\" interval=$INTERVAL 
> N:$(date +%N)" done $ls -l /home/ec2-user/magic_level.sh -rwxrwxr-x. 1 
> ec2-user ec2-user 244 Dec 27 16:28 /home/ec2-user/magic_level.sh |
> My exec plugin configuration:
> |<Plugin exec> Exec "ec2-user" "/home/ec2-user/magic_level.sh" </Plugin> |
> Note: I could see that SELINUX is enabled. But I couldn't see any 
> denials for this script in the log
> Can someone please help me resolve this

My first thought here is:
- is the user running collectd able to change into /home/ec2-user ?
- how are executable permissions for the script? ugo+x?
- if all of that is fine, you could switch selinux to permissive: 
setenforce 0. (That avoids an initial reboot, and also would not require 
a relabel afterwards)


More information about the collectd mailing list