2007-11-30 11:43:07 +01:00
|
|
|
config_ntpdate() {
|
2021-08-22 18:37:40 +02:00
|
|
|
echo "graph_title NTP offset and delay to peer $NTP_PEER"
|
2007-11-30 11:43:07 +01:00
|
|
|
echo "graph_args --base 1000 --vertical-label msec"
|
2020-10-08 15:20:55 +02:00
|
|
|
echo "graph_category time"
|
2007-11-30 11:43:07 +01:00
|
|
|
echo "offset.label Offset"
|
|
|
|
echo "delay.label Delay"
|
|
|
|
}
|
|
|
|
|
|
|
|
fetch_ntpdate() {
|
|
|
|
NTPDATE="/usr/sbin/ntpdate"
|
2011-01-27 10:58:58 +01:00
|
|
|
OFFSET=0
|
|
|
|
DELAY=0
|
2020-02-07 15:15:06 +01:00
|
|
|
if [ -n "$NTP_PEER" ] && [ -x "$NTPDATE" ]; then
|
|
|
|
DATA=$("$NTPDATE" -q "$NTP_PEER" | awk '/^server.*offset/{gsub(/,/,""); printf "%s %s", ($6*1000), ($8*1000);}')
|
|
|
|
OFFSET=$(echo "$DATA" | cut -d " " -f 1)
|
|
|
|
DELAY=$(echo "$DATA" | cut -d " " -f 2)
|
2007-11-30 11:43:07 +01:00
|
|
|
fi
|
2011-01-27 10:58:58 +01:00
|
|
|
echo "offset.value $OFFSET"
|
|
|
|
echo "delay.value $DELAY"
|
2007-11-30 11:43:07 +01:00
|
|
|
}
|