Skip to content

Commit

Permalink
ntpd_metrics.py: support IPv6 remotes & references (#224)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
tvenieris authored Nov 15, 2024
1 parent 6e26d97 commit 39b36d0
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 39b36d0

Please sign in to comment.