TransWikia.com

CentOS 8 Chrony - how to query servers for time difference?

Server Fault Asked by dualsport on February 14, 2021

We are moving from CentOS 7 to CentOS 8 for our monitoring servers (Zabbix) and we use ntpdate to query for time to detect if our local time provider for all devices (Cisco device) hasn’t started drifting.

Basically query pool server, query local device and do math to determine if difference is greater than X.

Input:

ntpdate -p 1 -q 0.centos.pool.ntp.org | grep -oP ‘(?<=offset ).*?(?= sec)’

Output:

0.006313

Is there a way to query time (without setting server as source) using chrony or other tool in CentOS 8 that would work in similar fashion?

One Answer

To adapt your existing command, try something like:

[root@localhost ~]# chronyc ntpdata 2001:418:3ff::53 | grep -oP '(?<=Offset          : ).*?(?= sec)'
+0.000654742

The address given must be one of your configured NTP servers. To do this, you should add the server to your sources list with the noselect option. This will tell chronyd to monitor the server but never synchronize from it. For example:

server cisco-ntp-server.example.com iburst noselect

Of course you can always continue to use ntpdate, and your question didn't specify why you are not willing to do this.

Answered by Michael Hampton on February 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP