-
Notifications
You must be signed in to change notification settings - Fork 5.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use go for the ping plugin #496
Comments
Do you mean Telegraf should check every 10, or so, seconds? Also, this is imho Debian's problem and not the Telegraf's problem. Don't get me wrong. I had the same problem with Nagios checks and wasn't happy about it either.
That would be awesome. |
looks like we may be able to use this library: https://github.com/tatsushid/go-fastping, that would be a better solution than executing the ping binary |
@xor-gate btw the correct solution is to use/set capabilities |
@zstyblik, you are right i'm not very familiar with the capabilities under linux. It is good to mention because |
@xor-gate no worries. It's not from my head either ;) |
Changing this case to just track using golang for the ping plugin, which is probably the only real solution to this issue |
I wrote up a library for pinging via Go: https://github.com/sparrc/go-ping BUT unfortunately this doesn't help much at all. Pinging relies on the setuid (or set capabilities) bits to execute certain system calls with root permission. Unless you gave the entire telegraf binary this permission (very very bad idea), pinging from Go has even less capabilities than using the binary. There are "unpriviliged" pings possible, but in linux this requires setting a kernel variable: https://github.com/sparrc/go-ping#note-on-linux-support I'm going to close this case with #629, in which I'm also putting a note in the config that some users may need to set capabilities on their ping binary for this plugin to work. |
@sparrc this looks good 👍 , and unfortunately we need to set the capabilities but it is much much better than the previous exec and should be more portable when running under BSDs (chrooted, restricted etcetera). |
I'm running telegraf in a systemd container with debian jessie. It seems it calls exec directly on
/bin/ping
. Telegraf runs under the usertelegraf
so the suid bit needs to be set. Maybe it should check this before invoking ?. And maybe it would be much nicer if we can directly ICMP from golang instead of executing a binary?then it works:
The text was updated successfully, but these errors were encountered: