SuperQ / chrony_exporter

Exporter for Chrony NTP
Apache License 2.0
49 stars 13 forks source link

Invalid metric values #66

Closed alkolexx closed 7 months ago

alkolexx commented 7 months ago

Hello! If I enabled --collector.serverstats - then i get metric "chrony_up 0", but chrony is enabled and work fine If I disabled --collector.serverstats - then i get metric "chrony_up 1" Version chrony_exporter 0.9.0

SuperQ commented 7 months ago

The serverstats feature only seems to work over the UNIX datagram socket. So you will need to use something like --chrony.address="unix:///run/chrony/chronyd.sock".

If you run chronyc serverstats as a normal user, you get the same errors as you see in the debug logs.

$ chronyc serverstats
501 Not authorised
ts=2024-02-20T14:45:31.523Z caller=collector.go:173 level=debug msg="Couldn't get serverstats" err="got status UNAUTH (2)"

Since access is a datagram socket, you will need to make sure the exporter is running as the same user as chrony.

# ls -l /run/chrony/chronyd.sock 
srwxr-xr-x 1 _chrony _chrony 0 Feb 20 15:49 /run/chrony/chronyd.sock

See the documentation for more information on UNIX socket access.

alkolexx commented 7 months ago

Thanks!

Gaozizhong commented 2 months ago

大家好,当我配置完--chrony.address="unix:///run/chrony/chronyd.sock参数后出现了以下报错,这是怎么回事呢? ts=2024-07-21T01:50:19.140Z caller=collector.go:183 level=debug scrape_id=1 msg="Couldn't get serverstats" err="got wrong 'serverstats' response: &{{'\x06' \"reply\" '\x00' '\x00' '6' '\x16' \"SUCCESS\" '\x00' '\x00' '\x00' '\x02' '\x00' '\x00'} {'𢘚' '\x00' '0' '\x00' '\x00' '\x00' '\x00' '\x00'}}"