Update changelog and tidy openntpd input
This commit is contained in:
parent
153dd585af
commit
1ad10c8a52
|
@ -11,6 +11,7 @@
|
||||||
|
|
||||||
- [docker_log](/plugins/inputs/docker_log) - Contributed by @prashanthjbabu
|
- [docker_log](/plugins/inputs/docker_log) - Contributed by @prashanthjbabu
|
||||||
- [fireboard](/plugins/inputs/fireboard) - Contributed by @ronnocol
|
- [fireboard](/plugins/inputs/fireboard) - Contributed by @ronnocol
|
||||||
|
- [openntpd](/plugins/inputs/openntpd) - Contributed by @aromeyer
|
||||||
- [uwsgi](/plugins/inputs/uswgi) - Contributed by @blaggacao
|
- [uwsgi](/plugins/inputs/uswgi) - Contributed by @blaggacao
|
||||||
|
|
||||||
#### New Parsers
|
#### New Parsers
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
# OpenNTPD Input Plugin
|
# OpenNTPD Input Plugin
|
||||||
|
|
||||||
Get standard NTP query metrics from OpenNTPD ([OpenNTPD - a FREE, easy to use
|
Get standard NTP query metrics from [OpenNTPD][] using the ntpctl command.
|
||||||
implementation of the Network Time Protocol](http://www.openntpd.org/)).
|
|
||||||
|
[OpenNTPD]: http://www.openntpd.org/
|
||||||
|
|
||||||
Below is the documentation of the various headers returned from the NTP query
|
Below is the documentation of the various headers returned from the NTP query
|
||||||
command when running `ntpctl -s peers`.
|
command when running `ntpctl -s peers`.
|
||||||
|
@ -19,40 +20,36 @@ the remote peer or server (RMS, milliseconds);
|
||||||
- jitter – Mean deviation (jitter) in the time reported for that remote peer or
|
- jitter – Mean deviation (jitter) in the time reported for that remote peer or
|
||||||
server (RMS of difference of multiple time samples, milliseconds);
|
server (RMS of difference of multiple time samples, milliseconds);
|
||||||
|
|
||||||
### Configuration:
|
### Configuration
|
||||||
|
|
||||||
```toml
|
```toml
|
||||||
# Get standard NTP query metrics, requires ntpctls executable
|
|
||||||
# provided by openntpd packages
|
|
||||||
[[inputs.openntpd]]
|
[[inputs.openntpd]]
|
||||||
## If running as a restricted user you can prepend sudo for additional access:
|
## Run ntpctl binary with sudo.
|
||||||
#use_sudo = false
|
# use_sudo = false
|
||||||
|
|
||||||
## The default location of the ntpctl binary can be overridden with:
|
## Location of the ntpctl binary.
|
||||||
binary = "/usr/sbin/ntpctl"
|
# binary = "/usr/sbin/ntpctl"
|
||||||
|
|
||||||
## The default timeout of 1000ms can be overriden with (in milliseconds):
|
## Maximum time the ntpctl binary is allowed to run.
|
||||||
#timeout = 1000
|
# timeout = "5ms"
|
||||||
```
|
```
|
||||||
|
|
||||||
### Measurements & Fields:
|
### Metrics
|
||||||
|
|
||||||
- ntpctl
|
- ntpctl
|
||||||
- delay (float, milliseconds)
|
- tags:
|
||||||
- jitter (float, milliseconds)
|
- remote
|
||||||
- offset (float, milliseconds)
|
- stratum
|
||||||
- poll (int, seconds)
|
- fields:
|
||||||
- next (int,,seconds)
|
- delay (float, milliseconds)
|
||||||
- wt (int)
|
- jitter (float, milliseconds)
|
||||||
- tl (int)
|
- offset (float, milliseconds)
|
||||||
|
- poll (int, seconds)
|
||||||
|
- next (int, seconds)
|
||||||
|
- wt (int)
|
||||||
|
- tl (int)
|
||||||
|
|
||||||
### Tags:
|
### Permissions
|
||||||
|
|
||||||
- All measurements have the following tags:
|
|
||||||
- remote
|
|
||||||
- stratum
|
|
||||||
|
|
||||||
### Permissions:
|
|
||||||
|
|
||||||
It's important to note that this plugin references ntpctl, which may require
|
It's important to note that this plugin references ntpctl, which may require
|
||||||
additional permissions to execute successfully.
|
additional permissions to execute successfully.
|
||||||
|
@ -80,17 +77,17 @@ If you use this method, you will need the following in your telegraf config:
|
||||||
You will also need to update your sudoers file:
|
You will also need to update your sudoers file:
|
||||||
```bash
|
```bash
|
||||||
$ visudo
|
$ visudo
|
||||||
# Add the following line:
|
# Add the following lines:
|
||||||
telegraf ALL=(ALL) NOPASSWD: /usr/sbin/ntpctl
|
Cmnd_Alias NTPCTL = /usr/sbin/ntpctl
|
||||||
|
telegraf ALL=(ALL) NOPASSWD: NTPCTL
|
||||||
|
Defaults!NTPCTL !logfile, !syslog, !pam_session
|
||||||
```
|
```
|
||||||
|
|
||||||
Please use the solution you see as most appropriate.
|
Please use the solution you see as most appropriate.
|
||||||
|
|
||||||
### Example Output:
|
### Example Output
|
||||||
|
|
||||||
```
|
```
|
||||||
$ telegraf --config ~/ws/telegraf.conf --input-filter openntpd --test
|
openntpd,remote=194.57.169.1,stratum=2,host=localhost tl=10i,poll=1007i,
|
||||||
* Plugin: openntpd, Collection 1
|
|
||||||
> openntpd,remote=194.57.169.1,stratum=2,host=localhost tl=10i,poll=1007i,
|
|
||||||
offset=2.295,jitter=3.896,delay=53.766,next=266i,wt=1i 1514454299000000000
|
offset=2.295,jitter=3.896,delay=53.766,next=266i,wt=1i 1514454299000000000
|
||||||
```
|
```
|
||||||
|
|
|
@ -53,7 +53,7 @@ type Openntpd struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
var defaultBinary = "/usr/sbin/ntpctl"
|
var defaultBinary = "/usr/sbin/ntpctl"
|
||||||
var defaultTimeout = internal.Duration{Duration: time.Second}
|
var defaultTimeout = internal.Duration{Duration: 5 * time.Second}
|
||||||
|
|
||||||
func (n *Openntpd) Description() string {
|
func (n *Openntpd) Description() string {
|
||||||
return "Get standard NTP query metrics from OpenNTPD."
|
return "Get standard NTP query metrics from OpenNTPD."
|
||||||
|
@ -61,14 +61,14 @@ func (n *Openntpd) Description() string {
|
||||||
|
|
||||||
func (n *Openntpd) SampleConfig() string {
|
func (n *Openntpd) SampleConfig() string {
|
||||||
return `
|
return `
|
||||||
## If running as a restricted user you can prepend sudo for additional access:
|
## Run ntpctl binary with sudo.
|
||||||
#use_sudo = false
|
# use_sudo = false
|
||||||
|
|
||||||
## The default location of the ntpctl binary can be overridden with:
|
## Location of the ntpctl binary.
|
||||||
binary = "/usr/sbin/ntpctl"
|
# binary = "/usr/sbin/ntpctl"
|
||||||
|
|
||||||
## The default timeout of 1000ms can be overriden with (in milliseconds):
|
## Maximum time the ntpctl binary is allowed to run.
|
||||||
timeout = 1000
|
# timeout = "5ms"
|
||||||
`
|
`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -135,12 +135,12 @@ func (n *Openntpd) Gather(acc telegraf.Accumulator) error {
|
||||||
// if there is an ntpctl state prefix, remove it and make it it's own tag
|
// if there is an ntpctl state prefix, remove it and make it it's own tag
|
||||||
if strings.ContainsAny(string(fields[0]), "*") {
|
if strings.ContainsAny(string(fields[0]), "*") {
|
||||||
tags["state_prefix"] = string(fields[0])
|
tags["state_prefix"] = string(fields[0])
|
||||||
fields = append(fields[:0], fields[1:]...)
|
fields = fields[1:]
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get tags from output
|
// Get tags from output
|
||||||
for key, index := range tagI {
|
for key, index := range tagI {
|
||||||
if len(fields) < index {
|
if index >= len(fields) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
tags[key] = fields[index]
|
tags[key] = fields[index]
|
||||||
|
|
Loading…
Reference in New Issue