Control: found -1 2.0.57-1
Control: tags -1 + patch

On Tue, May 05 2020, Gerald Turner wrote:
> I believe changing these to support ntpsec will be trivial.  Patch to
> follow ;-)

Attached patch fixes the version check to work with newer ntpsec daemon
in addition to classic ntpd.  I have tested and verified the same data
is reported under ntpsec daemon.

-- 
Gerald Turner <gtur...@unzane.com>        Encrypted mail preferred!
OpenPGP: 4096R / CA89 B27A 30FA 66C5 1B80  3858 EC94 2276 FDB8 716D
From 2806265c2a8014d02c5a030453cc95771743d300 Mon Sep 17 00:00:00 2001
From: Gerald Turner <gtur...@unzane.com>
Date: Tue, 5 May 2020 19:41:44 -0700
Subject: [PATCH] Fix Bug#959841: munin-plugins-core: ntp_kernel_* plugins
 trivially incompatible with ntpsec package

---
 plugins/node.d/ntp_kernel_err.in      | 2 +-
 plugins/node.d/ntp_kernel_pll_freq.in | 2 +-
 plugins/node.d/ntp_kernel_pll_off.in  | 2 +-
 3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/plugins/node.d/ntp_kernel_err.in b/plugins/node.d/ntp_kernel_err.in
index 9dc6d0f1..23646106 100644
--- a/plugins/node.d/ntp_kernel_err.in
+++ b/plugins/node.d/ntp_kernel_err.in
@@ -51,7 +51,7 @@ fi
 
 printf 'ntp_err.value '
 
-if [ "$(ntpq -c version | grep --extended-regexp --only-matching '[[:digit:]]\.[[:digit:]]\.[[:digit:]]' | tr -d '.')" -ge 427 ]
+if [ "$(ntpq -c version | sed 's/[^[:alpha:]].*//')" = "ntpsec" -o "$(ntpq -c version | grep --extended-regexp --only-matching '[[:digit:]]\.[[:digit:]]\.[[:digit:]]' | tr -d '.')" -ge 427 ]
 then
     ntpq -c kerninfo | awk '/^estimated error:/ { print $3 / 1000 }'
 else
diff --git a/plugins/node.d/ntp_kernel_pll_freq.in b/plugins/node.d/ntp_kernel_pll_freq.in
index 30af52a8..7b1839d7 100644
--- a/plugins/node.d/ntp_kernel_pll_freq.in
+++ b/plugins/node.d/ntp_kernel_pll_freq.in
@@ -65,7 +65,7 @@ fi
 
 printf 'ntp_pll_freq.value '
 
-if [ "$(ntpq -c version | grep --extended-regexp --only-matching '[[:digit:]]\.[[:digit:]]\.[[:digit:]]' | tr -d '.')" -ge 427 ]
+if [ "$(ntpq -c version | sed 's/[^[:alpha:]].*//')" = "ntpsec" -o "$(ntpq -c version | grep --extended-regexp --only-matching '[[:digit:]]\.[[:digit:]]\.[[:digit:]]' | tr -d '.')" -ge 427 ]
 then
     cmd=ntpq
 else
diff --git a/plugins/node.d/ntp_kernel_pll_off.in b/plugins/node.d/ntp_kernel_pll_off.in
index b38cbd4d..dfac2c20 100644
--- a/plugins/node.d/ntp_kernel_pll_off.in
+++ b/plugins/node.d/ntp_kernel_pll_off.in
@@ -51,7 +51,7 @@ fi
 
 printf 'ntp_pll_off.value '
 
-if [ "$(ntpq -c version | grep --extended-regexp --only-matching '[[:digit:]]\.[[:digit:]]\.[[:digit:]]' | tr -d '.')" -ge 427 ]
+if [ "$(ntpq -c version | sed 's/[^[:alpha:]].*//')" = "ntpsec" -o "$(ntpq -c version | grep --extended-regexp --only-matching '[[:digit:]]\.[[:digit:]]\.[[:digit:]]' | tr -d '.')" -ge 427 ]
 then
     ntpq -c kerninfo | awk '/^pll offset:/ { print $3 / 1000 }'
 else
-- 
2.26.2

Attachment: signature.asc
Description: PGP signature

Reply via email to