Add General Read/Write operation and data
Luis Eduardo committed
Jan 24, 2018 at 23:00 UTC
1ced6c268c55e81d30a94a69ee4ceb534f1d526e
2 files changed
+58
-8
python.d/ceph.chart.py
+48
-6
@@ -16,8 +16,8 @@ update_every = 10
16
priority = 60000
17
retries = 60
18
19
-ORDER = ['general_usage', 'general_objects', 'pool_usage',
20
- 'pool_objects', 'pool_write_iops', 'pool_read_iops',
19
+ORDER = ['general_usage', 'general_objects', 'general_bytes', 'general_operations',
20
+ 'pool_usage', 'pool_objects', 'pool_write_iops', 'pool_read_iops',
21
'osd_usage', 'osd_apply_latency', 'osd_commit_latency']
22
23
CHARTS = {
@@ -29,11 +29,27 @@ CHARTS = {
29
]
30
},
31
'general_objects': {
32
- 'options': [None, 'Ceph General Objects', 'objects', 'general', 'ceph.general_objects', 'line'],
32
+ 'options': [None, 'Ceph General Objects', 'objects', 'general', 'ceph.general_objects', 'area'],
33
'lines': [
34
['general_objects', 'cluster', 'absolute']
35
]
36
},
37
+ 'general_bytes': {
38
+ 'options': [None, 'Ceph General Read/Write Data/s', 'KB', 'general', 'ceph.general_bytes',
39
+ 'area'],
40
+ 'lines': [
41
+ ['general_read_bytes', 'read', 'absolute', 1, 1024],
42
+ ['general_write_bytes', 'write', 'absolute', -1, 1024]
43
+ ]
44
+ },
45
+ 'general_operations': {
46
+ 'options': [None, 'Ceph General Read/Write Operations/s', 'operations', 'general', 'ceph.general_operations',
47
+ 'area'],
48
+ 'lines': [
49
+ ['general_read_operations', 'read', 'absolute', 1],
50
+ ['general_write_operations', 'write', 'absolute', -1]
51
+ ]
52
+ },
53
'pool_usage': {
54
'options': [None, 'Ceph Pools', 'KB', 'pool', 'ceph.pool_usage', 'line'],
55
'lines': []
@@ -43,11 +59,11 @@ CHARTS = {
59
'lines': []
60
},
61
'pool_write_iops': {
46
- 'options': [None, 'Ceph Write Pool IOPS', 'KB', 'pool', 'ceph.pool_wio', 'line'],
62
+ 'options': [None, 'Ceph Write Pool IOPS', 'KB', 'pool', 'ceph.pool_wio', 'area'],
63
'lines': []
64
},
65
'pool_read_iops': {
50
- 'options': [None, 'Ceph Read Pool IOPS', 'KB', 'pool', 'ceph.pool_rio', 'line'],
66
+ 'options': [None, 'Ceph Read Pool IOPS', 'KB', 'pool', 'ceph.pool_rio', 'area'],
67
'lines': []
68
},
69
'osd_usage': {
@@ -152,13 +168,28 @@ class Service(SimpleService):
168
:return: dict
169
"""
170
df = self._get_df()
171
+ pool_stats = self._get_osd_pool_stats()
172
general_objects = 0
173
+ read_bytes_sec = 0
174
+ write_bytes_sec = 0
175
+ read_op_per_sec = 0
176
+ write_op_per_sec = 0
177
+
178
for pool in df['pools']:
179
general_objects = general_objects + pool['stats']['objects']
180
+ for pool_rw_io_b in pool_stats:
181
+ read_bytes_sec = read_bytes_sec + pool_rw_io_b['client_io_rate'].get('read_bytes_sec', 0)
182
+ write_bytes_sec = write_bytes_sec + pool_rw_io_b['client_io_rate'].get('write_bytes_sec', 0)
183
+ read_op_per_sec = read_op_per_sec + pool_rw_io_b['client_io_rate'].get('read_op_per_sec', 0)
184
+ write_op_per_sec = write_op_per_sec + pool_rw_io_b['client_io_rate'].get('write_op_per_sec', 0)
185
186
return {'general_usage': df['stats']['total_used_bytes'],
187
'general_available': df['stats']['total_avail_bytes'],
161
- 'general_objects': general_objects
188
+ 'general_objects': general_objects,
189
+ 'general_read_bytes': read_bytes_sec,
190
+ 'general_write_bytes': write_bytes_sec,
191
+ 'general_read_operations': read_op_per_sec,
192
+ 'general_write_operations': write_op_per_sec
193
}
194
195
def _get_pool_usage(self, pool):
@@ -234,3 +265,14 @@ class Service(SimpleService):
265
'format': 'json'
266
}), '')[1])
267
268
+ def _get_osd_pool_stats(self):
269
+ """
270
+ Get ceph osd pool status.
271
+ This command is used to get information about both
272
+ read/write operation and bytes per second on each pool
273
+ :return: ceph osd pool stats --format json
274
+ """
275
+ return json.loads(self.cluster.mon_command(json.dumps({
276
+ 'prefix': 'osd pool stats',
277
+ 'format': 'json'
278
+ }), '')[1])
web/dashboard_info.js
+10
-2
@@ -1326,6 +1326,14 @@ netdataDashboard.context = {
1326
info: 'Shows cluster general objects.'
1327
},
1328
1329
+ 'ceph.general_bytes': {
1330
+ info: 'Shows cluster general read/write data per second.'
1331
+ },
1332
+
1333
+ 'ceph.general_operations': {
1334
+ info: 'Shows cluster general read/write operations per second.'
1335
+ },
1336
+
1337
'ceph.pool_usage': {
1338
info: 'Shows info about pool usage.'
1339
},
@@ -1347,11 +1355,11 @@ netdataDashboard.context = {
1355
},
1356
1357
'ceph.apply_latency': {
1350
- info: 'Shows time for an operation to get applied to the backing filesystem.'
1358
+ info: 'Time taken to flush an update to disks.'
1359
},
1360
1361
'ceph.commit_latency': {
1354
- info: 'Shows time for an operation to be applied on a OSD.'
1362
+ info: 'Time taken to commit an operation to the journal.'
1363
},
1364
1365
// ------------------------------------------------------------------------