From c6e74dd82f4b390bc359a7deb3d1a2d9352cbb1f Mon Sep 17 00:00:00 2001 From: Thomas Venieris Date: Fri, 15 Nov 2024 18:51:02 +0000 Subject: [PATCH] ntpd_metrics.py: support IPv6 remotes & references 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 Signed-off-by: Thomas Venieris --- ntpd_metrics.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ntpd_metrics.py b/ntpd_metrics.py index f0dd014..b8476fa 100755 --- a/ntpd_metrics.py +++ b/ntpd_metrics.py @@ -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.)(?P[\w\.]+)', - r'(?P[\w\.]+)', + r'^(?P.)(?P[\w\.:]+)', + r'(?P[\w\.:]+)', r'(?P\d+)', r'(?P\w)', r'(?P\d+)',