agent icon indicating copy to clipboard operation
agent copied to clipboard

ntp collector not working with agent

Open ameersayyed opened this issue 3 years ago • 1 comments

Hello, I need ntp related metrics for my node as we get in node exporter by using argument --collector.ntp. have tried below things but dint help.

  1. Added ntp collector to enable collector in grafana-agent.yaml
  2. allowed ntp daemon to listen on local host
  3. tried adding argument as collector.ntp to system daemon

agent conf file :

enabled: false

node_exporter: enabled: true textfile_directory: /tmp/ netdev_address_info: true netdev_device_exclude: "^lo$" enable_collectors: - network_route - ntp

Error :

/usr/bin/grafana-agent -config.file /etc/grafana-agent.yaml -config.expand-env --collector.ntp flag provided but not defined: -collector.ntp

ameersayyed avatar Aug 23 '22 12:08 ameersayyed

Hey there! Thanks for the report. As per the documentation, the NTP collector is not enabled by default, so you're on the right path by explicitly enabling it.

I'm pretty confident this is not an Agent-specific issue. Could you check the Agent logs and metrics exposed by node_exporter to see what exactly is causing it?

For example, in my case and using the most recent Agent version and the following configuration

server:
  log_level: debuf

integrations:
  prometheus_remote_write:
   - basic_auth:
       password: xxxx
       username: xxxx
     url: https://prometheus-prod-01-eu-west-0.grafana.net/api/prom/push
  node_exporter:
    enabled: true
    textfile_directory: /tmp/
    netdev_address_info: true
    netdev_device_exclude: "^lo$"
    enable_collectors:
      - network_route
      - ntp

I can see the logs verifying the collector was enabled

ts=2022-08-25T14:14:23.647474Z caller=node_exporter.go:53 level=info integration=node_exporter msg="Enabled node_exporter collectors"
...
ts=2022-08-25T14:12:57.867911Z caller=node_exporter.go:60 level=info integration=node_exporter collector=ntp

But when looking at the metrics exposed by node_exporter, I also saw the NTP collector failing

$ curl localhost:12345/integrations/node_exporter/metrics
...
...
node_scrape_collector_duration_seconds{collector="ntp"} 0.001711292
node_scrape_collector_success{collector="ntp"} 0

with the logs contained the reason

ts=2022-08-25T14:15:05.576697Z caller=collector.go:169 level=error integration=node_exporter msg="collector failed" name=ntp duration_seconds=0.00028575 err="couldn't get SNTP reply: read udp 127.0.0.1:61173->127.0.0.1:123: read: connection refused"

tpaschalis avatar Aug 25 '22 14:08 tpaschalis

This issue has been automatically marked as stale because it has not had any activity in the past 30 days. The next time this stale check runs, the stale label will be removed if there is new activity. The issue will be closed in 7 days if there is no new activity. Thank you for your contributions!

github-actions[bot] avatar Sep 25 '22 00:09 github-actions[bot]