Skip to content

Commit

Permalink
Add read and write op per second fields (influxdata#5210)
Browse files Browse the repository at this point in the history
  • Loading branch information
svenwiltink authored and otherpirate committed Mar 15, 2019
1 parent 5a4da32 commit e90a67a
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 25 deletions.
8 changes: 6 additions & 2 deletions plugins/inputs/ceph/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,9 @@ All fields are collected under the **ceph** measurement and stored as float64s.
* bytes\_used (float)
* data\_bytes (float)
* num\_pgs (float)
* op\_per\_sec (float)
* op\_per\_sec (float, ceph < 10)
* read_op\_per\_sec (float)
* write_op\_per\_sec (float)
* read\_bytes\_sec (float)
* version (float)
* write\_bytes\_sec (float)
Expand All @@ -132,7 +134,9 @@ All fields are collected under the **ceph** measurement and stored as float64s.
* objects (float)

* ceph\_pool\_stats
* op\_per\_sec (float)
* op\_per\_sec (float, ceph < 10)
* read_op\_per\_sec (float)
* write_op\_per\_sec (float)
* read\_bytes\_sec (float)
* write\_bytes\_sec (float)
* recovering\_object\_per\_sec (float)
Expand Down
32 changes: 20 additions & 12 deletions plugins/inputs/ceph/ceph.go
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,9 @@ type CephStatus struct {
BytesTotal float64 `json:"bytes_total"`
ReadBytesSec float64 `json:"read_bytes_sec"`
WriteBytesSec float64 `json:"write_bytes_sec"`
OpPerSec float64 `json:"op_per_sec"`
OpPerSec float64 `json:"op_per_sec"` // This field is no longer reported in ceph 10 and later
ReadOpPerSec float64 `json:"read_op_per_sec"`
WriteOpPerSec float64 `json:"write_op_per_sec"`
} `json:"pgmap"`
}

