Fix num_remapped_pgs field in ceph plugin (#5167)

This commit is contained in:
Maciej Mencner 2018-12-19 15:51:24 -08:00 committed by Daniel Nelson
parent 9bf2ef28f5
commit e85e6bd3e7
2 changed files with 15 additions and 15 deletions

View File

@ -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 {
@ -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

View File

@ -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{},
},