Skip to content

Commit

Permalink
ntpd_metrics.py: support IPv6 remotes & references (prometheus-commun…
Browse files Browse the repository at this point in the history
…ity#224)

The -W 255 parameter ensures that large IPv6 addresses are not truncated
when the default 80 column output is used.

Signed-off-by: Thomas Venieris <[email protected]>
Signed-off-by: Tamir Suliman <[email protected]>

Signed-off-by: Tamir Suliman <[email protected]>
  • Loading branch information
tvenieris authored and allamiro committed Nov 16, 2024
1 parent 57bc4e0 commit 680b014
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ntpd_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@
from prometheus_client import CollectorRegistry, Gauge, generate_latest

# NTP peers status, with no DNS lookups.
ntpq_cmd = ['ntpq', '-np']
ntpq_cmd = ['ntpq', '-np', '-W', '255']
ntpq_rv_cmd = ['ntpq', '-c', 'rv 0 offset,sys_jitter,rootdisp,rootdelay']

# Regex to match all of the fields in the output of ntpq -np
metrics_fields = [
r'^(?P<status>.)(?P<remote>[\w\.]+)',
r'(?P<refid>[\w\.]+)',
r'^(?P<status>.)(?P<remote>[\w\.:]+)',
r'(?P<refid>[\w\.:]+)',
r'(?P<stratum>\d+)',
r'(?P<type>\w)',
r'(?P<when>\d+)',
Expand Down

0 comments on commit 680b014

Please sign in to comment.