@cryptotaxi247 / netdata-1 / commits / 3938fa306

Python.d PEP 8 cleanup, modules M (#4289)

* python.d/mdstat.chart.py PEP 8 cleanups Fixes formatting for container literals and quoting of strings. * python.d/megacli.chart.py PEP 8 cleanup Fixes quoting of strings and formatting of container literals. * python.d/memcached.chart.py PEP 8 cleanup Fixes string quoting and formatting of container literals. * python.d/mongodb.chart.py PEP 8 cleanup Fixes string quoting and formatting of container literals. * python.d/monit.chart.py PEP 8 cleanup Fixes quoting of strings and formatting of container literals. * python.d/mysql.chart.py PEP 8 cleanups Fix formatting of container literals and usage of blank lines.

Austin S. Hemmelgarn committed Sep 27, 2018 at 07:03 UTC 3938fa3065830d79705d08856f1ab4f8c0431cf8
6 files changed +430 -274
python.d/mdstat.chart.py
+9 -8
@@ -17,7 +17,7 @@ ORDER = ['mdstat_health']
17 CHARTS = {
18 'mdstat_health': {
19 'options': [None, 'Faulty Devices In MD', 'failed disks', 'health', 'md.health', 'line'],
20 - 'lines': list()
20 + 'lines': []
21 }
22 }
23
@@ -33,12 +33,13 @@ RE_STATUS = re.compile(r' (?P<array>[a-zA-Z_0-9]+) : active .+ '
33
34
35 def md_charts(name):
36 - order = ['{0}_disks'.format(name),
37 - '{0}_operation'.format(name),
38 - '{0}_mismatch_cnt'.format(name),
39 - '{0}_finish'.format(name),
40 - '{0}_speed'.format(name)
41 - ]
36 + order = [
37 + '{0}_disks'.format(name),
38 + '{0}_operation'.format(name),
39 + '{0}_mismatch_cnt'.format(name),
40 + '{0}_finish'.format(name),
41 + '{0}_speed'.format(name)
42 + ]
43
44 charts = dict()
45 charts[order[0]] = {
@@ -85,7 +86,7 @@ def md_charts(name):
86
87 class MD:
88 def __init__(self, raw_data):
88 - self.name = raw_data["array"]
89 + self.name = raw_data['array']
90 self.d = raw_data
91
92 def data(self):
python.d/megacli.chart.py
+14 -17
@@ -23,8 +23,7 @@ def adapter_charts(ads):
23
24 charts = {
25 'adapter_degraded': {
26 - 'options': [
27 - None, 'Adapter State', 'is degraded', 'adapter', 'megacli.adapter_degraded', 'line'],
26 + 'options': [None, 'Adapter State', 'is degraded', 'adapter', 'megacli.adapter_degraded', 'line'],
27 'lines': dims(ads)
28 },
29 }
@@ -43,15 +42,14 @@ def pd_charts(pds):
42
43 charts = {
44 'pd_media_error': {
46 - 'options': [
47 - None, 'Physical Drives Media Errors', 'errors/s', 'pd', 'megacli.pd_media_error', 'line'
48 - ],
49 - 'lines': dims("media_error", pds)},
45 + 'options': [None, 'Physical Drives Media Errors', 'errors/s', 'pd', 'megacli.pd_media_error', 'line'],
46 + 'lines': dims('media_error', pds)
47 + },
48 'pd_predictive_failure': {
51 - 'options': [
52 - None, 'Physical Drives Predictive Failures', 'failures/s', 'pd', 'megacli.pd_predictive_failure', 'line'
53 - ],
54 - 'lines': dims("predictive_failure", pds)}
49 + 'options': [None, 'Physical Drives Predictive Failures', 'failures/s', 'pd',
50 + 'megacli.pd_predictive_failure', 'line'],
51 + 'lines': dims('predictive_failure', pds)
52 + }
53 }
54
55 return order, charts
@@ -66,8 +64,8 @@ def battery_charts(bats):
64 charts.update(
65 {
66 'bbu_{0}_relative_charge'.format(b.id): {
69 - 'options': [
70 - None, 'Relative State of Charge', '%', 'battery', 'megacli.bbu_relative_charge', 'line'],
67 + 'options': [None, 'Relative State of Charge', '%', 'battery',
68 + 'megacli.bbu_relative_charge', 'line'],
69 'lines': [
70 ['bbu_{0}_relative_charge'.format(b.id), 'adapter {0}'.format(b.id)],
71 ]
@@ -80,8 +78,7 @@ def battery_charts(bats):
78 charts.update(
79 {
80 'bbu_{0}_cycle_count'.format(b.id): {
83 - 'options': [
84 - None, 'Cycle Count', 'cycle count', 'battery', 'megacli.bbu_cycle_count', 'line'],
81 + 'options': [None, 'Cycle Count', 'cycle count', 'battery', 'megacli.bbu_cycle_count', 'line'],
82 'lines': [
83 ['bbu_{0}_cycle_count'.format(b.id), 'adapter {0}'.format(b.id)],
84 ]
@@ -106,13 +103,13 @@ RE_BATTERY = re.compile(
103
104
105 def find_adapters(d):
109 - keys = ("Adapter #", "State")
106 + keys = ('Adapter #', 'State')
107 d = ' '.join(v.strip() for v in d if v.startswith(keys))
108 return [Adapter(*v) for v in RE_ADAPTER.findall(d)]
109
110
111 def find_pds(d):
115 - keys = ("Slot Number", "Media Error Count", "Predictive Failure Count")
112 + keys = ('Slot Number', 'Media Error Count', 'Predictive Failure Count')
113 d = ' '.join(v.strip() for v in d if v.startswith(keys))
114 return [PD(*v) for v in RE_VD.findall(d)]
115
@@ -131,7 +128,7 @@ class Adapter:
128 def data(self):
129 return {
130 'adapter_{0}_degraded'.format(self.id): self.state,
134 - }
131 + }
132
133
134 class PD:
python.d/memcached.chart.py
+36 -22
@@ -29,92 +29,106 @@ CHARTS = {
29 'lines': [
30 ['avail', 'available', 'absolute', 1, 1048576],
31 ['used', 'used', 'absolute', 1, 1048576]
32 - ]},
32 + ]
33 + },
34 'net': {
35 'options': [None, 'Network', 'kilobits/s', 'network', 'memcached.net', 'area'],
36 'lines': [
37 ['bytes_read', 'in', 'incremental', 8, 1024],
38 ['bytes_written', 'out', 'incremental', -8, 1024]
38 - ]},
39 + ]
40 + },
41 'connections': {
42 'options': [None, 'Connections', 'connections/s', 'connections', 'memcached.connections', 'line'],
43 'lines': [
44 ['curr_connections', 'current', 'incremental'],
45 ['rejected_connections', 'rejected', 'incremental'],
46 ['total_connections', 'total', 'incremental']
45 - ]},
47 + ]
48 + },
49 'items': {
50 'options': [None, 'Items', 'items', 'items', 'memcached.items', 'line'],
51 'lines': [
52 ['curr_items', 'current', 'absolute'],
53 ['total_items', 'total', 'absolute']
51 - ]},
54 + ]
55 + },
56 'evicted_reclaimed': {
57 'options': [None, 'Items', 'items', 'items', 'memcached.evicted_reclaimed', 'line'],
58 'lines': [
59 ['reclaimed', 'reclaimed', 'absolute'],
60 ['evictions', 'evicted', 'absolute']
57 - ]},
61 + ]
62 + },
63 'get': {
64 'options': [None, 'Requests', 'requests', 'get ops', 'memcached.get', 'stacked'],
65 'lines': [
66 ['get_hits', 'hits', 'percent-of-absolute-row'],
67 ['get_misses', 'misses', 'percent-of-absolute-row']
63 - ]},
68 + ]
69 + },
70 'get_rate': {
71 'options': [None, 'Rate', 'requests/s', 'get ops', 'memcached.get_rate', 'line'],
72 'lines': [
73 ['cmd_get', 'rate', 'incremental']
68 - ]},
74 + ]
75 + },
76 'set_rate': {
77 'options': [None, 'Rate', 'requests/s', 'set ops', 'memcached.set_rate', 'line'],
78 'lines': [
79 ['cmd_set', 'rate', 'incremental']
73 - ]},
80 + ]
81 + },
82 'delete': {
83 'options': [None, 'Requests', 'requests', 'delete ops', 'memcached.delete', 'stacked'],
84 'lines': [
85 ['delete_hits', 'hits', 'percent-of-absolute-row'],
86 ['delete_misses', 'misses', 'percent-of-absolute-row'],
79 - ]},
87 + ]
88 + },
89 'cas': {
90 'options': [None, 'Requests', 'requests', 'check and set ops', 'memcached.cas', 'stacked'],
91 'lines': [
92 ['cas_hits', 'hits', 'percent-of-absolute-row'],
93 ['cas_misses', 'misses', 'percent-of-absolute-row'],
94 ['cas_badval', 'bad value', 'percent-of-absolute-row']
86 - ]},
95 + ]
96 + },
97 'increment': {
98 'options': [None, 'Requests', 'requests', 'increment ops', 'memcached.increment', 'stacked'],
99 'lines': [
100 ['incr_hits', 'hits', 'percent-of-absolute-row'],
101 ['incr_misses', 'misses', 'percent-of-absolute-row']
92 - ]},
102 + ]
103 + },
104 'decrement': {
105 'options': [None, 'Requests', 'requests', 'decrement ops', 'memcached.decrement', 'stacked'],
106 'lines': [
107 ['decr_hits', 'hits', 'percent-of-absolute-row'],
108 ['decr_misses', 'misses', 'percent-of-absolute-row']
98 - ]},
109 + ]
110 + },
111 'touch': {
112 'options': [None, 'Requests', 'requests', 'touch ops', 'memcached.touch', 'stacked'],
113 'lines': [
114 ['touch_hits', 'hits', 'percent-of-absolute-row'],
115 ['touch_misses', 'misses', 'percent-of-absolute-row']
104 - ]},
116 + ]
117 + },
118 'touch_rate': {
119 'options': [None, 'Rate', 'requests/s', 'touch ops', 'memcached.touch_rate', 'line'],
120 'lines': [
121 ['cmd_touch', 'rate', 'incremental']
109 - ]}
122 + ]
123 + }
124 }
125
126
127 class Service(SocketService):
128 def __init__(self, configuration=None, name=None):
129 SocketService.__init__(self, configuration=configuration, name=name)
116 - self.request = "stats\r\n"
117 - self.host = "localhost"
130 + self.request = 'stats\r\n'
131 + self.host = 'localhost'
132 self.port = 11211
133 self._keep_alive = True
134 self.unix_socket = None
@@ -132,13 +146,13 @@ class Service(SocketService):
146 return None
147
148 if response.startswith('ERROR'):
135 - self.error("received ERROR")
149 + self.error('received ERROR')
150 return None
151
152 try:
139 - parsed = response.split("\n")
153 + parsed = response.split('\n')
154 except AttributeError:
141 - self.error("response is invalid/empty")
155 + self.error('response is invalid/empty')
156 return None
157
158 # split the response
@@ -149,7 +163,7 @@ class Service(SocketService):
163 t = line[5:].split(' ')
164 data[t[0]] = t[1]
165 except (IndexError, ValueError):
152 - self.debug("invalid line received: " + str(line))
166 + self.debug('invalid line received: ' + str(line))
167
168 if not data:
169 self.error("received data doesn't have any records")
@@ -166,10 +180,10 @@ class Service(SocketService):
180
181 def _check_raw_data(self, data):
182 if data.endswith('END\r\n'):
169 - self.debug("received full response from memcached")
183 + self.debug('received full response from memcached')
184 return True
185
172 - self.debug("waiting more data from memcached")
186 + self.debug('waiting more data from memcached')
187 return False
188
189 def check(self):
python.d/mongodb.chart.py
+93 -39
@@ -32,7 +32,8 @@ REPL_SET_STATES = [
32 ('6', 'unknown'),
33 ('9', 'rollback'),
34 ('10', 'removed'),
35 - ('0', 'startup')]
35 + ('0', 'startup')
36 +]
37
38
39 def multiply_by_100(value):
@@ -142,12 +143,37 @@ DBSTATS = [
143 ]
144
145 # charts order (can be overridden if you want less charts, or different order)
145 -ORDER = ['read_operations', 'write_operations', 'active_clients', 'journaling_transactions',
146 - 'journaling_volume', 'background_flush_average', 'background_flush_last', 'background_flush_rate',
147 - 'wiredtiger_read', 'wiredtiger_write', 'cursors', 'connections', 'memory', 'page_faults',
148 - 'queued_requests', 'record_moves', 'wiredtiger_cache', 'wiredtiger_pages_evicted', 'asserts',
149 - 'locks_collection', 'locks_database', 'locks_global', 'locks_metadata', 'locks_oplog',
150 - 'dbstats_objects', 'tcmalloc_generic', 'tcmalloc_metrics', 'command_total_rate', 'command_failed_rate']
146 +ORDER = [
147 + 'read_operations',
148 + 'write_operations',
149 + 'active_clients',
150 + 'journaling_transactions',
151 + 'journaling_volume',
152 + 'background_flush_average',
153 + 'background_flush_last',
154 + 'background_flush_rate',
155 + 'wiredtiger_read',
156 + 'wiredtiger_write',
157 + 'cursors',
158 + 'connections',
159 + 'memory',
160 + 'page_faults',
161 + 'queued_requests',
162 + 'record_moves',
163 + 'wiredtiger_cache',
164 + 'wiredtiger_pages_evicted',
165 + 'asserts',
166 + 'locks_collection',
167 + 'locks_database',
168 + 'locks_global',
169 + 'locks_metadata',
170 + 'locks_oplog',
171 + 'dbstats_objects',
172 + 'tcmalloc_generic',
173 + 'tcmalloc_metrics',
174 + 'command_total_rate',
175 + 'command_failed_rate'
176 +]
177
178 CHARTS = {
179 'read_operations': {
@@ -156,7 +182,8 @@ CHARTS = {
182 'lines': [
183 ['query', None, 'incremental'],
184 ['getmore', None, 'incremental']
159 - ]},
185 + ]
186 + },
187 'write_operations': {
188 'options': [None, 'Received write requests', 'requests/s', 'throughput metrics',
189 'mongodb.write_operations', 'line'],
@@ -164,57 +191,66 @@ CHARTS = {
191 ['insert', None, 'incremental'],
192 ['update', None, 'incremental'],
193 ['delete', None, 'incremental']
167 - ]},
194 + ]
195 + },
196 'active_clients': {
197 'options': [None, 'Clients with read or write operations in progress or queued', 'clients',
198 'throughput metrics', 'mongodb.active_clients', 'line'],
199 'lines': [
200 ['activeClients_readers', 'readers', 'absolute'],
201 ['activeClients_writers', 'writers', 'absolute']
174 - ]},
202 + ]
203 + },
204 'journaling_transactions': {
205 'options': [None, 'Transactions that have been written to the journal', 'commits',
206 'database performance', 'mongodb.journaling_transactions', 'line'],
207 'lines': [
208 ['commits', None, 'absolute']
180 - ]},
209 + ]
210 + },
211 'journaling_volume': {
212 'options': [None, 'Volume of data written to the journal', 'MB', 'database performance',
213 'mongodb.journaling_volume', 'line'],
214 'lines': [
215 ['journaledMB', 'volume', 'absolute', 1, 100]
186 - ]},
216 + ]
217 + },
218 'background_flush_average': {
219 'options': [None, 'Average time taken by flushes to execute', 'ms', 'database performance',
220 'mongodb.background_flush_average', 'line'],
221 'lines': [
222 ['average_ms', 'time', 'absolute', 1, 100]
192 - ]},
223 + ]
224 + },
225 'background_flush_last': {
226 'options': [None, 'Time taken by the last flush operation to execute', 'ms', 'database performance',
227 'mongodb.background_flush_last', 'line'],
228 'lines': [
229 ['last_ms', 'time', 'absolute', 1, 100]
198 - ]},
230 + ]
231 + },
232 'background_flush_rate': {
233 'options': [None, 'Flushes rate', 'flushes', 'database performance', 'mongodb.background_flush_rate', 'line'],
234 'lines': [
235 ['flushes', 'flushes', 'incremental', 1, 1]
203 - ]},
236 + ]
237 + },
238 'wiredtiger_read': {
239 'options': [None, 'Read tickets in use and remaining', 'tickets', 'database performance',
240 'mongodb.wiredtiger_read', 'stacked'],
241 'lines': [
242 ['wiredTigerRead_available', 'available', 'absolute', 1, 1],
243 ['wiredTigerRead_out', 'inuse', 'absolute', 1, 1]
210 - ]},
244 + ]
245 + },
246 'wiredtiger_write': {
247 'options': [None, 'Write tickets in use and remaining', 'tickets', 'database performance',
248 'mongodb.wiredtiger_write', 'stacked'],
249 'lines': [
250 ['wiredTigerWrite_available', 'available', 'absolute', 1, 1],
251 ['wiredTigerWrite_out', 'inuse', 'absolute', 1, 1]
217 - ]},
252 + ]
253 + },
254 'cursors': {
255 'options': [None, 'Currently openned cursors, cursors with timeout disabled and timed out cursors',
256 'cursors', 'database performance', 'mongodb.cursors', 'stacked'],
@@ -222,14 +258,16 @@ CHARTS = {
258 ['cursor_total', 'openned', 'absolute', 1, 1],
259 ['noTimeout', None, 'absolute', 1, 1],
260 ['timedOut', None, 'incremental', 1, 1]
225 - ]},
261 + ]
262 + },
263 'connections': {
264 'options': [None, 'Currently connected clients and unused connections', 'connections',
265 'resource utilization', 'mongodb.connections', 'stacked'],
266 'lines': [
267 ['connections_available', 'unused', 'absolute', 1, 1],
268 ['connections_current', 'connected', 'absolute', 1, 1]
232 - ]},
269 + ]
270 + },
271 'memory': {
272 'options': [None, 'Memory metrics', 'MB', 'resource utilization', 'mongodb.memory', 'stacked'],
273 'lines': [
@@ -237,26 +275,30 @@ CHARTS = {
275 ['resident', None, 'absolute', 1, 1],
276 ['nonmapped', None, 'absolute', 1, 1],
277 ['mapped', None, 'absolute', 1, 1]
240 - ]},
278 + ]
279 + },
280 'page_faults': {
281 'options': [None, 'Number of times MongoDB had to fetch data from disk', 'request/s',
282 'resource utilization', 'mongodb.page_faults', 'line'],
283 'lines': [
284 ['page_faults', None, 'incremental', 1, 1]
246 - ]},
285 + ]
286 + },
287 'queued_requests': {
288 'options': [None, 'Currently queued read and write requests', 'requests', 'resource saturation',
289 'mongodb.queued_requests', 'line'],
290 'lines': [
291 ['currentQueue_readers', 'readers', 'absolute', 1, 1],
292 ['currentQueue_writers', 'writers', 'absolute', 1, 1]
253 - ]},
293 + ]
294 + },
295 'record_moves': {
296 'options': [None, 'Number of times documents had to be moved on-disk', 'number',
297 'resource saturation', 'mongodb.record_moves', 'line'],
298 'lines': [
299 ['moves', None, 'incremental', 1, 1]
259 - ]},
300 + ]
301 + },
302 'asserts': {
303 'options': [
304 None,
@@ -267,32 +309,36 @@ CHARTS = {
309 ['warning', None, 'incremental', 1, 1],
310 ['regular', None, 'incremental', 1, 1],
311 ['user', None, 'incremental', 1, 1]
270 - ]},
312 + ]
313 + },
314 'wiredtiger_cache': {
315 'options': [None, 'The percentage of the wiredTiger cache that is in use and cache with dirty bytes',
316 'percent', 'resource utilization', 'mongodb.wiredtiger_cache', 'stacked'],
317 'lines': [
318 ['wiredTiger_percent_clean', 'inuse', 'absolute', 1, 1000],
319 ['wiredTiger_percent_dirty', 'dirty', 'absolute', 1, 1000]
277 - ]},
320 + ]
321 + },
322 'wiredtiger_pages_evicted': {
323 'options': [None, 'Pages evicted from the cache',
324 'pages', 'resource utilization', 'mongodb.wiredtiger_pages_evicted', 'stacked'],
325 'lines': [
326 ['unmodified', None, 'absolute', 1, 1],
327 ['modified', None, 'absolute', 1, 1]
284 - ]},
328 + ]
329 + },
330 'dbstats_objects': {
331 'options': [None, 'Number of documents in the database among all the collections', 'documents',
332 'storage size metrics', 'mongodb.dbstats_objects', 'stacked'],
288 - 'lines': [
289 - ]},
333 + 'lines': []
334 + },
335 'tcmalloc_generic': {
336 'options': [None, 'Tcmalloc generic metrics', 'MB', 'tcmalloc', 'mongodb.tcmalloc_generic', 'stacked'],
337 'lines': [
338 ['current_allocated_bytes', 'allocated', 'absolute', 1, 1048576],
339 ['heap_size', 'heap_size', 'absolute', 1, 1048576]
295 - ]},
340 + ]
341 + },
342 'tcmalloc_metrics': {
343 'options': [None, 'Tcmalloc metrics', 'KB', 'tcmalloc', 'mongodb.tcmalloc_metrics', 'stacked'],
344 'lines': [
@@ -302,7 +348,8 @@ CHARTS = {
348 ['pageheap_unmapped_bytes', 'pageheap_unmapped', 'absolute', 1, 1024],
349 ['thread_cache_free_bytes', 'thread_cache_free', 'absolute', 1, 1024],
350 ['transfer_cache_free_bytes', 'transfer_cache_free', 'absolute', 1, 1024]
305 - ]},
351 + ]
352 + },
353 'command_total_rate': {
354 'options': [None, 'Commands total rate', 'commands/s', 'commands', 'mongodb.command_total_rate', 'stacked'],
355 'lines': [
@@ -313,7 +360,8 @@ CHARTS = {
360 ['findAndModify_total', 'findAndModify', 'incremental', 1, 1],
361 ['insert_total', 'insert', 'incremental', 1, 1],
362 ['update_total', 'update', 'incremental', 1, 1]
316 - ]},
363 + ]
364 + },
365 'command_failed_rate': {
366 'options': [None, 'Commands failed rate', 'commands/s', 'commands', 'mongodb.command_failed_rate', 'stacked'],
367 'lines': [
@@ -324,7 +372,8 @@ CHARTS = {
372 ['findAndModify_failed', 'findAndModify', 'incremental', 1, 1],
373 ['insert_failed', 'insert', 'incremental', 1, 1],
374 ['update_failed', 'update', 'incremental', 1, 1]
327 - ]},
375 + ]
376 + },
377 'locks_collection': {
378 'options': [None, 'Collection lock. Number of times the lock was acquired in the specified mode',
379 'locks', 'locks metrics', 'mongodb.locks_collection', 'stacked'],
@@ -333,7 +382,8 @@ CHARTS = {
382 ['Collection_W', 'exclusive', 'incremental'],
383 ['Collection_r', 'intent_shared', 'incremental'],
384 ['Collection_w', 'intent_exclusive', 'incremental']
336 - ]},
385 + ]
386 + },
387 'locks_database': {
388 'options': [None, 'Database lock. Number of times the lock was acquired in the specified mode',
389 'locks', 'locks metrics', 'mongodb.locks_database', 'stacked'],
@@ -342,7 +392,8 @@ CHARTS = {
392 ['Database_W', 'exclusive', 'incremental'],
393 ['Database_r', 'intent_shared', 'incremental'],
394 ['Database_w', 'intent_exclusive', 'incremental']
345 - ]},
395 + ]
396 + },
397 'locks_global': {
398 'options': [None, 'Global lock. Number of times the lock was acquired in the specified mode',
399 'locks', 'locks metrics', 'mongodb.locks_global', 'stacked'],
@@ -351,21 +402,24 @@ CHARTS = {
402 ['Global_W', 'exclusive', 'incremental'],
403 ['Global_r', 'intent_shared', 'incremental'],
404 ['Global_w', 'intent_exclusive', 'incremental']
354 - ]},
405 + ]
406 + },
407 'locks_metadata': {
408 'options': [None, 'Metadata lock. Number of times the lock was acquired in the specified mode',
409 'locks', 'locks metrics', 'mongodb.locks_metadata', 'stacked'],
410 'lines': [
411 ['Metadata_R', 'shared', 'incremental'],
412 ['Metadata_w', 'intent_exclusive', 'incremental']
361 - ]},
413 + ]
414 + },
415 'locks_oplog': {
416 'options': [None, 'Lock on the oplog. Number of times the lock was acquired in the specified mode',
417 'locks', 'locks metrics', 'mongodb.locks_oplog', 'stacked'],
418 'lines': [
419 ['oplog_r', 'intent_shared', 'incremental'],
420 ['oplog_w', 'intent_exclusive', 'incremental']
368 - ]}
421 + ]
422 + }
423 }
424
425
@@ -565,9 +619,9 @@ class Service(SimpleService):
619 raw_data['getReplicationInfo'] = dict()
620 try:
621 raw_data['getReplicationInfo']['ASCENDING'] = self.connection.local.oplog.rs.find().sort(
568 - "$natural", ASCENDING).limit(1)[0]
622 + '$natural', ASCENDING).limit(1)[0]
623 raw_data['getReplicationInfo']['DESCENDING'] = self.connection.local.oplog.rs.find().sort(
570 - "$natural", DESCENDING).limit(1)[0]
624 + '$natural', DESCENDING).limit(1)[0]
625 return raw_data
626 except PyMongoError:
627 return None
python.d/monit.chart.py
+32 -16
@@ -12,17 +12,26 @@ priority = 60000
12 retries = 60
13
14 # see enum State_Type from monit.h (https://bitbucket.org/tildeslash/monit/src/master/src/monit.h)
15 -MONIT_SERVICE_NAMES = [ 'Filesystem', 'Directory', 'File', 'Process', 'Host', 'System', 'Fifo', 'Program', 'Net' ]
16 -DEFAULT_SERVICES_IDS = [ 0, 1, 2, 3, 4, 6, 7, 8 ]
15 +MONIT_SERVICE_NAMES = ['Filesystem', 'Directory', 'File', 'Process', 'Host', 'System', 'Fifo', 'Program', 'Net']
16 +DEFAULT_SERVICES_IDS = [0, 1, 2, 3, 4, 6, 7, 8]
17
18 # charts order (can be overridden if you want less charts, or different order)
19 -ORDER = [ 'filesystem', 'directory', 'file', 'process', 'process_uptime', 'process_threads', 'process_children', 'host', 'host_latency', 'system', 'fifo', 'program', 'net' ]
19 +ORDER = [
20 + 'filesystem',
21 + 'directory',
22 + 'file',
23 + 'process',
24 + 'process_uptime',
25 + 'process_threads',
26 + 'process_children',
27 + 'host',
28 + 'host_latency',
29 + 'system',
30 + 'fifo',
31 + 'program',
32 + 'net'
33 +]
34 CHARTS = {
21 - # id: {
22 - # 'options': [name, title, units, family, context, charttype],
23 - # 'lines': [
24 - # [unique_dimension_name, name, algorithm, multiplier, divisor]
25 - # ]}
35 'filesystem': {
36 'options': ['filesystems', 'Filesystems', 'filesystems', 'filesystem', 'monit.filesystems', 'line'],
37 'lines': []
@@ -48,15 +57,18 @@ CHARTS = {
57 'lines': []
58 },
59 'process_uptime': {
51 - 'options': ['processes uptime', 'Processes uptime', 'seconds', 'applications', 'monit.process_uptime', 'line', 'hidden'],
60 + 'options': ['processes uptime', 'Processes uptime', 'seconds', 'applications',
61 + 'monit.process_uptime', 'line', 'hidden'],
62 'lines': []
63 },
64 'process_threads': {
55 - 'options': ['processes threads', 'Processes threads', 'threads', 'applications', 'monit.process_threads', 'line'],
65 + 'options': ['processes threads', 'Processes threads', 'threads', 'applications',
66 + 'monit.process_threads', 'line'],
67 'lines': []
68 },
69 'process_children': {
59 - 'options': ['processes childrens', 'Child processes', 'childrens', 'applications', 'monit.process_childrens', 'line'],
70 + 'options': ['processes childrens', 'Child processes', 'childrens', 'applications',
71 + 'monit.process_childrens', 'line'],
72 'lines': []
73 },
74 'host': {
@@ -68,11 +80,13 @@ CHARTS = {
80 'lines': []
81 },
82 'net': {
71 - 'options': ['interfaces', 'Network interfaces and addresses', 'interfaces', 'network', 'monit.networks', 'line'],
83 + 'options': ['interfaces', 'Network interfaces and addresses', 'interfaces', 'network',
84 + 'monit.networks', 'line'],
85 'lines': []
86 },
87 }
88
89 +
90 class Service(UrlService):
91 def __init__(self, configuration=None, name=None):
92 UrlService.__init__(self, configuration=configuration, name=name)
@@ -112,18 +126,19 @@ class Service(UrlService):
126 continue
127
128 xpath_query = "./service[@type='{0}']".format(service_id)
115 - self.debug("Searching for {0} as {1}".format(service_category, xpath_query))
129 + self.debug('Searching for {0} as {1}'.format(service_category, xpath_query))
130 for service_node in xml.findall(xpath_query):
131
132 service_name = service_node.find('name').text
133 service_status = service_node.find('status').text
134 service_monitoring = service_node.find('monitor').text
121 - self.debug('=> found {0} with type={1}, status={2}, monitoring={3}'.format(service_name, service_id, service_status, service_monitoring))
135 + self.debug('=> found {0} with type={1}, status={2}, monitoring={3}'.format(service_name,
136 + service_id, service_status, service_monitoring))
137
138 dimension_key = service_category + '_' + service_name
139 if dimension_key not in self.charts[service_category]:
140 self.charts[service_category].add_dimension([dimension_key, service_name, 'absolute'])
126 - data[dimension_key] = 1 if service_status == "0" and service_monitoring == "1" else 0
141 + data[dimension_key] = 1 if service_status == '0' and service_monitoring == '1' else 0
142
143 if service_category == 'process':
144 for subnode in ('uptime', 'threads', 'children'):
@@ -144,7 +159,8 @@ class Service(UrlService):
159 continue
160 dimension_key = 'host_latency_{0}'.format(service_name)
161 if dimension_key not in self.charts['host_latency']:
147 - self.charts['host_latency'].add_dimension([dimension_key, service_name, 'absolute', 1000, 1000000])
162 + self.charts['host_latency'].add_dimension([dimension_key, service_name,
163 + 'absolute', 1000, 1000000])
164 data[dimension_key] = float(subnode_value.text) * 1000000
165
166 return data or None
python.d/mysql.chart.py
+246 -172
@@ -17,117 +17,119 @@ QUERY_SLAVE = 'SHOW SLAVE STATUS;'
17 QUERY_VARIABLES = 'SHOW GLOBAL VARIABLES LIKE \'max_connections\';'
18
19 GLOBAL_STATS = [
20 - 'Bytes_received',
21 - 'Bytes_sent',
22 - 'Queries',
23 - 'Questions',
24 - 'Slow_queries',
25 - 'Handler_commit',
26 - 'Handler_delete',
27 - 'Handler_prepare',
28 - 'Handler_read_first',
29 - 'Handler_read_key',
30 - 'Handler_read_next',
31 - 'Handler_read_prev',
32 - 'Handler_read_rnd',
33 - 'Handler_read_rnd_next',
34 - 'Handler_rollback',
35 - 'Handler_savepoint',
36 - 'Handler_savepoint_rollback',
37 - 'Handler_update',
38 - 'Handler_write',
39 - 'Table_locks_immediate',
40 - 'Table_locks_waited',
41 - 'Select_full_join',
42 - 'Select_full_range_join',
43 - 'Select_range',
44 - 'Select_range_check',
45 - 'Select_scan',
46 - 'Sort_merge_passes',
47 - 'Sort_range',
48 - 'Sort_scan',
49 - 'Created_tmp_disk_tables',
50 - 'Created_tmp_files',
51 - 'Created_tmp_tables',
52 - 'Connections',
53 - 'Aborted_connects',
54 - 'Max_used_connections',
55 - 'Binlog_cache_disk_use',
56 - 'Binlog_cache_use',
57 - 'Threads_connected',
58 - 'Threads_created',
59 - 'Threads_cached',
60 - 'Threads_running',
61 - 'Thread_cache_misses',
62 - 'Innodb_data_read',
63 - 'Innodb_data_written',
64 - 'Innodb_data_reads',
65 - 'Innodb_data_writes',
66 - 'Innodb_data_fsyncs',
67 - 'Innodb_data_pending_reads',
68 - 'Innodb_data_pending_writes',
69 - 'Innodb_data_pending_fsyncs',
70 - 'Innodb_log_waits',
71 - 'Innodb_log_write_requests',
72 - 'Innodb_log_writes',
73 - 'Innodb_os_log_fsyncs',
74 - 'Innodb_os_log_pending_fsyncs',
75 - 'Innodb_os_log_pending_writes',
76 - 'Innodb_os_log_written',
77 - 'Innodb_row_lock_current_waits',
78 - 'Innodb_rows_inserted',
79 - 'Innodb_rows_read',
80 - 'Innodb_rows_updated',
81 - 'Innodb_rows_deleted',
82 - 'Innodb_buffer_pool_pages_data',
83 - 'Innodb_buffer_pool_pages_dirty',
84 - 'Innodb_buffer_pool_pages_free',
85 - 'Innodb_buffer_pool_pages_flushed',
86 - 'Innodb_buffer_pool_pages_misc',
87 - 'Innodb_buffer_pool_pages_total',
88 - 'Innodb_buffer_pool_bytes_data',
89 - 'Innodb_buffer_pool_bytes_dirty',
90 - 'Innodb_buffer_pool_read_ahead',
91 - 'Innodb_buffer_pool_read_ahead_evicted',
92 - 'Innodb_buffer_pool_read_ahead_rnd',
93 - 'Innodb_buffer_pool_read_requests',
94 - 'Innodb_buffer_pool_write_requests',
95 - 'Innodb_buffer_pool_reads',
96 - 'Innodb_buffer_pool_wait_free',
97 - 'Qcache_hits',
98 - 'Qcache_lowmem_prunes',
99 - 'Qcache_inserts',
100 - 'Qcache_not_cached',
101 - 'Qcache_queries_in_cache',
102 - 'Qcache_free_memory',
103 - 'Qcache_free_blocks',
104 - 'Qcache_total_blocks',
105 - 'Key_blocks_unused',
106 - 'Key_blocks_used',
107 - 'Key_blocks_not_flushed',
108 - 'Key_read_requests',
109 - 'Key_write_requests',
110 - 'Key_reads',
111 - 'Key_writes',
112 - 'Open_files',
113 - 'Opened_files',
114 - 'Binlog_stmt_cache_disk_use',
115 - 'Binlog_stmt_cache_use',
116 - 'Connection_errors_accept',
117 - 'Connection_errors_internal',
118 - 'Connection_errors_max_connections',
119 - 'Connection_errors_peer_address',
120 - 'Connection_errors_select',
121 - 'Connection_errors_tcpwrap',
122 - 'wsrep_local_recv_queue',
123 - 'wsrep_local_send_queue',
124 - 'wsrep_received',
125 - 'wsrep_replicated',
126 - 'wsrep_received_bytes',
127 - 'wsrep_replicated_bytes',
128 - 'wsrep_local_bf_aborts',
129 - 'wsrep_local_cert_failures',
130 - 'wsrep_flow_control_paused_ns']
20 + 'Bytes_received',
21 + 'Bytes_sent',
22 + 'Queries',
23 + 'Questions',
24 + 'Slow_queries',
25 + 'Handler_commit',
26 + 'Handler_delete',
27 + 'Handler_prepare',
28 + 'Handler_read_first',
29 + 'Handler_read_key',
30 + 'Handler_read_next',
31 + 'Handler_read_prev',
32 + 'Handler_read_rnd',
33 + 'Handler_read_rnd_next',
34 + 'Handler_rollback',
35 + 'Handler_savepoint',
36 + 'Handler_savepoint_rollback',
37 + 'Handler_update',
38 + 'Handler_write',
39 + 'Table_locks_immediate',
40 + 'Table_locks_waited',
41 + 'Select_full_join',
42 + 'Select_full_range_join',
43 + 'Select_range',
44 + 'Select_range_check',
45 + 'Select_scan',
46 + 'Sort_merge_passes',
47 + 'Sort_range',
48 + 'Sort_scan',
49 + 'Created_tmp_disk_tables',
50 + 'Created_tmp_files',
51 + 'Created_tmp_tables',
52 + 'Connections',
53 + 'Aborted_connects',
54 + 'Max_used_connections',
55 + 'Binlog_cache_disk_use',
56 + 'Binlog_cache_use',
57 + 'Threads_connected',
58 + 'Threads_created',
59 + 'Threads_cached',
60 + 'Threads_running',
61 + 'Thread_cache_misses',
62 + 'Innodb_data_read',
63 + 'Innodb_data_written',
64 + 'Innodb_data_reads',
65 + 'Innodb_data_writes',
66 + 'Innodb_data_fsyncs',
67 + 'Innodb_data_pending_reads',
68 + 'Innodb_data_pending_writes',
69 + 'Innodb_data_pending_fsyncs',
70 + 'Innodb_log_waits',
71 + 'Innodb_log_write_requests',
72 + 'Innodb_log_writes',
73 + 'Innodb_os_log_fsyncs',
74 + 'Innodb_os_log_pending_fsyncs',
75 + 'Innodb_os_log_pending_writes',
76 + 'Innodb_os_log_written',
77 + 'Innodb_row_lock_current_waits',
78 + 'Innodb_rows_inserted',
79 + 'Innodb_rows_read',
80 + 'Innodb_rows_updated',
81 + 'Innodb_rows_deleted',
82 + 'Innodb_buffer_pool_pages_data',
83 + 'Innodb_buffer_pool_pages_dirty',
84 + 'Innodb_buffer_pool_pages_free',
85 + 'Innodb_buffer_pool_pages_flushed',
86 + 'Innodb_buffer_pool_pages_misc',
87 + 'Innodb_buffer_pool_pages_total',
88 + 'Innodb_buffer_pool_bytes_data',
89 + 'Innodb_buffer_pool_bytes_dirty',
90 + 'Innodb_buffer_pool_read_ahead',
91 + 'Innodb_buffer_pool_read_ahead_evicted',
92 + 'Innodb_buffer_pool_read_ahead_rnd',
93 + 'Innodb_buffer_pool_read_requests',
94 + 'Innodb_buffer_pool_write_requests',
95 + 'Innodb_buffer_pool_reads',
96 + 'Innodb_buffer_pool_wait_free',
97 + 'Qcache_hits',
98 + 'Qcache_lowmem_prunes',
99 + 'Qcache_inserts',
100 + 'Qcache_not_cached',
101 + 'Qcache_queries_in_cache',
102 + 'Qcache_free_memory',
103 + 'Qcache_free_blocks',
104 + 'Qcache_total_blocks',
105 + 'Key_blocks_unused',
106 + 'Key_blocks_used',
107 + 'Key_blocks_not_flushed',
108 + 'Key_read_requests',
109 + 'Key_write_requests',
110 + 'Key_reads',
111 + 'Key_writes',
112 + 'Open_files',
113 + 'Opened_files',
114 + 'Binlog_stmt_cache_disk_use',
115 + 'Binlog_stmt_cache_use',
116 + 'Connection_errors_accept',
117 + 'Connection_errors_internal',
118 + 'Connection_errors_max_connections',
119 + 'Connection_errors_peer_address',
120 + 'Connection_errors_select',
121 + 'Connection_errors_tcpwrap',
122 + 'wsrep_local_recv_queue',
123 + 'wsrep_local_send_queue',
124 + 'wsrep_received',
125 + 'wsrep_replicated',
126 + 'wsrep_received_bytes',
127 + 'wsrep_replicated_bytes',
128 + 'wsrep_local_bf_aborts',
129 + 'wsrep_local_cert_failures',
130 + 'wsrep_flow_control_paused_ns'
131 +]
132 +
133
134 def slave_seconds(value):
135 try:
@@ -147,24 +149,54 @@ SLAVE_STATS = [
149 ]
150
151 VARIABLES = [
150 - 'max_connections']
152 + 'max_connections'
153 +]
154
152 -ORDER = ['net',
153 - 'queries',
154 - 'handlers',
155 - 'table_locks',
156 - 'join_issues', 'sort_issues',
157 - 'tmp',
158 - 'connections', 'connections_active', 'connection_errors',
159 - 'binlog_cache', 'binlog_stmt_cache',
160 - 'threads', 'thread_cache_misses',
161 - 'innodb_io', 'innodb_io_ops', 'innodb_io_pending_ops', 'innodb_log', 'innodb_os_log', 'innodb_os_log_io',
162 - 'innodb_cur_row_lock', 'innodb_rows', 'innodb_buffer_pool_pages', 'innodb_buffer_pool_bytes',
163 - 'innodb_buffer_pool_read_ahead', 'innodb_buffer_pool_reqs', 'innodb_buffer_pool_ops',
164 - 'qcache_ops', 'qcache', 'qcache_freemem', 'qcache_memblocks',
165 - 'key_blocks', 'key_requests', 'key_disk_ops',
166 - 'files', 'files_rate', 'slave_behind', 'slave_status',
167 - 'galera_writesets', 'galera_bytes', 'galera_queue', 'galera_conflicts', 'galera_flow_control']
155 +ORDER = [
156 + 'net',
157 + 'queries',
158 + 'handlers',
159 + 'table_locks',
160 + 'join_issues',
161 + 'sort_issues',
162 + 'tmp',
163 + 'connections',
164 + 'connections_active',
165 + 'connection_errors',
166 + 'binlog_cache',
167 + 'binlog_stmt_cache',
168 + 'threads',
169 + 'thread_cache_misses',
170 + 'innodb_io',
171 + 'innodb_io_ops',
172 + 'innodb_io_pending_ops',
173 + 'innodb_log',
174 + 'innodb_os_log',
175 + 'innodb_os_log_io',
176 + 'innodb_cur_row_lock',
177 + 'innodb_rows',
178 + 'innodb_buffer_pool_pages',
179 + 'innodb_buffer_pool_bytes',
180 + 'innodb_buffer_pool_read_ahead',
181 + 'innodb_buffer_pool_reqs',
182 + 'innodb_buffer_pool_ops',
183 + 'qcache_ops',
184 + 'qcache',
185 + 'qcache_freemem',
186 + 'qcache_memblocks',
187 + 'key_blocks',
188 + 'key_requests',
189 + 'key_disk_ops',
190 + 'files',
191 + 'files_rate',
192 + 'slave_behind',
193 + 'slave_status',
194 + 'galera_writesets',
195 + 'galera_bytes',
196 + 'galera_queue',
197 + 'galera_conflicts',
198 + 'galera_flow_control'
199 +]
200
201 CHARTS = {
202 'net': {
@@ -172,14 +204,16 @@ CHARTS = {
204 'lines': [
205 ['Bytes_received', 'in', 'incremental', 8, 1024],
206 ['Bytes_sent', 'out', 'incremental', -8, 1024]
175 - ]},
207 + ]
208 + },
209 'queries': {
210 'options': [None, 'mysql Queries', 'queries/s', 'queries', 'mysql.queries', 'line'],
211 'lines': [
212 ['Queries', 'queries', 'incremental'],
213 ['Questions', 'questions', 'incremental'],
214 ['Slow_queries', 'slow_queries', 'incremental']
182 - ]},
215 + ]
216 + },
217 'handlers': {
218 'options': [None, 'mysql Handlers', 'handlers/s', 'handlers', 'mysql.handlers', 'line'],
219 'lines': [
@@ -197,13 +231,15 @@ CHARTS = {
231 ['Handler_savepoint_rollback', 'savepoint_rollback', 'incremental'],
232 ['Handler_update', 'update', 'incremental'],
233 ['Handler_write', 'write', 'incremental']
200 - ]},
234 + ]
235 + },
236 'table_locks': {
237 'options': [None, 'mysql Tables Locks', 'locks/s', 'locks', 'mysql.table_locks', 'line'],
238 'lines': [
239 ['Table_locks_immediate', 'immediate', 'incremental'],
240 ['Table_locks_waited', 'waited', 'incremental', -1, 1]
206 - ]},
241 + ]
242 + },
243 'join_issues': {
244 'options': [None, 'mysql Select Join Issues', 'joins/s', 'issues', 'mysql.join_issues', 'line'],
245 'lines': [
@@ -212,40 +248,46 @@ CHARTS = {
248 ['Select_range', 'range', 'incremental'],
249 ['Select_range_check', 'range_check', 'incremental'],
250 ['Select_scan', 'scan', 'incremental']
215 - ]},
251 + ]
252 + },
253 'sort_issues': {
254 'options': [None, 'mysql Sort Issues', 'issues/s', 'issues', 'mysql.sort_issues', 'line'],
255 'lines': [
256 ['Sort_merge_passes', 'merge_passes', 'incremental'],
257 ['Sort_range', 'range', 'incremental'],
258 ['Sort_scan', 'scan', 'incremental']
222 - ]},
259 + ]
260 + },
261 'tmp': {
262 'options': [None, 'mysql Tmp Operations', 'counter', 'temporaries', 'mysql.tmp', 'line'],
263 'lines': [
264 ['Created_tmp_disk_tables', 'disk_tables', 'incremental'],
265 ['Created_tmp_files', 'files', 'incremental'],
266 ['Created_tmp_tables', 'tables', 'incremental']
229 - ]},
267 + ]
268 + },
269 'connections': {
270 'options': [None, 'mysql Connections', 'connections/s', 'connections', 'mysql.connections', 'line'],
271 'lines': [
272 ['Connections', 'all', 'incremental'],
273 ['Aborted_connects', 'aborted', 'incremental']
235 - ]},
274 + ]
275 + },
276 'connections_active': {
277 'options': [None, 'mysql Connections Active', 'connections', 'connections', 'mysql.connections_active', 'line'],
278 'lines': [
279 ['Threads_connected', 'active', 'absolute'],
280 ['max_connections', 'limit', 'absolute'],
281 ['Max_used_connections', 'max_active', 'absolute']
242 - ]},
282 + ]
283 + },
284 'binlog_cache': {
285 'options': [None, 'mysql Binlog Cache', 'transactions/s', 'binlog', 'mysql.binlog_cache', 'line'],
286 'lines': [
287 ['Binlog_cache_disk_use', 'disk', 'incremental'],
288 ['Binlog_cache_use', 'all', 'incremental']
248 - ]},
289 + ]
290 + },
291 'threads': {
292 'options': [None, 'mysql Threads', 'threads', 'threads', 'mysql.threads', 'line'],
293 'lines': [
@@ -253,25 +295,29 @@ CHARTS = {
295 ['Threads_created', 'created', 'incremental'],
296 ['Threads_cached', 'cached', 'absolute', -1, 1],
297 ['Threads_running', 'running', 'absolute'],
256 - ]},
298 + ]
299 + },
300 'thread_cache_misses': {
301 'options': [None, 'mysql Threads Cache Misses', 'misses', 'threads', 'mysql.thread_cache_misses', 'area'],
302 'lines': [
303 ['Thread_cache_misses', 'misses', 'absolute', 1, 100]
261 - ]},
304 + ]
305 + },
306 'innodb_io': {
307 'options': [None, 'mysql InnoDB I/O Bandwidth', 'kilobytes/s', 'innodb', 'mysql.innodb_io', 'area'],
308 'lines': [
309 ['Innodb_data_read', 'read', 'incremental', 1, 1024],
310 ['Innodb_data_written', 'write', 'incremental', -1, 1024]
267 - ]},
311 + ]
312 + },
313 'innodb_io_ops': {
314 'options': [None, 'mysql InnoDB I/O Operations', 'operations/s', 'innodb', 'mysql.innodb_io_ops', 'line'],
315 'lines': [
316 ['Innodb_data_reads', 'reads', 'incremental'],
317 ['Innodb_data_writes', 'writes', 'incremental', -1, 1],
318 ['Innodb_data_fsyncs', 'fsyncs', 'incremental']
274 - ]},
319 + ]
320 + },
321 'innodb_io_pending_ops': {
322 'options': [None, 'mysql InnoDB Pending I/O Operations', 'operations', 'innodb',
323 'mysql.innodb_io_pending_ops', 'line'],
@@ -279,32 +325,37 @@ CHARTS = {
325 ['Innodb_data_pending_reads', 'reads', 'absolute'],
326 ['Innodb_data_pending_writes', 'writes', 'absolute', -1, 1],
327 ['Innodb_data_pending_fsyncs', 'fsyncs', 'absolute']
282 - ]},
328 + ]
329 + },
330 'innodb_log': {
331 'options': [None, 'mysql InnoDB Log Operations', 'operations/s', 'innodb', 'mysql.innodb_log', 'line'],
332 'lines': [
333 ['Innodb_log_waits', 'waits', 'incremental'],
334 ['Innodb_log_write_requests', 'write_requests', 'incremental', -1, 1],
335 ['Innodb_log_writes', 'writes', 'incremental', -1, 1],
289 - ]},
336 + ]
337 + },
338 'innodb_os_log': {
339 'options': [None, 'mysql InnoDB OS Log Operations', 'operations', 'innodb', 'mysql.innodb_os_log', 'line'],
340 'lines': [
341 ['Innodb_os_log_fsyncs', 'fsyncs', 'incremental'],
342 ['Innodb_os_log_pending_fsyncs', 'pending_fsyncs', 'absolute'],
343 ['Innodb_os_log_pending_writes', 'pending_writes', 'absolute', -1, 1],
296 - ]},
344 + ]
345 + },
346 'innodb_os_log_io': {
347 'options': [None, 'mysql InnoDB OS Log Bandwidth', 'kilobytes/s', 'innodb', 'mysql.innodb_os_log_io', 'area'],
348 'lines': [
349 ['Innodb_os_log_written', 'write', 'incremental', -1, 1024],
301 - ]},
350 + ]
351 + },
352 'innodb_cur_row_lock': {
353 'options': [None, 'mysql InnoDB Current Row Locks', 'operations', 'innodb',
354 'mysql.innodb_cur_row_lock', 'area'],
355 'lines': [
356 ['Innodb_row_lock_current_waits', 'current_waits', 'absolute']
307 - ]},
357 + ]
358 + },
359 'innodb_rows': {
360 'options': [None, 'mysql InnoDB Row Operations', 'operations/s', 'innodb', 'mysql.innodb_rows', 'area'],
361 'lines': [
@@ -312,7 +363,8 @@ CHARTS = {
363 ['Innodb_rows_read', 'read', 'incremental', 1, 1],
364 ['Innodb_rows_updated', 'updated', 'incremental', 1, 1],
365 ['Innodb_rows_deleted', 'deleted', 'incremental', -1, 1],
315 - ]},
366 + ]
367 + },
368 'innodb_buffer_pool_pages': {
369 'options': [None, 'mysql InnoDB Buffer Pool Pages', 'pages', 'innodb',
370 'mysql.innodb_buffer_pool_pages', 'line'],
@@ -323,13 +375,15 @@ CHARTS = {
375 ['Innodb_buffer_pool_pages_flushed', 'flushed', 'incremental', -1, 1],
376 ['Innodb_buffer_pool_pages_misc', 'misc', 'absolute', -1, 1],
377 ['Innodb_buffer_pool_pages_total', 'total', 'absolute']
326 - ]},
378 + ]
379 + },
380 'innodb_buffer_pool_bytes': {
381 'options': [None, 'mysql InnoDB Buffer Pool Bytes', 'MB', 'innodb', 'mysql.innodb_buffer_pool_bytes', 'area'],
382 'lines': [
383 ['Innodb_buffer_pool_bytes_data', 'data', 'absolute', 1, 1024 * 1024],
384 ['Innodb_buffer_pool_bytes_dirty', 'dirty', 'absolute', -1, 1024 * 1024]
332 - ]},
385 + ]
386 + },
387 'innodb_buffer_pool_read_ahead': {
388 'options': [None, 'mysql InnoDB Buffer Pool Read Ahead', 'operations/s', 'innodb',
389 'mysql.innodb_buffer_pool_read_ahead', 'area'],
@@ -337,21 +391,24 @@ CHARTS = {
391 ['Innodb_buffer_pool_read_ahead', 'all', 'incremental'],
392 ['Innodb_buffer_pool_read_ahead_evicted', 'evicted', 'incremental', -1, 1],
393 ['Innodb_buffer_pool_read_ahead_rnd', 'random', 'incremental']
340 - ]},
394 + ]
395 + },
396 'innodb_buffer_pool_reqs': {
397 'options': [None, 'mysql InnoDB Buffer Pool Requests', 'requests/s', 'innodb',
398 'mysql.innodb_buffer_pool_reqs', 'area'],
399 'lines': [
400 ['Innodb_buffer_pool_read_requests', 'reads', 'incremental'],
401 ['Innodb_buffer_pool_write_requests', 'writes', 'incremental', -1, 1]
347 - ]},
402 + ]
403 + },
404 'innodb_buffer_pool_ops': {
405 'options': [None, 'mysql InnoDB Buffer Pool Operations', 'operations/s', 'innodb',
406 'mysql.innodb_buffer_pool_ops', 'area'],
407 'lines': [
408 ['Innodb_buffer_pool_reads', 'disk reads', 'incremental'],
409 ['Innodb_buffer_pool_wait_free', 'wait free', 'incremental', -1, 1]
354 - ]},
410 + ]
411 + },
412 'qcache_ops': {
413 'options': [None, 'mysql QCache Operations', 'queries/s', 'qcache', 'mysql.qcache_ops', 'line'],
414 'lines': [
@@ -359,60 +416,70 @@ CHARTS = {
416 ['Qcache_lowmem_prunes', 'lowmem prunes', 'incremental', -1, 1],
417 ['Qcache_inserts', 'inserts', 'incremental'],
418 ['Qcache_not_cached', 'not cached', 'incremental', -1, 1]
362 - ]},
419 + ]
420 + },
421 'qcache': {
422 'options': [None, 'mysql QCache Queries in Cache', 'queries', 'qcache', 'mysql.qcache', 'line'],
423 'lines': [
424 ['Qcache_queries_in_cache', 'queries', 'absolute']
367 - ]},
425 + ]
426 + },
427 'qcache_freemem': {
428 'options': [None, 'mysql QCache Free Memory', 'MB', 'qcache', 'mysql.qcache_freemem', 'area'],
429 'lines': [
430 ['Qcache_free_memory', 'free', 'absolute', 1, 1024 * 1024]
372 - ]},
431 + ]
432 + },
433 'qcache_memblocks': {
434 'options': [None, 'mysql QCache Memory Blocks', 'blocks', 'qcache', 'mysql.qcache_memblocks', 'line'],
435 'lines': [
436 ['Qcache_free_blocks', 'free', 'absolute'],
437 ['Qcache_total_blocks', 'total', 'absolute']
378 - ]},
438 + ]
439 + },
440 'key_blocks': {
441 'options': [None, 'mysql MyISAM Key Cache Blocks', 'blocks', 'myisam', 'mysql.key_blocks', 'line'],
442 'lines': [
443 ['Key_blocks_unused', 'unused', 'absolute'],
444 ['Key_blocks_used', 'used', 'absolute', -1, 1],
445 ['Key_blocks_not_flushed', 'not flushed', 'absolute']
385 - ]},
446 + ]
447 + },
448 'key_requests': {
449 'options': [None, 'mysql MyISAM Key Cache Requests', 'requests/s', 'myisam', 'mysql.key_requests', 'area'],
450 'lines': [
451 ['Key_read_requests', 'reads', 'incremental'],
452 ['Key_write_requests', 'writes', 'incremental', -1, 1]
391 - ]},
453 + ]
454 + },
455 'key_disk_ops': {
456 'options': [None, 'mysql MyISAM Key Cache Disk Operations', 'operations/s',
457 'myisam', 'mysql.key_disk_ops', 'area'],
458 'lines': [
459 ['Key_reads', 'reads', 'incremental'],
460 ['Key_writes', 'writes', 'incremental', -1, 1]
398 - ]},
461 + ]
462 + },
463 'files': {
464 'options': [None, 'mysql Open Files', 'files', 'files', 'mysql.files', 'line'],
465 'lines': [
466 ['Open_files', 'files', 'absolute']
403 - ]},
467 + ]
468 + },
469 'files_rate': {
470 'options': [None, 'mysql Opened Files Rate', 'files/s', 'files', 'mysql.files_rate', 'line'],
471 'lines': [
472 ['Opened_files', 'files', 'incremental']
408 - ]},
473 + ]
474 + },
475 'binlog_stmt_cache': {
476 'options': [None, 'mysql Binlog Statement Cache', 'statements/s', 'binlog',
477 'mysql.binlog_stmt_cache', 'line'],
478 'lines': [
479 ['Binlog_stmt_cache_disk_use', 'disk', 'incremental'],
480 ['Binlog_stmt_cache_use', 'all', 'incremental']
415 - ]},
481 + ]
482 + },
483 'connection_errors': {
484 'options': [None, 'mysql Connection Errors', 'connections/s', 'connections',
485 'mysql.connection_errors', 'line'],
@@ -423,47 +490,55 @@ CHARTS = {
490 ['Connection_errors_peer_address', 'peer_addr', 'incremental'],
491 ['Connection_errors_select', 'select', 'incremental'],
492 ['Connection_errors_tcpwrap', 'tcpwrap', 'incremental']
426 - ]},
493 + ]
494 + },
495 'slave_behind': {
496 'options': [None, 'Slave Behind Seconds', 'seconds', 'slave', 'mysql.slave_behind', 'line'],
497 'lines': [
498 ['Seconds_Behind_Master', 'seconds', 'absolute']
431 - ]},
499 + ]
500 + },
501 'slave_status': {
502 'options': [None, 'Slave Status', 'status', 'slave', 'mysql.slave_status', 'line'],
503 'lines': [
504 ['Slave_SQL_Running', 'sql_running', 'absolute'],
505 ['Slave_IO_Running', 'io_running', 'absolute']
437 - ]},
506 + ]
507 + },
508 'galera_writesets': {
509 'options': [None, 'Replicated writesets', 'writesets/s', 'galera', 'mysql.galera_writesets', 'line'],
510 'lines': [
511 ['wsrep_received', 'rx', 'incremental'],
512 ['wsrep_replicated', 'tx', 'incremental', -1, 1],
443 - ]},
513 + ]
514 + },
515 'galera_bytes': {
516 'options': [None, 'Replicated bytes', 'KB/s', 'galera', 'mysql.galera_bytes', 'area'],
517 'lines': [
518 ['wsrep_received_bytes', 'rx', 'incremental', 1, 1024],
519 ['wsrep_replicated_bytes', 'tx', 'incremental', -1, 1024],
449 - ]},
520 + ]
521 + },
522 'galera_queue': {
523 'options': [None, 'Galera queue', 'writesets', 'galera', 'mysql.galera_queue', 'line'],
524 'lines': [
525 ['wsrep_local_recv_queue', 'rx', 'absolute'],
526 ['wsrep_local_send_queue', 'tx', 'absolute', -1, 1],
455 - ]},
527 + ]
528 + },
529 'galera_conflicts': {
530 'options': [None, 'Replication conflicts', 'transactions', 'galera', 'mysql.galera_conflicts', 'area'],
531 'lines': [
532 ['wsrep_local_bf_aborts', 'bf_aborts', 'incremental'],
533 ['wsrep_local_cert_failures', 'cert_fails', 'incremental', -1, 1],
461 - ]},
534 + ]
535 + },
536 'galera_flow_control': {
537 'options': [None, 'Flow control', 'millisec', 'galera', 'mysql.galera_flow_control', 'area'],
538 'lines': [
539 ['wsrep_flow_control_paused_ns', 'paused', 'incremental', 1, 1000000],
466 - ]}
540 + ]
541 + }
542 }
543
544
@@ -508,4 +583,3 @@ class Service(MySQLService):
583 to_netdata[key] = variables[key]
584
585 return to_netdata or None
511 -