The error !!
sudo -u telegraf /opt/telegraf/telegraf -config /etc/opt/telegraf/telegraf.d/test.conf -test
2015/12/07 09:42:44 exec: fork/exec /opt/snara/slog/slog-netstat-test2.sh: exec format error for command '/opt/snara/slog/slog-netstat-test2.sh'
But the json seems to be ok
sudo -u telegraf /opt/snara/slog/slog-netstat-test2.sh
{ "sf_queue": 0 }
FROM: /etc/opt/telegraf/telegraf.d/test.conf
[exec]
[[exec.commands]]
command = "/opt/snara/slog/slog-netstat-test2.sh"
name = "netstatX"
interval = 10
Version:
/opt/telegraf/telegraf -version
Telegraf - Version 0.2.3
Any thoughts?
certainly looks like a bug, I'll look into it, thanks for the detailed report @marinonjalsson
@marinonjalsson I haven't been able to reproduce, here is my script:
$ cat /tmp/422.sh
#! /bin/bash
printf '{ "sf_queue": 0 }\n'
$ ls -l /tmp/422.sh
-rwxr-xr-x 1 csparr wheel 43 Dec 7 11:08 /tmp/422.sh*
$ whoami
csparr
And collection works fine for me:
$ ./telegraf -config ~/ws/telegraf.conf -filter exec -test
* Plugin: exec, Collection 1
> exec__sf_queue value=0 1449511964082654340
What OS are you running on? Can you send me output of the commands that I executed above?
@marinonjalsson This might be a 32/64 bit architecture issue? I found this case: http://askubuntu.com/questions/447709/im-getting-exec-format-error-when-i-try-to-run-an-executable
please run uname -a and uname -m on your system and show the output
Thank you for your reply.
OS:
$ uname -a
Linux thor 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt11-1+deb8u6 (2015-11-09) x86_64 GNU/Linux
$ uname -m
x86_64
I'm running the telegraf_0.2.3_amd64.deb package.
all 64:
/opt/telegraf/versions/0.2.3$ file telegraf
telegraf: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, not stripped
/opt/telegraf/versions/0.2.3$ ldd telegraf
linux-vdso.so.1 (0x00007ffea2542000)
libpthread.so.0 => /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f62533f2000)
libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f6253049000)
/lib64/ld-linux-x86-64.so.2 (0x00007f625360f000)
I will test your script next.
@marinonjalsson Can you include the full text of your test script? And show the file permissions on it? (ls -l /opt/snara/slog/slog-netstat-test2.sh)
SOLVED.
I forgot the shebang in all my test-scripts.
Added
#! /bin/bash
... and its working. @sparrc thanks for the help
great!
Most helpful comment
SOLVED.
I forgot the shebang in all my test-scripts.
Added
... and its working. @sparrc thanks for the help