mirror of
https://github.com/munin-monitoring/muninlite.git
synced 2024-12-22 05:42:13 +01:00
a2f1745477
Previously multiple "server" lines were consumed, but the output of the awk filter lacked the line ending. Thus the last numeric value of the previous "server" line was concatenated with the first numeric value of the following "server" line. Thus multiple dots occurred in a single numeric value and parsing just failed. Thanks, glyndon! Closes: #16
20 lines
618 B
Text
20 lines
618 B
Text
config_ntpdate() {
|
|
echo "graph_title NTP offset and delay to peer $NTP_PEER"
|
|
echo "graph_args --base 1000 --vertical-label msec"
|
|
echo "graph_category time"
|
|
echo "offset.label Offset"
|
|
echo "delay.label Delay"
|
|
}
|
|
|
|
fetch_ntpdate() {
|
|
NTPDATE="/usr/sbin/ntpdate"
|
|
OFFSET=0
|
|
DELAY=0
|
|
if [ -n "$NTP_PEER" ] && [ -x "$NTPDATE" ]; then
|
|
DATA=$("$NTPDATE" -q "$NTP_PEER" | awk '/^server.*offset/{gsub(/,/,""); printf "%s %s", ($6*1000), ($8*1000); exit;}')
|
|
OFFSET=$(echo "$DATA" | cut -d " " -f 1)
|
|
DELAY=$(echo "$DATA" | cut -d " " -f 2)
|
|
fi
|
|
echo "offset.value $OFFSET"
|
|
echo "delay.value $DELAY"
|
|
}
|