22-Apr-2019 09:16
I have an issue to verify NTP peer server configuration with F5. In BIG_IP command line, the command is : ntpq -np and check the output. But, I have to replicate this in F5-SDK to automate the check between NTP Server and F5-sdk. is there another way to verify this? I was thinking about check in time on both: NTP and F5 and compare both, but I can see a way to fetch the time on NTP. Any help will be appreciate.
sylla
22-Apr-2019
19:04
- last edited on
01-Jun-2023
15:08
by
JimmyPackets
Hello fanta!
There is another command you could use on the BIG-IP:
ntpstat
It outputs something like this:
[root@bigip1:Active:In Sync] config ntpstat
synchronised to local net at stratum 11
time correct to within 11 ms
polling server every 64 s
[root@bigip1:Active:In Sync] config
Does this help?
Other than that, you could query your NTP server through ntpdate like so:
ntpdate -q 0.br.pool.ntp.org
But you will get some raw NTP response, not the actual time.
Hope this helps somehow.
Cheers! Rafael
22-Apr-2019
23:32
- last edited on
05-Jun-2023
21:47
by
JimmyPackets
Hi,
You have 2 way to achieve your need:
You can use ntpq for that.
First, calculate the offset and store it in a var:
ntp_offset=$(ntpq -pn | /usr/bin/awk 'BEGIN { offset=1000 } $1 ~ /\*/ { offset=$9 } END { print offset }')
The second way is to use ntpstat:
Output when ntp is synched: synchronised to NTP server (10.1.11.33) at stratum 2 time correct to within 107 ms polling server every 1024 s
Output when ntp is unsynchronised:
unsynchronised
For more info: https://www.cyberciti.biz/faq/linux-unix-bsd-is-ntp-client-working/
Regards
23-Apr-2019 07:26
Thanks a lot Rafaelbn, but I rewrite what I need to achieve below. Any help will be appreciated.