muninlite/plugins/ntpdate

24 lines
651 B
Text
Raw Normal View History

config_ntpdate() {
echo "graph_title NTP offset and dealy to peer $NTP_PEER"
echo "graph_args --base 1000 --vertical-label msec"
echo "offset.label Offset"
echo "offset.draw LINE2"
echo "delay.label Delay"
echo "delay.draw LINE2"
}
fetch_ntpdate() {
NTPDATE="/usr/sbin/ntpdate"
OFFSET=0
DELAY=0
2019-07-23 04:52:37 +02:00
if [ "$NTP_PEER" != "" ]; then
if [ -x "$NTPDATE" ]; then
DATA=$($NTPDATE -q $NTP_PEER | awk '/^server.*offset/{gsub(/,/,"");printf "%s %s", ($6*1000), ($8*1000);}')
OFFSET=$(echo "$DATA" | cut -d\ -f1)
DELAY=$(echo "$DATA" | cut -d\ -f2)
fi
fi
echo "offset.value $OFFSET"
echo "delay.value $DELAY"
}