Skip to content

Commit 680b014

Browse files
tvenierisallamiro
authored andcommitted
ntpd_metrics.py: support IPv6 remotes & references (#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]>
1 parent 57bc4e0 commit 680b014

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

Diff for: ntpd_metrics.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,13 @@
99
from prometheus_client import CollectorRegistry, Gauge, generate_latest
1010

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

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

0 commit comments

Comments
 (0)