ntp: New check for NTP clock condition.
[rcheck] / check.d / ntp
1 #! /bin/sh -e
2
3 ntpdc -c peers | {
4 any=nil
5 while read remote local st poll reach delay offset disp; do
6 case "$remote" in
7 \**) ;;
8 *) continue ;;
9 esac
10 awk -v off="$offset" 'BEGIN {
11 if (off < 0) off = -off;
12 if (off >= 0.1) printf "W: absolute time offset %gs worrying\n", off;
13 else if (off >= 0.01) printf "I: absolute time offset %gs concerning\n", off;
14 }'
15 any=t
16 done
17 case $any in
18 nil) echo "W: not sychronized to any peer" ;;
19 esac
20 }