Added ntpcheck

This commit is contained in:
Eric Renfro 2013-07-08 08:01:32 -04:00
parent ec0a62aa18
commit 23a6bd21d5

10
scripts/ntpcheck.sh Executable file
View file

@ -0,0 +1,10 @@
#!/bin/bash
offset=$(/usr/sbin/ntpq -pn | /usr/bin/awk 'BEGIN { offset=1000 } $1 ~ /\*/ { offset=$9 } END { print offset }')
stratum=$(/usr/sbin/ntpq -pn | /usr/bin/awk 'BEGIN { stratum=99 } $1 ~ /\*/ { stratum=$3 } END { print stratum }')
peers=$(ntpq -pn | grep -E -c '^\*|^\+')
echo "- ntp.offset $offset"
echo "- ntp.stratum $stratum"
echo "- ntp.peers $peers"