{"id":49896771,"url":"https://github.com/0kaba0hub/check_chrony","last_synced_at":"2026-05-16T00:27:18.810Z","repository":{"id":269597102,"uuid":"907937125","full_name":"0kaba0hub/check_chrony","owner":"0kaba0hub","description":"Icinga2 / Nagios monitoring plugin for Chrony NTP \u0026 PTP time offset. Pure bash, no sudo required, includes performance data.","archived":false,"fork":false,"pushed_at":"2026-05-01T21:06:53.000Z","size":18,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-01T23:12:05.171Z","etag":null,"topics":["bash","check-plugin","chrony","icinga2","monitoring","nagios","nagios-plugin","ntp","ptp","time-sync"],"latest_commit_sha":null,"homepage":"","language":"Shell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/0kaba0hub.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-12-24T16:40:59.000Z","updated_at":"2026-05-01T21:06:57.000Z","dependencies_parsed_at":null,"dependency_job_id":"7451a149-9e25-4c01-abf4-fb48d26f6606","html_url":"https://github.com/0kaba0hub/check_chrony","commit_stats":null,"previous_names":["0kaba0hub/check_chrony"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/0kaba0hub/check_chrony","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0kaba0hub%2Fcheck_chrony","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0kaba0hub%2Fcheck_chrony/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0kaba0hub%2Fcheck_chrony/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0kaba0hub%2Fcheck_chrony/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/0kaba0hub","download_url":"https://codeload.github.com/0kaba0hub/check_chrony/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/0kaba0hub%2Fcheck_chrony/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33085660,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-15T20:25:35.270Z","status":"ssl_error","status_checked_at":"2026-05-15T20:25:34.732Z","response_time":103,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["bash","check-plugin","chrony","icinga2","monitoring","nagios","nagios-plugin","ntp","ptp","time-sync"],"created_at":"2026-05-16T00:27:14.672Z","updated_at":"2026-05-16T00:27:18.805Z","avatar_url":"https://github.com/0kaba0hub.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# check_chrony\n\n[![License: GPL-3.0](https://img.shields.io/badge/License-GPL%20v3-blue.svg)](LICENSE)\n\nIcinga2 / Nagios monitoring plugin that checks the **Chrony** NTP \u0026 PTP time offset against configurable warning and critical thresholds. Returns performance data for graphing. No sudo privileges required, no Python or Perl — pure Bash.\n\n---\n\n## Requirements\n\n- `bash`\n- `chronyc` (part of the `chrony` package)\n- `bc` (for floating-point threshold comparison)\n\n### Tested on\n\n- Debian 11, 12\n- Ubuntu 22.04, 24.04\n\n---\n\n## Installation\n\n```bash\ncp check_chrony /usr/local/nagios/plugins/check_chrony\nchmod +x /usr/local/nagios/plugins/check_chrony\n```\n\n---\n\n## Usage\n\n```\ncheck_chrony -w \u003cwarning\u003e -c \u003ccritical\u003e [--debug]\n```\n\n| Option | Required | Description |\n|:-------|:---------|:------------|\n| `-w` | yes | Warning threshold in seconds (float) |\n| `-c` | yes | Critical threshold in seconds (float) |\n| `--debug` | no | Print raw `chronyc tracking` output and parsed values |\n\n---\n\n## Examples\n\n```bash\n# Warn at 1 s, critical at 3 s\ncheck_chrony -w 1 -c 3\n\n# Stricter thresholds for PTP environments\ncheck_chrony -w 0.0001 -c 0.001\n\n# Debug — show raw chronyc output\ncheck_chrony -w 0.5 -c 2 --debug\n```\n\n**Sample output:**\n\n```\nOK: Time offset of +0.000046626 seconds to reference. |offset=0.000046626s;1.000000000;3.000000000\n```\n\n---\n\n## Exit codes\n\n| Code | State | Condition |\n|:-----|:------|:----------|\n| 0 | OK | Offset below warning threshold, leap status normal |\n| 1 | WARNING | Offset \u003e= warning threshold |\n| 2 | CRITICAL | Offset \u003e= critical threshold, or `chronyd` not running, or leap status not `Normal` |\n| 3 | UNKNOWN | `chronyc` command failed or output could not be parsed |\n\n---\n\n## Icinga2 / Nagios configuration\n\n**Command definition:**\n\n```\nobject CheckCommand \"check_chrony\" {\n  command = [ \"/usr/local/nagios/plugins/check_chrony\" ]\n  arguments = {\n    \"-w\" = \"$chrony_warn$\"\n    \"-c\" = \"$chrony_crit$\"\n  }\n}\n```\n\n**Service definition:**\n\n```\nobject Service \"ntp-offset\" {\n  host_name = \"myhost\"\n  check_command = \"check_chrony\"\n  vars.chrony_warn = \"0.5\"\n  vars.chrony_crit = \"2\"\n}\n```\n\n---\n\n## License\n\n[GPL-3.0](LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0kaba0hub%2Fcheck_chrony","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F0kaba0hub%2Fcheck_chrony","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F0kaba0hub%2Fcheck_chrony/lists"}