14 lines
428 B
Bash
Executable file
14 lines
428 B
Bash
Executable file
#!/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
|