uos-time-exporter:基于 Prometheus 的时间同步指标采集器项目

A Prometheus exporter for covering all possible timesync and time services

Branch1Tags0

// SPDX-FileCopyrightText: 2025 UnionTech Software Technology Co., Ltd. // SPDX-License-Identifier: MIT

uos-time-exporter

uos-time-exporter provides Prometheus metrics for common Linux time synchronisation stacks, including chrony, NTP, timex and the system clock. It is designed to run as a standalone service and can be integrated with systemd or container environments.

Features

  • Chrony tracking, sources and sourcestats collectors
  • NTP reachability metrics via github.com/beevik/ntp
  • Timex kernel statistics and system time exposure
  • Pluggable collector toggles via YAML configuration
  • Built-in health endpoint at /healthz

Getting started

Build from source

make fmt        # optional: format Go sources
make test       # optional: run unit tests
make build      # produce ./build/bin/time-exporter

Install with systemd

sudo make install PREFIX=/usr/local
sudo systemctl daemon-reload
sudo systemctl enable --now uos-time-exporter.service

The default unit starts /usr/local/bin/time-exporter and reads configuration from /etc/uos-exporter/time-exporter.yaml.

Configuration

address: "0.0.0.0"
port: 9085
metricsPath: "/metrics"
log:
  level: "debug"

collectors:
  chrony: true
  time: true
  timex: true
  ntp: true

ntp_config:
  ntp_server: pool.ntp.org
  ntp_protocol_version: 4
  ntp_server_is_local: false
  ntp_ip_ttl: 1

chrony_config:
  chrony_address: pool.ntp.org
  chrony_port: 323

Disable any collector by setting its flag to false. When chrony is disabled the exporter skips all chrony commands. Additional logging options (max_size, max_age) can be configured in the log section.

Observability endpoints

Endpoint Description
/metrics Prometheus scrape endpoint
/healthz Liveness probe (JSON response)

Development

  • make fmt – format Go sources
  • make test – run go test ./...
  • make deps – tidy module dependencies

Introduction

A Prometheus exporter for covering all possible timesync and time services

Customize your domain