[collectd] Collectd Exec Plugin Permission denied for script

Kiran G kirancn47 at gmail.com
Mon Dec 28 13:27:44 CET 2020


Hi Matthias,
Thanks for the reply. This turned out to be selinux issue.

Kiran G

On Mon, Dec 28, 2020, 17:20 Matthias Runge <mrunge at matthias-runge.de> wrote:

> 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
> > 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
>
> 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)
>
> Matthias
>
> _______________________________________________
> collectd mailing list
> collectd at verplant.org
> https://mailman.verplant.org/listinfo/collectd
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20201228/a6967992/attachment.html>


More information about the collectd mailing list