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
|
||||
- [fireboard](/plugins/inputs/fireboard) - Contributed by @ronnocol
|
||||
- [openntpd](/plugins/inputs/openntpd) - Contributed by @aromeyer
|
||||
- [uwsgi](/plugins/inputs/uswgi) - Contributed by @blaggacao
|
||||
|
||||
#### New Parsers
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
# OpenNTPD Input Plugin
|
||||
|
||||
Get standard NTP query metrics from OpenNTPD ([OpenNTPD - a FREE, easy to use
|
||||
implementation of the Network Time Protocol](http://www.openntpd.org/)).
|
||||
Get standard NTP query metrics from [OpenNTPD][] using the ntpctl command.
|
||||
|
||||
[OpenNTPD]: http://www.openntpd.org/
|
||||
|
||||
Below is the documentation of the various headers returned from the NTP query
|
||||
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
|
||||
server (RMS of difference of multiple time samples, milliseconds);
|
||||
|
||||
### Configuration:
|
||||
### Configuration
|
||||
|
||||
```toml
|
||||
# Get standard NTP query metrics, requires ntpctls executable
|
||||
# provided by openntpd packages
|
||||
[[inputs.openntpd]]
|
||||
## If running as a restricted user you can prepend sudo for additional access:
|
||||
#use_sudo = false
|
||||
## Run ntpctl binary with sudo.
|
||||
# use_sudo = false
|
||||
|
||||
## The default location of the ntpctl binary can be overridden with:
|
||||
binary = "/usr/sbin/ntpctl"
|
||||
## Location of the ntpctl binary.
|
||||
# binary = "/usr/sbin/ntpctl"
|
||||
|
||||
## The default timeout of 1000ms can be overriden with (in milliseconds):
|
||||
#timeout = 1000
|
||||
## Maximum time the ntpctl binary is allowed to run.
|
||||
# timeout = "5ms"
|
||||
```
|
||||
|
||||
### Measurements & Fields:
|
||||
### Metrics
|
||||
|
||||
- ntpctl
|
||||
- tags:
|
||||
- remote
|
||||
- stratum
|
||||
- fields:
|
||||
- delay (float, milliseconds)
|
||||
- jitter (float, milliseconds)
|
||||
- offset (float, milliseconds)
|
||||
- poll (int, seconds)
|
||||
- next (int,,seconds)
|
||||
- next (int, seconds)
|
||||
- wt (int)
|
||||
- tl (int)
|
||||
|
||||
### Tags:
|
||||
|
||||
- All measurements have the following tags:
|
||||
- remote
|
||||
- stratum
|
||||
|
||||
### Permissions:
|
||||
### Permissions
|
||||
|
||||
It's important to note that this plugin references ntpctl, which may require
|
||||
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:
|
||||
```bash
|
||||
$ visudo
|
||||
# Add the following line:
|
||||
telegraf ALL=(ALL) NOPASSWD: /usr/sbin/ntpctl
|
||||
# Add the following lines:
|
||||
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.
|
||||
|
||||
### Example Output:
|
||||
### Example Output
|
||||
|
||||
```
|
||||
$ telegraf --config ~/ws/telegraf.conf --input-filter openntpd --test
|
||||
* Plugin: openntpd, Collection 1
|
||||
> openntpd,remote=194.57.169.1,stratum=2,host=localhost tl=10i,poll=1007i,
|
||||
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
|
||||
```
|
||||
|
|
|
@ -53,7 +53,7 @@ type Openntpd struct {
|
|||
}
|
||||
|
||||
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 {
|
||||
return "Get standard NTP query metrics from OpenNTPD."
|
||||
|
@ -61,14 +61,14 @@ func (n *Openntpd) Description() string {
|
|||
|
||||
func (n *Openntpd) SampleConfig() string {
|
||||
return `
|
||||
## If running as a restricted user you can prepend sudo for additional access:
|
||||
#use_sudo = false
|
||||
## Run ntpctl binary with sudo.
|
||||
# use_sudo = false
|
||||
|
||||
## The default location of the ntpctl binary can be overridden with:
|
||||
binary = "/usr/sbin/ntpctl"
|
||||
## Location of the ntpctl binary.
|
||||
# binary = "/usr/sbin/ntpctl"
|
||||
|
||||
## The default timeout of 1000ms can be overriden with (in milliseconds):
|
||||
timeout = 1000
|
||||
## Maximum time the ntpctl binary is allowed to run.
|
||||
# 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 strings.ContainsAny(string(fields[0]), "*") {
|
||||
tags["state_prefix"] = string(fields[0])
|
||||
fields = append(fields[:0], fields[1:]...)
|
||||
fields = fields[1:]
|
||||
}
|
||||
|
||||
// Get tags from output
|
||||
for key, index := range tagI {
|
||||
if len(fields) < index {
|
||||
if index >= len(fields) {
|
||||
continue
|
||||
}
|
||||
tags[key] = fields[index]
|
||||
|
|
Loading…
Reference in New Issue