Giter VIP home page Giter VIP logo

time_exporter's Introduction

Time Exporter

Build Status image version Image Pulls

Prometheus exporter for covering all possible timesync and time services.

NOTE: This repo is partial fork of node_exporter

NOTE: Exporter is only tested on linux machines

Sample

Before the actual usage take a look at the metrics sample

Installation and Usage

The time_exporter listens on HTTP port 9818 by default. See the --help output for more options.

Docker

docker run --rm -d \
  --name time_exporter \
  --net=host \
  -v /var/run/chrony/chronyd.sock:/var/run/chrony/chronyd.sock:ro \
  dmi7ry/time-exporter --log.level=debug --collector.chrony.address=127.0.0.1:323

or

docker run --rm -d \
  --name time-exporter \
  -p 9818:9818 \
  -v /var/run/chrony/chronyd.sock:/var/run/chrony/chronyd.sock:ro \
  dmi7ry/time-exporter --log.level=debug --collector.chrony.address=/var/run/chrony/chronyd.sock

Binary

export version=0.0.2
curl -L https://github.com/dmitry-ee/time_exporter/releases/download/$version/time_exporter-$version.linux-amd64.tar.gz | tar -zxf -
./time_exporter-$version.linux-amd64/time_exporter

Collectors

All collectors are enabled by default

That could be disabled with both flags --collector.disable-defaults and if you want to get rid of the default (go_|process_|promhttp_) set --web.disable-exporter-metrics

chrony

Enables and disables with flag --collector.chrony and --no-collector.chrony

collector.chrony.address

The most important flag here: it could be socket path (/var/run/chrony/chronyd.sock by default) or host:port (chronyd is listening 127.0.0.1:323 by default).

That could be useful to get the statistics even from outside the host itself

--collector.chrony.log-response-json

Log chronyd response in debug logging, could be helpful to get the real response for debugging purposes

ntp

Enables and disables with flag --collector.ntp and --no-collector.ntp

time

Enables and disables with flag --collector.time and --no-collector.time

timex

Enables and disables with flag --collector.timex and --no-collector.timex

time_exporter's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

stephan2012

time_exporter's Issues

Please remove the id label.

time_chrony_sources_peer_auth_possible{addr="185.120.22.14",id="5"} 0
time_chrony_sources_peer_offset{addr="185.120.22.14",id="5"} 0.0013166479766368866
...

The addr is enough. The issue with id is that they can change on deamon restart, especially if one uses NTP dns pool instead of a set of fixed addresses, and even they can change dynamically for various reasons. That just will blow number of metrics, and provide no value in monitoring, aggregation, alerting or correlating things. In fact for aggregations, it is useless, and rather a hindrance than a feature, and basically need to be removed by relabeling in prometheus scrape config.

Same for ntpd metrics.

Margin of error not available (chrony)

When comparing the output of chronyc sources with the metrics exported by the Time Exporter, Iโ€™m missing the margin of error in the measurement:

MS Name/IP address         Stratum Poll Reach LastRx Last sample               
===============================================================================
^* 10.1.2.34                     1  10   377   718  -1659us[-1693us] +/- 2948us
^- 10.123.255.254                2  10   377   434    -70us[  -70us] +/- 6085us

Here are the generated metrics:

time_chrony_sources_peer_auth_possible{addr="10.123.255.254"} 0
time_chrony_sources_peer_auth_possible{addr="10.1.2.34"} 0
time_chrony_sources_peer_authentic{addr="10.123.255.254"} 0
time_chrony_sources_peer_authentic{addr="10.1.2.34"} 0
time_chrony_sources_peer_broadcast{addr="10.123.255.254"} 0
time_chrony_sources_peer_broadcast{addr="10.1.2.34"} 0
time_chrony_sources_peer_count 2
time_chrony_sources_peer_delay{addr="10.123.255.254"} 0
time_chrony_sources_peer_delay{addr="10.1.2.34"} 0
time_chrony_sources_peer_dispersion{addr="10.123.255.254"} 0
time_chrony_sources_peer_dispersion{addr="10.1.2.34"} 0
time_chrony_sources_peer_headway{addr="10.123.255.254"} 0
time_chrony_sources_peer_headway{addr="10.1.2.34"} 0
time_chrony_sources_peer_hmode{addr="10.123.255.254"} 0
time_chrony_sources_peer_hmode{addr="10.1.2.34"} 0
time_chrony_sources_peer_hpoll{addr="10.123.255.254"} 10
time_chrony_sources_peer_hpoll{addr="10.1.2.34"} 10
time_chrony_sources_peer_jitter{addr="10.123.255.254"} 0
time_chrony_sources_peer_jitter{addr="10.1.2.34"} 0
time_chrony_sources_peer_leap{addr="10.123.255.254"} 0
time_chrony_sources_peer_leap{addr="10.1.2.34"} 0
time_chrony_sources_peer_offset{addr="10.123.255.254"} 6.98709991411306e-05
time_chrony_sources_peer_offset{addr="10.1.2.34"} 4.3228999857092276e-05
time_chrony_sources_peer_peer_configured{addr="10.123.255.254"} 1
time_chrony_sources_peer_peer_configured{addr="10.1.2.34"} 1
time_chrony_sources_peer_pmode{addr="10.123.255.254"} 0
time_chrony_sources_peer_pmode{addr="10.1.2.34"} 0
time_chrony_sources_peer_ppoll{addr="10.123.255.254"} 10
time_chrony_sources_peer_ppoll{addr="10.1.2.34"} 10
time_chrony_sources_peer_precision{addr="10.123.255.254"} 0
time_chrony_sources_peer_precision{addr="10.1.2.34"} 0
time_chrony_sources_peer_reach{addr="10.123.255.254"} 255
time_chrony_sources_peer_reach{addr="10.1.2.34"} 255
time_chrony_sources_peer_reachable{addr="10.123.255.254"} 1
time_chrony_sources_peer_reachable{addr="10.1.2.34"} 1
time_chrony_sources_peer_ref_time{addr="10.123.255.254"} 0
time_chrony_sources_peer_ref_time{addr="10.1.2.34"} 0
time_chrony_sources_peer_root_delay{addr="10.123.255.254"} 0
time_chrony_sources_peer_root_delay{addr="10.1.2.34"} 0
time_chrony_sources_peer_root_disp{addr="10.123.255.254"} 0
time_chrony_sources_peer_root_disp{addr="10.1.2.34"} 0
time_chrony_sources_peer_selection{addr="10.123.255.254",desc="outlier"} 3
time_chrony_sources_peer_selection{addr="10.1.2.34",desc="sync"} 6
time_chrony_sources_peer_stratum{addr="10.123.255.254"} 2
time_chrony_sources_peer_stratum{addr="10.1.2.34"} 1
time_chrony_sources_peer_unreach{addr="10.123.255.254"} 0
time_chrony_sources_peer_unreach{addr="10.1.2.34"} 0
time_chrony_sources_peer_xleave{addr="10.123.255.254"} 0
time_chrony_sources_peer_xleave{addr="10.1.2.34"} 0

Looks like dispersion is not extracted correctly?

OS is Ubuntu 18.04.6 LTS, chrony is version 3.2.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.