Skip to content
Snippets Groups Projects
Commit b62c7bc0 authored by Brett Vickers's avatar Brett Vickers Committed by Ben Kochie
Browse files

Updated vendored ntp package (#681)

The github.com/beevik/ntp package was recently updated with some
API changes that broke node_exporter. This commit fetches the
latest version of the ntp package and brings node_exporter in
line with the latest API.
parent 859a825b
No related branches found
No related tags found
No related merge requests found
Loading
Loading
@@ -152,7 +152,7 @@ func (c *ntpCollector) Update(ch chan<- prometheus.Metric) error {
maxerr += time.Second
}
 
if resp.Validate() && resp.RootDistance <= *ntpMaxDistance && resp.CausalityViolation <= maxerr {
if resp.Validate() == nil && resp.RootDistance <= *ntpMaxDistance && resp.MinError <= maxerr {
ch <- c.sanity.mustNewConstMetric(1)
} else {
ch <- c.sanity.mustNewConstMetric(0)
Loading
Loading
Loading
Loading
@@ -4,3 +4,4 @@ Anton Tolchanov (knyar)
Christopher Batey (chbatey)
Meng Zhuo (mengzhuo)
Leonid Evdokimov (darkk)
Ask Bjørn Hansen (abh)
\ No newline at end of file
Loading
Loading
@@ -4,21 +4,22 @@
ntp
===
 
The ntp package is an implementation of a simple NTP client. It allows you
to connect to a remote NTP server and request the current time.
The ntp package is an implementation of a Simple NTP (SNTP) client based on
[RFC5905](https://tools.ietf.org/html/rfc5905). It allows you to connect to
a remote NTP server and request the current time.
 
To request the current time, simply do the following:
If all you care about is the current time according to a known remote NTP
server, simply use the `Time` function:
```go
time, err := ntp.Time("0.beevik-ntp.pool.ntp.org")
```
 
To request the current time along with additional metadata, use the Query
function:
If you want the time as well as additional metadata about the time, use the
`Query` function instead:
```go
response, err := ntp.Query("0.beevik-ntp.pool.ntp.org")
```
 
NB: if you want to use the NTP Pool in your software you should request your
own [vendor zone](http://www.pool.ntp.org/en/vendors.html). You **must
absolutely not use the default pool.ntp.org zone names** as the default
configuration in your application or appliance.
To use the NTP pool in your application, please request your own
[vendor zone](http://www.pool.ntp.org/en/vendors.html). Avoid using
the `[number].pool.ntp.org` zone names in your applications.
Release v0.1.1
==============
**Breaking changes**
* Removed the `MaxStratum` constant.
**Deprecations**
* Officially deprecated the `TimeV` function.
**Internal changes**
* Removed `minDispersion` from the `RootDistance` calculation, since the value
was arbitrary.
* Moved some validation into main code path so that invalid `TransmitTime` and
`mode` responses trigger an error even when `Response.Validate` is not
called.
Release v0.1.0
==============
This is the initial release of the `ntp` package. Currently it supports the following features:
* `Time()` to query the current time according to a remote NTP server.
* `Query()` to query multiple pieces of time-related information from a remote NTP server.
* `QueryWithOptions()`, which is like `Query()` but with the ability to override default query options.
Time-related information returned by the `Query` functions includes:
* `Time`: the time the server transmitted its response, according to the server's clock.
* `ClockOffset`: the estimated offset of the client's clock relative to the server's clock. You may apply this offset to any local system clock reading once the query is complete.
* `RTT`: an estimate of the round-trip-time delay between the client and the server.
* `Precision`: the precision of the server's clock reading.
* `Stratum`: the "stratum" level of the server, where 1 indicates a server directly connected to a reference clock, and values greater than 1 indicating the number of hops from the reference clock.
* `ReferenceID`: A unique identifier for the NTP server that was contacted.
* `ReferenceTime`: The time at which the server last updated its local clock setting.
* `RootDelay`: The server's round-trip delay to the reference clock.
* `RootDispersion`: The server's total dispersion to the referenced clock.
* `RootDistance`: An estimate of the root synchronization distance.
* `Leap`: The leap second indicator.
* `MinError`: A lower bound on the clock error between the client and the server.
* `Poll`: the maximum polling interval between successive messages on the server.
The `Response` structure returned by the `Query` functions also contains a `Response.Validate()` function that returns an error if any of the fields returned by the server are invalid.
This diff is collapsed.
Loading
Loading
@@ -2,12 +2,6 @@
"comment": "",
"ignore": "test",
"package": [
{
"checksumSHA1": "0Tugz8gj9KqqVj6JLkXUA7BXas4=",
"path": "github.com/sirupsen/logrus",
"revision": "0208149b40d863d2c1a2f8fe5753096a9cf2cc8b",
"revisionTime": "2017-02-27T12:44:09Z"
},
{
"checksumSHA1": "KmjnydoAbofMieIWm+it5OWERaM=",
"path": "github.com/alecthomas/template",
Loading
Loading
@@ -27,10 +21,12 @@
"revisionTime": "2015-10-22T06:55:26Z"
},
{
"checksumSHA1": "X73SC/5YR0afYD/tq802Shxb0UI=",
"checksumSHA1": "OXcULIfKv/Xcsa4o1By1lY0s+AI=",
"path": "github.com/beevik/ntp",
"revision": "74e5133786235ede462c83c17fa3b34653901719",
"revisionTime": "2017-08-25T09:16:23Z"
"revision": "802074b1b037c59dbdbee7e196ad91b51d0ec844",
"revisionTime": "2017-10-03T23:10:51Z",
"version": "v0.1.1",
"versionExact": "v0.1.1"
},
{
"checksumSHA1": "spyv5/YFBjYyZLZa1U2LBfDR8PM=",
Loading
Loading
@@ -182,6 +178,12 @@
"revision": "a66a2f8b6f3fe82a95a1bed0bb3705bac8031717",
"revisionTime": "2017-06-07T19:36:46Z"
},
{
"checksumSHA1": "0Tugz8gj9KqqVj6JLkXUA7BXas4=",
"path": "github.com/sirupsen/logrus",
"revision": "0208149b40d863d2c1a2f8fe5753096a9cf2cc8b",
"revisionTime": "2017-02-27T12:44:09Z"
},
{
"checksumSHA1": "uozMgPjB4AggpuuJkGq3FgAs4CA=",
"path": "github.com/soundcloud/go-runit/runit",
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment