{"id":13582253,"url":"https://github.com/sapcc/ntp_exporter","last_synced_at":"2025-04-30T14:15:18.668Z","repository":{"id":16768125,"uuid":"78857439","full_name":"sapcc/ntp_exporter","owner":"sapcc","description":"Prometheus exporter for NTP offset/stratum of a client","archived":false,"fork":false,"pushed_at":"2025-04-11T05:29:20.000Z","size":6916,"stargazers_count":53,"open_issues_count":1,"forks_count":17,"subscribers_count":54,"default_branch":"master","last_synced_at":"2025-04-11T06:28:47.468Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sapcc.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-13T14:42:57.000Z","updated_at":"2025-04-11T05:28:50.000Z","dependencies_parsed_at":"2023-10-20T22:58:33.271Z","dependency_job_id":"c6586787-cb3b-451a-ac9c-7be15cdc1904","html_url":"https://github.com/sapcc/ntp_exporter","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapcc%2Fntp_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapcc%2Fntp_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapcc%2Fntp_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sapcc%2Fntp_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sapcc","download_url":"https://codeload.github.com/sapcc/ntp_exporter/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249514449,"owners_count":21284546,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-01T15:02:32.179Z","updated_at":"2025-04-18T15:33:49.271Z","avatar_url":"https://github.com/sapcc.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# ntp\\_exporter\n\n[![CI](https://github.com/sapcc/ntp_exporter/actions/workflows/ci.yaml/badge.svg)](https://github.com/sapcc/ntp_exporter/actions/workflows/ci.yaml)\n\nThis is a Prometheus exporter that, when running on a node, checks the drift\nof that node's clock against a given NTP server or servers.\n\nThese are the metrics supported.\n\n- `ntp_build_info`\n- `ntp_drift_seconds`\n- `ntp_stratum`\n- `ntp_rtt_seconds`\n- `ntp_reference_timestamp_seconds`\n- `ntp_root_delay_seconds`\n- `ntp_root_dispersion_seconds`\n- `ntp_root_distance_seconds`\n- `ntp_precision_seconds`\n- `ntp_leap`\n- `ntp_scrape_duration_seconds`\n- `ntp_server_reachable`\n\nAs an alternative to [the node-exporter's `time` module](https://github.com/prometheus/node_exporter/blob/master/docs/TIME.md), this exporter does not require an NTP component on localhost that it can talk to. We only look at the system clock and talk to the configured NTP server(s).\n\n## Installation\n\nCompile `make \u0026\u0026 make install` or `docker build`. The binary can also be\ninstalled with `go get`:\n\n```bash\ngo install github.com/sapcc/ntp_exporter@latest\n```\n\nWe also publish pre-built images on Docker Hub as\n[sapcc/ntp-exporter](https://hub.docker.com/r/sapcc/ntp-exporter):\n\n```bash\ndocker pull ghcr.io/sapcc/ntp_exporter:v2.2.0\n```\n\n## Usage\n\nCommon command-line options:\n\n```\n-ntp.source string\n   source of information about ntp server (cli / http). (default \"cli\")\n-version\n   Print version information.\n-web.listen-address string\n   Address on which to expose metrics and web interface. (default \":9559\")\n-web.telemetry-path string\n   Path under which to expose metrics. (default \"/metrics\")\n```\n\n### Mode 1: Fixed NTP server\n\nBy default, or when the option `-ntp.source cli` is specified, the NTP server\nand connection options is defined by command-line options:\n\n```\n-ntp.measurement-duration duration\n   Duration of measurements in case of high (\u003e10ms) drift. (default 30s)\n-ntp.high-drift duration\n   High drift threshold. (default 10ms)\n-ntp.protocol-version int\n   NTP protocol version to use. (default 4)\n-ntp.server string\n   NTP server to use (required).\n```\n\nCommand-line usage example:\n\n```sh\nntp_exporter -ntp.server ntp.example.com -web.telemetry-path \"/probe\" -ntp.measurement-duration \"5s\" -ntp.high-drift \"50ms\"\n```\n\n### Mode 2: Variable NTP server\n\nWhen the option `-ntp.source http` is specified, the NTP server and connection\noptions are obtained from the query parameters on each `GET /metrics` HTTP\nrequest:\n\n- `target`: NTP server to use\n- `protocol`: NTP protocol version (2, 3 or 4)\n- `duration`: duration of measurements in case of high drift\n- `high_drift`: High drift threshold to trigger multiple probing\n\nFor example:\n\n```sh\n$ curl 'http://localhost:9559/metrics?target=ntp.example.com\u0026protocol=4\u0026duration=10s\u0026high_drift=100ms'\n```\n\n## Frequently asked questions (FAQ)\n\n### Is there a metric for checking that the exporter is working?\n\nSeveral people have suggested adding a metric like `ntp_up` that's always 1, so\nthat people can alert on `absent(ntp_up)` or something like that. This is not\nnecessary. [Prometheus already generates such a metric by itself during\nscraping.](https://prometheus.io/docs/concepts/jobs_instances/) A suitable\nalert expression could look like\n\n```\nup{job=\"ntp_exporter\",instance=\"example.com:9559\"} != 1 or absent(up{job=\"ntp_exporter\",instance=\"example.com:9559\"})\n```\n\nbut the concrete labels will vary depending on your setup and scrape configuration.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsapcc%2Fntp_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsapcc%2Fntp_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsapcc%2Fntp_exporter/lists"}