The following UserParameters allow you to monitor various aspect of an ntpd server.
The returned values will give (compare with raw output of ntpq below)
If I could only find out how to pass arguments to UserParameters then one could easi;y expand this to monitor remote ntpd servers, e.g. ntp.offset[130.102.128.23].
Markus
Code:
UserParameter=ntp.offset,/usr/sbin/ntpq -pn | /usr/bin/awk 'BEGIN { offset=1000 } $1 ~ /\*/ { offset=$9 } END { print offset }'
UserParameter=ntp.stratum,/usr/sbin/ntpq -pn | /usr/bin/awk 'BEGIN { stratum=99 } $1 ~ /\*/ { stratum=$3 } END { print stratum }'
UserParameter=ntp.npeers,ntpq -pn | grep -E -c '^\*|^\+'
- the offset to the currently selected peer (ntp.offset): 3.055
- the stratum of the currently selected peer (ntp.stratum): 2
- the number of possible peers, i.e. those prefixed with '*' or '+' (ntp.npeers): 2
Code:
# ntpq -pn
remote refid st t when poll reach delay offset jitter
==============================================================================
10.1.1.1 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
130.102.128.23 .INIT. 16 u - 1024 0 0.000 0.000 4000.00
[B]+[/B]202.181.31.242 203.26.24.6 3 u 880 1024 377 32.171 -12.953 0.608
[B]*[/B]130.102.128.23 130.102.152.7 [B]2[/B] u 1 1024 377 51.986 [B]3.055[/B] 0.253
127.127.1.0 73.78.73.84 5 l 12 64 377 0.000 0.000 0.001
Markus
Comment