influxdata / telegraf

Agent for collecting, processing, aggregating, and writing metrics, logs, and other arbitrary data.
https://influxdata.com/telegraf
MIT License
14.11k stars 5.51k forks source link

[chrony] unix socket connection is broken #15549

Open Frankkkkk opened 1 week ago

Frankkkkk commented 1 week ago

Relevant telegraf.conf

[[inputs.chrony]]
    server = "unix:///var/run/chrony/chronyd.sock"
    metrics = ["activity", "tracking", "sources", "sourcestats"]

Logs from Telegraf

[pid 612402] write(9, "\6\1\0\0\0,\0\0\0\0\0\1\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"..., 416 <unfinished ...>
[pid 612402] <... write resumed>)       = 416
[pid 612402] read(9,  <unfinished ...>
[pid 612402] <... read resumed>0xc003368400, 1024) = -1 EAGAIN (Resource temporarily unavailable)

System info

1.13 - 78cbf533d2

Docker

No response

Steps to reproduce

  1. Use the chrony plugin
  2. Set the server to be unix:///var/run/chrony/chronyd.sock
  3. Launch telegraf as root (or at least as a user that con use the unix socket)
  4. See it hang

Expected behavior

The chrony plugin should work

Actual behavior

The plugin hangs when using the unix socket when:

The reasons are two fold:

Here is a working example by facebook

Additional info

I guess this is hard to reproduce, because the unix socket is rarely used as telegraf cannot talk to it (thus it instead connects via UDP to the chrony deamon).

The unix socket is however needed to access the serverstats metrics. Most of the other ones can be reached using the udp socket.

powersj commented 1 week ago

Thanks for the various issues and PRs

next steps: review PR