zabbix-trappers/scripts/ntpcheck.sh

11 lines
368 B
Bash
Raw Normal View History

2013-07-08 08:01:32 -04:00
#!/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"