From c902263d553b8f4723794a1fb352f821ae065410 Mon Sep 17 00:00:00 2001 From: Moritz Muehlenhoff Date: Wed, 13 Feb 2019 17:14:29 +0100 Subject: [PATCH] Adapt timedatectl check for buster In the systemd version in buster, the output format of timedatectl changed: - "Network time on: yes" became "NTP service: active" - "NTP synchronized: yes" became "System clock synchronized: yes" Signed-off-by: Peter Palfrader --- dsa-nagios-checks/checks/dsa-check-timedatectl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/dsa-nagios-checks/checks/dsa-check-timedatectl b/dsa-nagios-checks/checks/dsa-check-timedatectl index 1c61cf3..4bb6247 100755 --- a/dsa-nagios-checks/checks/dsa-check-timedatectl +++ b/dsa-nagios-checks/checks/dsa-check-timedatectl @@ -64,8 +64,8 @@ trap "rm -f '$temp'" EXIT LC_ALL=C timedatectl > "$temp" ut=$(sed '/Universal time:/ { s/^[^:]*: *//; p}; d' "$temp") rtc=$(sed '/RTC time:/ { s/^[^:]*: *//; p}; d' "$temp") -ntpenabled=$(sed '/\(NTP enabled\|Network time on\):/ { s/^[^:]*: *//; p}; d' "$temp") -ntpsynced=$(sed '/NTP synchronized:/ { s/^[^:]*: *//; p}; d' "$temp") +ntpenabled=$(sed '/\(NTP enabled\|Network time on\|NTP service\):/ { s/^[^:]*: *//; p}; d' "$temp") +ntpsynced=$(sed '/\(NTP synchronized\|System clock synchronized\):/ { s/^[^:]*: *//; p}; d' "$temp") uts=$(TZ=UTC date -d "$ut" +%s) rtcs=$(TZ=UTC date -d "$rtc" +%s 2>/dev/null || echo "N/A") @@ -90,7 +90,7 @@ else exit 1 fi - if [ "$ntpenabled" != "yes" ]; then + if [ "$ntpenabled" != "yes" -a "$ntpenabled" != "active" ]; then echo "Warning: NTP not enabled!" exit 1 fi -- 2.20.1