scripts/monitoring/collectd_ntppool_score

15 lines
428 B
Text
Raw Permalink Normal View History

2018-05-01 13:48:51 +02:00
#!/bin/sh
# add this to your types.db:
# ntp_pool_score value:GAUGE:-20:20
HOSTNAME="${COLLECTD_HOSTNAME:-`hostname -f`}"
INTERVAL="${COLLECTD_INTERVAL:-300}"
IP="X.X.X.X"
CURL="/usr/local/bin/curl"
while sleep "$INTERVAL"; do
VALUE=`$CURL --silent "http://www.pool.ntp.org/scores/$IP/log?limit=1" 2>&1 | tail -1 | cut -f 5 -d ","`
echo "PUTVAL $HOSTNAME/exec-magic/ntp_pool_score interval=$INTERVAL N:$VALUE"
done