ntpt

module
v0.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2024 License: MIT

README

check-ntpt

Go-based tooling to monitor Network Time Protocol (NTP) servers.

Latest Release Go Reference go.mod Go version Lint and Build Project Analysis

Project home

See our GitHub repo for the latest code, to file an issue or submit improvements for review and potential inclusion into the project.

Overview

Go-based tooling to monitor Network Time Protocol (NTP) servers.

At present, the ntpt binary is the only tool provided by this repo. This tool performs a NTP query against a specified server for testing purposes.

Future plans include providing one (or more) Nagios plugins to monitor NTP servers.

Changelog

See the CHANGELOG.md file for the changes associated with each release of this application. Changes that have been merged to master, but not yet an official release may also be noted in the file under the Unreleased section. A helpful link to the Git commit history since the last official release is also provided for further review.

Requirements

The following is a loose guideline. Other combinations of Go and operating systems for building and running tools from this repo may work, but have not been tested.

Building source code
  • Go
    • see this project's go.mod file for preferred version
    • this project tests against officially supported Go releases
      • the most recent stable release (aka, "stable")
      • the prior, but still supported release (aka, "oldstable")
  • GCC
    • if building with custom options (as the provided Makefile does)
  • make
    • if using the provided Makefile
Running
  • Windows 10
  • Ubuntu Linux 18.04+

Installation

From source
  1. Download Go
  2. Install Go
  3. Clone the repo
    1. cd /tmp
    2. git clone https://github.com/atc0005/check-ntpt
    3. cd ntpt
  4. Install dependencies (optional)
    • for Ubuntu Linux
      • sudo apt-get install make gcc
    • for CentOS Linux
      1. sudo yum install make gcc
  5. Build
    • for current operating system
      • go build -mod=vendor ./cmd/ntpt/
        • forces build to use bundled dependencies in top-level vendor folder
    • for all supported platforms (where make is installed)
      • make all
    • for Windows
      • make windows
    • for Linux
      • make linux
  6. Copy the applicable binary to whatever systems needs to run it
    • if using Makefile: look in /tmp/ntpt/release_assets/ntpt/
    • if using go build: look in /tmp/ntpt/

NOTE: Depending on which Makefile recipe you use the generated binary may be compressed and have an xz extension. If so, you should decompress the binary first before deploying it (e.g., xz -d ntpt-linux-amd64.xz).

Using release binaries
  1. Download the latest release binaries
  2. Decompress binaries
    • e.g., xz -d ntpt-linux-amd64.xz
  3. Deploy
    • Place ntpt in a location of your choice
      • e.g., /usr/local/bin/

NOTE:

DEB and RPM packages are provided as an alternative to manually deploying binaries.

Configuration

Command-line arguments
  • Flags marked as required must be set via CLI flag or within a TOML-formatted configuration file.
  • Flags not marked as required are for settings where a useful default is already defined.
Flag Required Default Repeat Possible Description
h, help No false No h, help Show Help text along with the list of supported flags.
s, server Yes empty string No one valid IP Address or fully-qualified server name NTP server to submit query against.
v, verbose No false No true, false Enables display of verbose output. Disabled by default.

Examples

Basic usage
$ ./ntpt -s pool.ntp.org
Current time from pool.ntp.org: 2022-08-15 06:16:11.139364388 -0500 CDT m=-0.121229211
Current time from local system: 2022-08-15 06:16:11.5944353 -0500 CDT m=+0.333841701

The local system is -456.993422ms behind pool.ntp.org.
Verbose output
$ ./ntpt -v -s pool.ntp.org
Current time from pool.ntp.org: 2022-08-15 06:16:41.864305139 -0500 CDT m=-0.193111660
Current time from local system: 2022-08-15 06:16:42.3228386 -0500 CDT m=+0.265421801

Response from NTP server "pool.ntp.org":
        Time: 2022-08-15 11:16:41.968756524 +0000 UTC
        ClockOffset: -459.00146ms
        RTT: 203.878832ms
        Stratum: 2
        ReferenceID: 167864580
        ReferenceTime: 2022-08-15 11:16:39.020873716 +0000 UTC
        RootDelay: 213.623µs
        RootDispersion: 30.518µs
        RootDistance: 102.076745ms
        Leap: 0
        MinError: 357.062044ms
        KissCode: ""

Offset adjusted time: 2022-08-15 06:16:42.07080214 -0500 CDT m=+0.013385341

References

Directories

Path Synopsis
cmd
ntpt
Perform a NTP query against a specified server for testing purposes.
Perform a NTP query against a specified server for testing purposes.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL