Skip to content

Chrony

·


The Chrony collector is used to collect metrics related to the Chrony server. The Chrony collector supports remote collection, and the collector DataKit can run on multiple operating systems.

Configuration

Precondition

  • Install Chrony service
$ yum -y install chrony    # [On CentOS/RHEL]
...

$ apt install chrony       # [On Debian/Ubuntu]
...

$ dnf -y install chrony    # [On Fedora 22+]
...
  • Verify if the installation is correct, execute the following command on the command line, and obtain similar results:
$ chronyc -n tracking
Reference ID    : CA760151 (202.118.1.81)
Stratum         : 2
Ref time (UTC)  : Thu Jun 08 07:28:42 2023
System time     : 0.000000000 seconds slow of NTP time
Last offset     : -1.841502666 seconds
RMS offset      : 1.841502666 seconds
Frequency       : 1.606 ppm slow
Residual freq   : +651.673 ppm
Skew            : 0.360 ppm
Root delay      : 0.058808800 seconds
Root dispersion : 0.011350543 seconds
Update interval : 0.0 seconds
Leap status     : Normal

Collector Configuration

Go to the conf.d/samples directory under the DataKit installation directory, copy chrony.conf.sample and name it chrony.conf. Examples are as follows:

[[inputs.chrony]]
  ## (Optional) Collect interval, default is 10 seconds
  # interval = "10s"

  ## (Optional) Exec chronyc timeout, default is 8 seconds
  # timeout = "8s"

  ## (Optional) The binPath of chrony
  bin_path = "chronyc"

  ## (Optional) Remote chrony servers
  ## If use remote chrony servers, election must be true
  ## If use remote chrony servers, bin_paths should be shielded
  # remote_addrs = ["<ip>:22"]
  # remote_users = ["<remote_login_name>"]
  # remote_passwords = ["<remote_login_password>"]
  ## If use remote_rsa_path, remote_passwords should be shielded
  # remote_rsa_paths = ["/home/<your_name>/.ssh/id_rsa"]
  # remote_command = "chronyc -n tracking"

  ## Set true to enable election
  election = true

[inputs.chrony.tags]
  # some_tag = "some_value"
  # more_tag = "some_other_value"

After configuration, restart DataKit.

Can be turned on by ConfigMap Injection Collector Configuration or Config ENV_DATAKIT_INPUTS .

Can also be turned on by environment variables, (needs to be added as the default collector in ENV_DEFAULT_ENABLED_INPUTS):

  • ENV_INPUT_CHRONY_INTERVAL

    Collect interval

    Type: Duration

    input.conf: interval

    Default: 10s

  • ENV_INPUT_CHRONY_TIMEOUT

    Timeout

    Type: Duration

    input.conf: timeout

    Default: 8s

  • ENV_INPUT_CHRONY_BIN_PATH

    The path of Chrony

    Type: String

    input.conf: bin_path

    Default: chronyc

  • ENV_INPUT_CHRONY_REMOTE_ADDRS

    If use remote Chrony servers

    Type: JSON

    input.conf: remote_addrs

    Example: '["192.168.1.1:22","192.168.1.2:22"]'

  • ENV_INPUT_CHRONY_REMOTE_USERS

    Remote login name

    Type: JSON

    input.conf: remote_users

    Example: '["user_1","user_2"]'

  • ENV_INPUT_CHRONY_REMOTE_PASSWORDS

    Remote password

    Type: JSON

    input.conf: remote_passwords

    Example: '["pass_1","pass_2"]'

  • ENV_INPUT_CHRONY_REMOTE_RSA_PATHS

    Remote rsa paths

    Type: JSON

    input.conf: remote_rsa_paths

    Example: '["/home/your_name/.ssh/id_rsa"]'

  • ENV_INPUT_CHRONY_REMOTE_COMMAND

    Remote command

    Type: String

    input.conf: remote_command

    Example: "chronyc -n tracking"

  • ENV_INPUT_CHRONY_ELECTION

    Enable election

    Type: Boolean

    input.conf: election

    Default: true

  • ENV_INPUT_CHRONY_TAGS

    Customize tags. If there is a tag with the same name in the configuration file, it will be overwritten

    Type: Map

    input.conf: tags

    Example: tag1=value1,tag2=value2

Metric

chrony

Tags & Fields Description
host
(tag)
Host name associated with the collected chrony instance.
leap_status
(tag)
Leap-second synchronization status reported by chronyc, such as Normal, Insert second, Delete second, or Not synchronized.
reference_id
(tag)
Reference ID of the server or source to which the system is currently synchronized.
stratum
(tag)
Distance in NTP strata from the ultimate reference clock.
frequency Estimated system clock frequency error that chronyd is correcting, in parts per million.
Type: float | (gauge)
Unit: PPM
Tagged by: leap_status, reference_id, stratum
last_offset Estimated local clock offset applied at the last clock update, in seconds.
Type: float | (gauge)
Unit: time,s
Tagged by: leap_status, reference_id, stratum
residual_freq Residual frequency error for the currently selected reference source, in parts per million.
Type: float | (gauge)
Unit: PPM
Tagged by: leap_status, reference_id, stratum
rms_offset Long-term root-mean-square average of clock offset values, in seconds.
Type: float | (gauge)
Unit: time,s
Tagged by: leap_status, reference_id, stratum
root_delay Total network path delay to the stratum-1 source through the synchronization chain, in seconds.
Type: float | (gauge)
Unit: time,s
Tagged by: leap_status, reference_id, stratum
root_dispersion Total dispersion accumulated through the synchronization chain back to the stratum-1 source, in seconds.
Type: float | (gauge)
Unit: time,s
Tagged by: leap_status, reference_id, stratum
skew Estimated error bound of the frequency estimate, in parts per million.
Type: float | (gauge)
Unit: PPM
Tagged by: leap_status, reference_id, stratum
system_time Signed current offset between the system clock and NTP time, in seconds. The collector records values reported as slow as negative and values reported as fast as positive.
Type: float | (gauge)
Unit: time,s
Tagged by: leap_status, reference_id, stratum
update_interval Interval between the last two local clock updates, in seconds.
Type: float | (gauge)
Unit: time,s
Tagged by: leap_status, reference_id, stratum

Feedback

Is this page helpful? ×