Forum Discussion

fanta_377379's avatar
Icon for Nimbostratus rankNimbostratus
Apr 22, 2019

NTP peer server configuration with F5

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.




3 Replies

  • Hello fanta!

    There is another command you could use on the BIG-IP:


    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

    But you will get some raw NTP response, not the actual time.

    Hope this helps somehow.

    Cheers! Rafael

  • 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 }')

    • Server OK when: ntp_offset < 1000
    • Server unsynchronised when: ntp_offset >= 1000

    The second way is to use ntpstat:

    • Output when ntp is synched: synchronised to NTP server ( at stratum 2 time correct to within 107 ms polling server every 1024 s

    • Output when ntp is unsynchronised:


    For more info:


  • Thanks a lot Rafaelbn, but I rewrite what I need to achieve below. Any help will be appreciated.