From: Moritz Muehlenhoff Date: Wed, 13 Feb 2019 16:14:29 +0000 (+0100) Subject: Adapt timedatectl check for buster X-Git-Url: https://git.adam-barratt.org.uk/?p=mirror%2Fdsa-nagios.git;a=commitdiff_plain;h=c902263d553b8f4723794a1fb352f821ae065410 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 --- 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