Skip to content

Commit

Permalink
Fix num_remapped_pgs field in ceph plugin (influxdata#5167)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmencner authored and otherpirate committed Mar 15, 2019
1 parent d499fa4 commit 16a81db
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
16 changes: 8 additions & 8 deletions plugins/inputs/ceph/ceph.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ type CephStatus struct {
NumInOSDs float64 `json:"num_in_osds"`
Full bool `json:"full"`
NearFull bool `json:"nearfull"`
NumRemappedPGs float64 `json:"num_rempapped_pgs"`
NumRemappedPGs float64 `json:"num_remapped_pgs"`
} `json:"osdmap"`
} `json:"osdmap"`
PGMap struct {
Expand Down Expand Up @@ -373,13 +373,13 @@ func decodeStatus(acc telegraf.Accumulator, input string) error {
// decodeStatusOsdmap decodes the OSD map portion of the output of 'ceph -s'
func decodeStatusOsdmap(acc telegraf.Accumulator, data *CephStatus) error {
fields := map[string]interface{}{
"epoch": data.OSDMap.OSDMap.Epoch,
"num_osds": data.OSDMap.OSDMap.NumOSDs,
"num_up_osds": data.OSDMap.OSDMap.NumUpOSDs,
"num_in_osds": data.OSDMap.OSDMap.NumInOSDs,
"full": data.OSDMap.OSDMap.Full,
"nearfull": data.OSDMap.OSDMap.NearFull,
"num_rempapped_pgs": data.OSDMap.OSDMap.NumRemappedPGs,
"epoch": data.OSDMap.OSDMap.Epoch,
"num_osds": data.OSDMap.OSDMap.NumOSDs,
"num_up_osds": data.OSDMap.OSDMap.NumUpOSDs,
"num_in_osds": data.OSDMap.OSDMap.NumInOSDs,
"full": data.OSDMap.OSDMap.Full,
"nearfull": data.OSDMap.OSDMap.NearFull,
"num_remapped_pgs": data.OSDMap.OSDMap.NumRemappedPGs,
}
acc.AddFields("ceph_osdmap", fields, map[string]string{})
return nil
Expand Down
14 changes: 7 additions & 7 deletions plugins/inputs/ceph/ceph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -851,13 +851,13 @@ var cephStatusResults = []expectedResult{
{
metric: "ceph_osdmap",
fields: map[string]interface{}{
"epoch": float64(21734),
"num_osds": float64(24),
"num_up_osds": float64(24),
"num_in_osds": float64(24),
"full": false,
"nearfull": false,
"num_rempapped_pgs": float64(0),
"epoch": float64(21734),
"num_osds": float64(24),
"num_up_osds": float64(24),
"num_in_osds": float64(24),
"full": false,
"nearfull": false,
"num_remapped_pgs": float64(0),
},
tags: map[string]string{},
},
Expand Down

0 comments on commit 16a81db

Please sign in to comment.