Skip to content

Commit

Permalink
update documentation for new operating mode
Browse files Browse the repository at this point in the history
  • Loading branch information
majewsky committed Nov 19, 2019
1 parent 4c48bb7 commit 9843da4
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 27 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ New features:
multiple times and take the average, to avoid alerts because of a one-time
mismeasurement.
- The NTP server name is now reported as a metric label.
- The option `-ntp.source` has been added. With `-ntp.source http`, the NTP
server is not defined through command-line options, but through query
parameters on the HTTP GET request.

Changes:

Expand Down
66 changes: 39 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,42 +5,54 @@ of that node's clock against a given NTP server.

## Installation

To build the binary:
Compile `make && make install` or `docker build`. The binary can also be
installed with `go get`:

```bash
make
go get github.com/sapcc/ntp_exporter
```

The binary can also be installed with `go get`:
## Usage

```bash
go get github.com/sapcc/ntp_exporter
Common command-line options:

```
-ntp.source string
source of information about ntp server (cli / http). (default "cli")
-version
Print version information.
-web.listen-address string
Address on which to expose metrics and web interface. (default ":9559")
-web.telemetry-path string
Path under which to expose metrics. (default "/metrics")
```

To build the Docker container:
### Mode 1: Fixed NTP server

```bash
make GOLDFLAGS="-w -linkmode external -extldflags -static" && docker build .
By default, or when the option `-ntp.source cli` is specified, the NTP server
and connection options is defined by command-line options:

```
-ntp.measurement-duration duration
Duration of measurements in case of high (>10ms) drift. (default 30s)
-ntp.protocol-version int
NTP protocol version to use. (default 4)
-ntp.server string
NTP server to use (required).
```

## Usage
### Mode 2: Variable NTP server

When the option `-ntp.source http` is specified, the NTP server and connection
options are obtained from the query parameters on each `GET /metrics` HTTP
request:

- `server`: NTP server to use
- `protocol`: NTP protocol version (2, 3 or 4)
- `duration`: duration of measurements in case of high drift

For example:

Command-line options: (Only `-ntp.server` or `-ntp.source` is required.)

```plain
Usage of ntp_exporter:
-ntp.measurement-duration duration
Duration of measurements in case of high (>10ms) drift. (default 30s)
-ntp.protocol-version int
NTP protocol version to use. (default 4)
-ntp.server string
NTP server to use (required).
-ntp.source string
source of information about ntp server (cli / http). (default "cli")
-version
Print version information.
-web.listen-address string
Address on which to expose metrics and web interface. (default ":9559")
-web.telemetry-path string
Path under which to expose metrics. (default "/metrics")
```sh
$ curl 'http://localhost:9559/metrics?server=ntp.example.com&protocol=4&duration=10s'
```

0 comments on commit 9843da4

Please sign in to comment.