Telegraf exec plugin permission denied for command

Hi There,

I configured a exec plugin with bash script but I get the following error:

E! [inputs.exec] Error in plugin: exec: fork/exec /tmp/omniksolar.sh: permission denied for command ‘/tmp/omniksolar.sh’

Telegraf status:

Oct 27 10:49:14 Debian11Telegraf telegraf[1741]: 2022-10-27T10:49:14Z I! Available plugins: 222 inputs, 9 aggregators, 26 processors, 20 parsers, 57 outputs
Oct 27 10:49:14 Debian11Telegraf telegraf[1741]: 2022-10-27T10:49:14Z I! Loaded inputs: cpu disk diskio exec internal kernel mem net processes swap system
Oct 27 10:49:14 Debian11Telegraf telegraf[1741]: 2022-10-27T10:49:14Z I! Loaded aggregators:
Oct 27 10:49:14 Debian11Telegraf telegraf[1741]: 2022-10-27T10:49:14Z I! Loaded processors:
Oct 27 10:49:14 Debian11Telegraf telegraf[1741]: 2022-10-27T10:49:14Z I! Loaded outputs: influxdb_v2 (3x)
Oct 27 10:49:14 Debian11Telegraf telegraf[1741]: 2022-10-27T10:49:14Z I! Tags enabled: host=debian
Oct 27 10:49:14 Debian11Telegraf systemd[1]: Started The plugin-driven server agent for reporting metrics into InfluxDB.
Oct 27 10:49:14 Debian11Telegraf telegraf[1741]: 2022-10-27T10:49:14Z I! [agent] Config: Interval:1m0s, Quiet:false, Hostname:“debian”, Flush Interval:10s
Oct 27 10:50:00 Debian11Telegraf telegraf[1741]: 2022-10-27T10:50:00Z E! [inputs.exec] Error in plugin: exec: fork/exec /tmp/omniksolar.sh: permission denied for command ‘/tmp/omniksolar.sh’:
Oct 27 10:50:00 Debian11Telegraf telegraf[1741]: 2022-10-27T10:50:00Z E! [inputs.exec] Error in plugin: exec: fork/exec /tmp/omniksolar.sh: permission denied for command ‘/tmp/omniksolar.sh’:

Plugin configuration:

[[inputs.exec]]
commands = [“/tmp/omniksolar.sh”,
“/tmp/omniksolar.sh”]
timeout = “10s”

[[outputs.influxdb_v2]]
urls = [“http://xx.xxx.x.xx:8086”]
token = “xxx”
organization = “domotics”
bucket = “Omnik”

Hi
I found the issue execute rights are needed on the file read access is not enough.

1 Like