Expand Down Expand Up @@ -388,15 +390,17 @@ func decodeStatusOsdmap(acc telegraf.Accumulator, data *CephStatus) error {
// decodeStatusPgmap decodes the PG map portion of the output of 'ceph -s'
func decodeStatusPgmap(acc telegraf.Accumulator, data *CephStatus) error {
fields := map[string]interface{}{
"version": data.PGMap.Version,
"num_pgs": data.PGMap.NumPGs,
"data_bytes": data.PGMap.DataBytes,
"bytes_used": data.PGMap.BytesUsed,
"bytes_avail": data.PGMap.BytesAvail,
"bytes_total": data.PGMap.BytesTotal,
"read_bytes_sec": data.PGMap.ReadBytesSec,
"write_bytes_sec": data.PGMap.WriteBytesSec,
"op_per_sec": data.PGMap.OpPerSec,
"version": data.PGMap.Version,
"num_pgs": data.PGMap.NumPGs,
"data_bytes": data.PGMap.DataBytes,
"bytes_used": data.PGMap.BytesUsed,
"bytes_avail": data.PGMap.BytesAvail,
"bytes_total": data.PGMap.BytesTotal,
"read_bytes_sec": data.PGMap.ReadBytesSec,
"write_bytes_sec": data.PGMap.WriteBytesSec,
"op_per_sec": data.PGMap.OpPerSec, // This field is no longer reported in ceph 10 and later
"read_op_per_sec": data.PGMap.ReadOpPerSec,
"write_op_per_sec": data.PGMap.WriteOpPerSec,
}
acc.AddFields("ceph_pgmap", fields, map[string]string{})
return nil
Expand Down Expand Up @@ -470,7 +474,9 @@ type CephOSDPoolStats []struct {
ClientIORate struct {
ReadBytesSec float64 `json:"read_bytes_sec"`
WriteBytesSec float64 `json:"write_bytes_sec"`
OpPerSec float64 `json:"op_per_sec"`
OpPerSec float64 `json:"op_per_sec"` // This field is no longer reported in ceph 10 and later
ReadOpPerSec float64 `json:"read_op_per_sec"`
WriteOpPerSec float64 `json:"write_op_per_sec"`
} `json:"client_io_rate"`
RecoveryRate struct {
RecoveringObjectsPerSec float64 `json:"recovering_objects_per_sec"`
Expand All @@ -494,7 +500,9 @@ func decodeOsdPoolStats(acc telegraf.Accumulator, input string) error {
fields := map[string]interface{}{
"read_bytes_sec": pool.ClientIORate.ReadBytesSec,
"write_bytes_sec": pool.ClientIORate.WriteBytesSec,
"op_per_sec": pool.ClientIORate.OpPerSec,
"op_per_sec": pool.ClientIORate.OpPerSec, // This field is no longer reported in ceph 10 and later
"read_op_per_sec": pool.ClientIORate.ReadOpPerSec,
"write_op_per_sec": pool.ClientIORate.WriteOpPerSec,
"recovering_objects_per_sec": pool.RecoveryRate.RecoveringObjectsPerSec,
"recovering_bytes_per_sec": pool.RecoveryRate.RecoveringBytesPerSec,
"recovering_keys_per_sec": pool.RecoveryRate.RecoveringKeysPerSec,
Expand Down
32 changes: 21 additions & 11 deletions plugins/inputs/ceph/ceph_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -835,7 +835,9 @@ var clusterStatusDump = `
"bytes_total": 17335810048000,
"read_bytes_sec": 0,
"write_bytes_sec": 367217,
"op_per_sec": 98
"op_per_sec": 98,
"read_op_per_sec": 322,
"write_op_per_sec": 1022
},
"mdsmap": {
"epoch": 1,
Expand Down Expand Up @@ -864,15 +866,17 @@ var cephStatusResults = []expectedResult{
{
metric: "ceph_pgmap",
fields: map[string]interface{}{
"version": float64(52314277),
"num_pgs": float64(2560),
"data_bytes": float64(2700031960713),
"bytes_used": float64(7478347665408),
"bytes_avail": float64(9857462382592),
"bytes_total": float64(17335810048000),
"read_bytes_sec": float64(0),
"write_bytes_sec": float64(367217),
"op_per_sec": float64(98),
"version": float64(52314277),
"num_pgs": float64(2560),
"data_bytes": float64(2700031960713),
"bytes_used": float64(7478347665408),
"bytes_avail": float64(9857462382592),
"bytes_total": float64(17335810048000),
"read_bytes_sec": float64(0),
"write_bytes_sec": float64(367217),
"op_per_sec": float64(98),
"read_op_per_sec": float64(322),
"write_op_per_sec": float64(1022),
},
tags: map[string]string{},
},
Expand Down Expand Up @@ -1014,7 +1018,9 @@ var cephODSPoolStatsDump = `
"recovering_keys_per_sec": 0},
"client_io_rate": { "read_bytes_sec": 10566067,
"write_bytes_sec": 15165220376,
"op_per_sec": 9828}}]`
"op_per_sec": 9828,
"read_op_per_sec": 182,
"write_op_per_sec": 473}}]`

var cephOSDPoolStatsResults = []expectedResult{
{
Expand All @@ -1023,6 +1029,8 @@ var cephOSDPoolStatsResults = []expectedResult{
"read_bytes_sec": float64(0),
"write_bytes_sec": float64(0),
"op_per_sec": float64(0),
"read_op_per_sec": float64(0),
"write_op_per_sec": float64(0),
"recovering_objects_per_sec": float64(0),
"recovering_bytes_per_sec": float64(0),
"recovering_keys_per_sec": float64(0),
Expand All @@ -1037,6 +1045,8 @@ var cephOSDPoolStatsResults = []expectedResult{
"read_bytes_sec": float64(10566067),
"write_bytes_sec": float64(15165220376),
"op_per_sec": float64(9828),
"read_op_per_sec": float64(182),
"write_op_per_sec": float64(473),
"recovering_objects_per_sec": float64(279),
"recovering_bytes_per_sec": float64(176401059),
"recovering_keys_per_sec": float64(0),
Expand Down

0 comments on commit e90a67a

Please sign in to comment.