Skip to content

Commit

Permalink
Fix chrony plugin does not track system time offset (#2989)
Browse files Browse the repository at this point in the history
(cherry picked from commit 9f244cf)
  • Loading branch information
subfxnet authored and danielnelson committed Jul 11, 2017
1 parent 6751718 commit c6e2500
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion plugins/inputs/chrony/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ Delete second or Not synchronised.
### Measurements & Fields:

- chrony
- system_time (float, seconds)
- last_offset (float, seconds)
- rms_offset (float, seconds)
- frequency (float, ppm)
Expand All @@ -84,7 +85,7 @@ Delete second or Not synchronised.
```
$ telegraf -config telegraf.conf -input-filter chrony -test
* Plugin: chrony, Collection 1
> chrony,leap_status=normal,reference_id=192.168.1.1,stratum=3 frequency=-35.657,last_offset=-0.000013616,residual_freq=-0,rms_offset=0.000027073,root_delay=0.000644,root_dispersion=0.003444,skew=0.001,update_interval=1031.2 1463750789687639161
> chrony,leap_status=normal,reference_id=192.168.1.1,stratum=3 frequency=-35.657,system_time=0.000027073,last_offset=-0.000013616,residual_freq=-0,rms_offset=0.000027073,root_delay=0.000644,root_dispersion=0.003444,skew=0.001,update_interval=1031.2 1463750789687639161
```


Expand Down
2 changes: 1 addition & 1 deletion plugins/inputs/chrony/chrony.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func processChronycOutput(out string) (map[string]interface{}, map[string]string
}
name := strings.ToLower(strings.Replace(strings.TrimSpace(stats[0]), " ", "_", -1))
// ignore reference time
if strings.Contains(name, "time") {
if strings.Contains(name, "ref_time") {
continue
}
valueFields := strings.Fields(stats[1])
Expand Down
1 change: 1 addition & 0 deletions plugins/inputs/chrony/chrony_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ func TestGather(t *testing.T) {
"stratum": "3",
}
fields := map[string]interface{}{
"system_time": 0.000020390,
"last_offset": 0.000012651,
"rms_offset": 0.000025577,
"frequency": -16.001,
Expand Down

0 comments on commit c6e2500

Please sign in to comment.