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 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
HOSTNAME="${COLLECTD_HOSTNAME:-localhost}"
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
Actually this turned out to be SELINUX blocking it.
Initially I didn't see the errors due to my lack of knowledge of SELINUX