@cryptotaxi247 / netdata-1 / commits / f8b161eb0

Python.d PEP 8 cleanup, modules P-R (#4299)

* python.d/phpfph.chart.py PEP 8 cleanup Fixed formatting of container literals. * python.d/portcheck.chart.py PEP 8 cleanup Fixed string quoting and container literal formatting. * python.d/postfix.chart.py PEP 8 cleanup Fixed string quoting and container literal formatting. * python.d/powerdns.chart.py PEP 8 cleanup Fixed formatting of container literals. * python.d/puppet.chart.py PEP 8 cleanup Fixed string quotation, use of blank lines, and formatting of block comments. * python.d/rabbitmq.chart.py PEP 8 cleanup Fixed formatting of container literals. Also fixes a misplaced space (located after a quotation mark instead of before). * python.d/redis.chart.py PEP 8 cleanup Fixed formatting of container literals and quoting of string literals. * python.d/rethinkdb.chart.py PEP 8 cleanup Fixed formatting of container literals. * python.d/retroshare.chart.py PEP 8 cleanup Fixed formatting of container literals.

Austin S. Hemmelgarn committed Sep 28, 2018 at 19:00 UTC f8b161eb00ec852350057f404e0c207c3c5192e2
9 files changed +177 -132
python.d/phpfpm.chart.py
+12 -6
@@ -60,18 +60,21 @@ CHARTS = {
60 ['active'],
61 ['maxActive', 'max active'],
62 ['idle']
63 - ]},
63 + ]
64 + },
65 'requests': {
66 'options': [None, 'PHP-FPM Requests', 'requests/s', 'requests', 'phpfpm.requests', 'line'],
67 'lines': [
68 ['requests', None, 'incremental']
68 - ]},
69 + ]
70 + },
71 'performance': {
72 'options': [None, 'PHP-FPM Performance', 'status', 'performance', 'phpfpm.performance', 'line'],
73 'lines': [
74 ['reached', 'max children reached'],
75 ['slow', 'slow requests']
74 - ]},
76 + ]
77 + },
78 'request_duration': {
79 'options': [None, 'PHP-FPM Request Duration', 'milliseconds', 'request duration', 'phpfpm.request_duration',
80 'line'],
@@ -79,21 +82,24 @@ CHARTS = {
82 ['minReqDur', 'min', 'absolute', 1, 1000],
83 ['maxReqDur', 'max', 'absolute', 1, 1000],
84 ['avgReqDur', 'avg', 'absolute', 1, 1000]
82 - ]},
85 + ]
86 + },
87 'request_cpu': {
88 'options': [None, 'PHP-FPM Request CPU', 'percent', 'request CPU', 'phpfpm.request_cpu', 'line'],
89 'lines': [
90 ['minReqCpu', 'min'],
91 ['maxReqCpu', 'max'],
92 ['avgReqCpu', 'avg']
89 - ]},
93 + ]
94 + },
95 'request_mem': {
96 'options': [None, 'PHP-FPM Request Memory', 'kilobytes', 'request memory', 'phpfpm.request_mem', 'line'],
97 'lines': [
98 ['minReqMem', 'min', 'absolute', 1, 1024],
99 ['maxReqMem', 'max', 'absolute', 1, 1024],
100 ['avgReqMem', 'avg', 'absolute', 1, 1024]
96 - ]}
101 + ]
102 + }
103 }
104
105
python.d/portcheck.chart.py
+4 -3
@@ -37,7 +37,8 @@ CHARTS = {
37 [PORT_SUCCESS, 'success', 'absolute'],
38 [PORT_TIMEOUT, 'timeout', 'absolute'],
39 [PORT_FAILED, 'no connection', 'absolute']
40 - ]}
40 + ]
41 + }
42 }
43
44
@@ -57,13 +58,13 @@ class Service(SimpleService):
58 :return: boolean
59 """
60 if self.host is None or self.port is None:
60 - self.error("Host or port missing")
61 + self.error('Host or port missing')
62 return False
63 if not isinstance(self.port, int):
64 self.error('"port" is not an integer. Specify a numerical value, not service name.')
65 return False
66
66 - self.debug("Enabled portcheck: {host}:{port}, update every {update}s, timeout: {timeout}s".format(
67 + self.debug('Enabled portcheck: {host}:{port}, update every {update}s, timeout: {timeout}s'.format(
68 host=self.host, port=self.port, update=self.update_every, timeout=self.timeout
69 ))
70 # We will accept any (valid-ish) configuration, even if initial connection fails (a service might be down from
python.d/postfix.chart.py
+8 -6
@@ -15,22 +15,24 @@ ORDER = ['qemails', 'qsize']
15
16 CHARTS = {
17 'qemails': {
18 - 'options': [None, "Postfix Queue Emails", "emails", 'queue', 'postfix.qemails', 'line'],
18 + 'options': [None, 'Postfix Queue Emails', 'emails', 'queue', 'postfix.qemails', 'line'],
19 'lines': [
20 ['emails', None, 'absolute']
21 - ]},
21 + ]
22 + },
23 'qsize': {
23 - 'options': [None, "Postfix Queue Emails Size", "emails size in KB", 'queue', 'postfix.qsize', 'area'],
24 + 'options': [None, 'Postfix Queue Emails Size', 'emails size in KB', 'queue', 'postfix.qsize', 'area'],
25 'lines': [
25 - ["size", None, 'absolute']
26 - ]}
26 + ['size', None, 'absolute']
27 + ]
28 + }
29 }
30
31
32 class Service(ExecutableService):
33 def __init__(self, configuration=None, name=None):
34 ExecutableService.__init__(self, configuration=configuration, name=name)
33 - self.command = "postqueue -p"
35 + self.command = 'postqueue -p'
36 self.order = ORDER
37 self.definitions = CHARTS
38
python.d/powerdns.chart.py
+30 -20
@@ -21,7 +21,8 @@ CHARTS = {
21 ['udp-answers', None, 'incremental'],
22 ['tcp-queries', None, 'incremental'],
23 ['tcp-answers', None, 'incremental']
24 - ]},
24 + ]
25 + },
26 'cache_usage': {
27 'options': [None, 'PowerDNS Cache Usage', 'count', 'cache', 'powerdns.cache_usage', 'line'],
28 'lines': [
@@ -29,7 +30,8 @@ CHARTS = {
30 ['query-cache-miss', None, 'incremental'],
31 ['packetcache-hit', 'packet-cache-hit', 'incremental'],
32 ['packetcache-miss', 'packet-cache-miss', 'incremental']
32 - ]},
33 + ]
34 + },
35 'cache_size': {
36 'options': [None, 'PowerDNS Cache Size', 'count', 'cache', 'powerdns.cache_size', 'line'],
37 'lines': [
@@ -37,58 +39,64 @@ CHARTS = {
39 ['packetcache-size', 'packet-cache-size', 'absolute'],
40 ['key-cache-size', None, 'absolute'],
41 ['meta-cache-size', None, 'absolute']
40 - ]},
42 + ]
43 + },
44 'latency': {
45 'options': [None, 'PowerDNS Latency', 'microseconds', 'latency', 'powerdns.latency', 'line'],
46 'lines': [
47 ['latency', None, 'absolute']
45 - ]}
46 -
48 + ]
49 + }
50 }
51
52 RECURSOR_ORDER = ['questions-in', 'questions-out', 'answer-times', 'timeouts', 'drops', 'cache_usage', 'cache_size']
53
54 RECURSOR_CHARTS = {
55 'questions-in': {
53 - 'options': [
54 - None, 'PowerDNS Recursor Questions In', 'count', 'questions', 'powerdns_recursor.questions-in', 'line'],
56 + 'options': [None, 'PowerDNS Recursor Questions In', 'count', 'questions', 'powerdns_recursor.questions-in',
57 + 'line'],
58 'lines': [
59 ['questions', None, 'incremental'],
60 ['ipv6-questions', None, 'incremental'],
61 ['tcp-questions', None, 'incremental']
59 - ]},
62 + ]
63 + },
64 'questions-out': {
61 - 'options': [
62 - None, 'PowerDNS Recursor Questions Out', 'count', 'questions', 'powerdns_recursor.questions-out', 'line'],
65 + 'options': [None, 'PowerDNS Recursor Questions Out', 'count', 'questions', 'powerdns_recursor.questions-out',
66 + 'line'],
67 'lines': [
68 ['all-outqueries', None, 'incremental'],
69 ['ipv6-outqueries', None, 'incremental'],
70 ['tcp-outqueries', None, 'incremental'],
71 ['throttled-outqueries', None, 'incremental']
68 - ]},
72 + ]
73 + },
74 'answer-times': {
70 - 'options': [
71 - None, 'PowerDNS Recursor Answer Times', 'count', 'performance', 'powerdns_recursor.answer-times', 'line'],
75 + 'options': [None, 'PowerDNS Recursor Answer Times', 'count', 'performance', 'powerdns_recursor.answer-times',
76 + 'line'],
77 'lines': [
78 ['answers-slow', None, 'incremental'],
79 ['answers0-1', None, 'incremental'],
80 ['answers1-10', None, 'incremental'],
81 ['answers10-100', None, 'incremental'],
82 ['answers100-1000', None, 'incremental']
78 - ]},
83 + ]
84 + },
85 'timeouts': {
80 - 'options': [
81 - None, 'PowerDNS Recursor Questions Time', 'count', 'performance', 'powerdns_recursor.timeouts', 'line'],
86 + 'options': [None, 'PowerDNS Recursor Questions Time', 'count', 'performance', 'powerdns_recursor.timeouts',
87 + 'line'],
88 'lines': [
89 ['outgoing-timeouts', None, 'incremental'],
90 ['outgoing4-timeouts', None, 'incremental'],
91 ['outgoing6-timeouts', None, 'incremental']
86 - ]},
92 + ]
93 + },
94 'drops': {
95 'options': [None, 'PowerDNS Recursor Drops', 'count', 'performance', 'powerdns_recursor.drops', 'line'],
96 'lines': [
97 ['over-capacity-drops', None, 'incremental']
91 - ]},
98 + ]
99 + },
100 'cache_usage': {
101 'options': [None, 'PowerDNS Recursor Cache Usage', 'count', 'cache', 'powerdns_recursor.cache_usage', 'line'],
102 'lines': [
@@ -96,14 +104,16 @@ RECURSOR_CHARTS = {
104 ['cache-misses', None, 'incremental'],
105 ['packetcache-hits', 'packet-cache-hit', 'incremental'],
106 ['packetcache-misses', 'packet-cache-miss', 'incremental']
99 - ]},
107 + ]
108 + },
109 'cache_size': {
110 'options': [None, 'PowerDNS Recursor Cache Size', 'count', 'cache', 'powerdns_recursor.cache_size', 'line'],
111 'lines': [
112 ['cache-entries', None, 'absolute'],
113 ['packetcache-entries', None, 'absolute'],
114 ['negcache-entries', None, 'absolute']
106 - ]}
115 + ]
116 + }
117 }
118
119
python.d/puppet.chart.py
+14 -16
@@ -2,14 +2,14 @@
2 # Description: puppet netdata python.d module
3 # Author: Andrey Galkin <andrey@futoin.org> (andvgal)
4 # SPDX-License-Identifier: GPL-3.0+
5 -#---
5 +#
6 # This module should work both with OpenSource and PE versions
7 # of PuppetServer and PuppetDB.
8 #
9 # NOTE: PuppetDB may be configured to require proper TLS
10 # client certificate for security reasons. Use tls_key_file
11 # and tls_cert_file options then.
12 -#---
12 +#
13
14 from bases.FrameworkServices.UrlService import UrlService
15 from json import loads
@@ -30,10 +30,10 @@ ORDER = [
30 ]
31 CHARTS = {
32 'jvm_heap': {
33 - 'options': [None, "JVM Heap", "MB", "resources", "puppet.jvm", "area"],
33 + 'options': [None, 'JVM Heap', 'MB', 'resources', 'puppet.jvm', 'area'],
34 'lines': [
35 - ["jvm_heap_committed", 'committed', "absolute", 1, MB],
36 - ["jvm_heap_used", 'used', "absolute", 1, MB],
35 + ['jvm_heap_committed', 'committed', 'absolute', 1, MB],
36 + ['jvm_heap_used', 'used', 'absolute', 1, MB],
37 ],
38 'variables': [
39 ['jvm_heap_max'],
@@ -41,10 +41,10 @@ CHARTS = {
41 ],
42 },
43 'jvm_nonheap': {
44 - 'options': [None, "JVM Non-Heap", "MB", "resources", "puppet.jvm", "area"],
44 + 'options': [None, 'JVM Non-Heap', 'MB', 'resources', 'puppet.jvm', 'area'],
45 'lines': [
46 - ["jvm_nonheap_committed", 'committed', "absolute", 1, MB],
47 - ["jvm_nonheap_used", 'used', "absolute", 1, MB],
46 + ['jvm_nonheap_committed', 'committed', 'absolute', 1, MB],
47 + ['jvm_nonheap_used', 'used', 'absolute', 1, MB],
48 ],
49 'variables': [
50 ['jvm_nonheap_max'],
@@ -52,16 +52,16 @@ CHARTS = {
52 ],
53 },
54 'cpu': {
55 - 'options': [None, "CPU usage", "percentage", "resources", "puppet.cpu", "stacked"],
55 + 'options': [None, 'CPU usage', 'percentage', 'resources', 'puppet.cpu', 'stacked'],
56 'lines': [
57 - ["cpu_time", 'execution', "absolute", 1, CPU_SCALE],
58 - ["gc_time", 'GC', "absolute", 1, CPU_SCALE],
57 + ['cpu_time', 'execution', 'absolute', 1, CPU_SCALE],
58 + ['gc_time', 'GC', 'absolute', 1, CPU_SCALE],
59 ]
60 },
61 'fd_open': {
62 - 'options': [None, "File Descriptors", "descriptors", "resources", "puppet.fdopen", "line"],
62 + 'options': [None, 'File Descriptors', 'descriptors', 'resources', 'puppet.fdopen', 'line'],
63 'lines': [
64 - ["fd_used", 'used', "absolute"],
64 + ['fd_used', 'used', 'absolute'],
65 ],
66 'variables': [
67 ['fd_max'],
@@ -69,6 +69,7 @@ CHARTS = {
69 },
70 }
71
72 +
73 class Service(UrlService):
74 def __init__(self, configuration=None, name=None):
75 UrlService.__init__(self, configuration=configuration, name=name)
@@ -77,7 +78,6 @@ class Service(UrlService):
78 self.definitions = CHARTS
79
80 def _get_data(self):
80 - #---
81 # NOTE: there are several ways to retrieve data
82 # 1. Only PE versions:
83 # https://puppet.com/docs/pe/2018.1/api_status/status_api_metrics_endpoints.html
@@ -87,7 +87,6 @@ class Service(UrlService):
87 # https://puppet.com/docs/pe/2018.1/api_status/status_api_json_endpoints.html
88 #
89 # For sake of simplicity and efficiency the status one is used..
90 - #---
90
91 raw_data = self._get_raw_data(self.url + '/status/v1/services?level=debug')
92
@@ -119,5 +118,4 @@ class Service(UrlService):
118 except KeyError:
119 pass
120
122 -
121 return data or None
python.d/rabbitmq.chart.py
+62 -49
@@ -21,91 +21,104 @@ retries = 60
21
22 METHODS = namedtuple('METHODS', ['get_data', 'url', 'stats'])
23
24 -NODE_STATS = ['fd_used',
25 - 'mem_used',
26 - 'sockets_used',
27 - 'proc_used',
28 - 'disk_free',
29 - 'run_queue'
30 - ]
31 -OVERVIEW_STATS = ['object_totals.channels',
32 - 'object_totals.consumers',
33 - 'object_totals.connections',
34 - 'object_totals.queues',
35 - 'object_totals.exchanges',
36 - 'queue_totals.messages_ready',
37 - 'queue_totals.messages_unacknowledged',
38 - 'message_stats.ack',
39 - 'message_stats.redeliver',
40 - 'message_stats.deliver',
41 - 'message_stats.publish'
42 - ]
43 -ORDER = ['queued_messages', 'message_rates', 'global_counts',
44 - 'file_descriptors', 'socket_descriptors', 'erlang_processes', 'erlang_run_queue', 'memory', 'disk_space']
24 +NODE_STATS = [
25 + 'fd_used',
26 + 'mem_used',
27 + 'sockets_used',
28 + 'proc_used',
29 + 'disk_free',
30 + 'run_queue'
31 +]
32 +
33 +OVERVIEW_STATS = [
34 + 'object_totals.channels',
35 + 'object_totals.consumers',
36 + 'object_totals.connections',
37 + 'object_totals.queues',
38 + 'object_totals.exchanges',
39 + 'queue_totals.messages_ready',
40 + 'queue_totals.messages_unacknowledged',
41 + 'message_stats.ack',
42 + 'message_stats.redeliver',
43 + 'message_stats.deliver',
44 + 'message_stats.publish'
45 +]
46 +
47 +ORDER = [
48 + 'queued_messages',
49 + 'message_rates',
50 + 'global_counts',
51 + 'file_descriptors',
52 + 'socket_descriptors',
53 + 'erlang_processes',
54 + 'erlang_run_queue',
55 + 'memory',
56 + 'disk_space'
57 +]
58
59 CHARTS = {
60 'file_descriptors': {
48 - 'options': [None, 'File Descriptors', 'descriptors', 'overview',
49 - 'rabbitmq.file_descriptors', 'line'],
61 + 'options': [None, 'File Descriptors', 'descriptors', 'overview', 'rabbitmq.file_descriptors', 'line'],
62 'lines': [
63 ['fd_used', 'used', 'absolute']
52 - ]},
64 + ]
65 + },
66 'memory': {
54 - 'options': [None, 'Memory', 'MB', 'overview',
55 - 'rabbitmq.memory', 'line'],
67 + 'options': [None, 'Memory', 'MB', 'overview', 'rabbitmq.memory', 'line'],
68 'lines': [
69 ['mem_used', 'used', 'absolute', 1, 1024 << 10]
58 - ]},
70 + ]
71 + },
72 'disk_space': {
60 - 'options': [None, 'Disk Space', 'GB', 'overview',
61 - 'rabbitmq.disk_space', 'line'],
73 + 'options': [None, 'Disk Space', 'GB', 'overview', 'rabbitmq.disk_space', 'line'],
74 'lines': [
75 ['disk_free', 'free', 'absolute', 1, 1024 ** 3]
64 - ]},
76 + ]
77 + },
78 'socket_descriptors': {
66 - 'options': [None, 'Socket Descriptors', 'descriptors', 'overview',
67 - 'rabbitmq.sockets', 'line'],
79 + 'options': [None, 'Socket Descriptors', 'descriptors', 'overview', 'rabbitmq.sockets', 'line'],
80 'lines': [
81 ['sockets_used', 'used', 'absolute']
70 - ]},
82 + ]
83 + },
84 'erlang_processes': {
72 - 'options': [None, 'Erlang Processes', 'processes', 'overview',
73 - 'rabbitmq.processes', 'line'],
85 + 'options': [None, 'Erlang Processes', 'processes', 'overview', 'rabbitmq.processes', 'line'],
86 'lines': [
87 ['proc_used', 'used', 'absolute']
76 - ]},
88 + ]
89 + },
90 'erlang_run_queue': {
78 - 'options': [None, 'Erlang Run Queue', 'processes', 'overview',
79 - 'rabbitmq.erlang_run_queue', 'line'],
91 + 'options': [None, 'Erlang Run Queue', 'processes', 'overview', 'rabbitmq.erlang_run_queue', 'line'],
92 'lines': [
81 - ['run_queue',' length', 'absolute']
82 - ]},
93 + ['run_queue', 'length', 'absolute']
94 + ]
95 + },
96 'global_counts': {
84 - 'options': [None, 'Global Counts', 'counts', 'overview',
85 - 'rabbitmq.global_counts', 'line'],
97 + 'options': [None, 'Global Counts', 'counts', 'overview', 'rabbitmq.global_counts', 'line'],
98 'lines': [
99 ['object_totals_channels', 'channels', 'absolute'],
100 ['object_totals_consumers', 'consumers', 'absolute'],
101 ['object_totals_connections', 'connections', 'absolute'],
102 ['object_totals_queues', 'queues', 'absolute'],
103 ['object_totals_exchanges', 'exchanges', 'absolute']
92 - ]},
104 + ]
105 + },
106 'queued_messages': {
94 - 'options': [None, 'Queued Messages', 'messages', 'overview',
95 - 'rabbitmq.queued_messages', 'stacked'],
107 + 'options': [None, 'Queued Messages', 'messages', 'overview', 'rabbitmq.queued_messages', 'stacked'],
108 'lines': [
109 ['queue_totals_messages_ready', 'ready', 'absolute'],
110 ['queue_totals_messages_unacknowledged', 'unacknowledged', 'absolute']
99 - ]},
111 + ]
112 + },
113 'message_rates': {
101 - 'options': [None, 'Message Rates', 'messages/s', 'overview',
102 - 'rabbitmq.message_rates', 'stacked'],
114 + 'options': [None, 'Message Rates', 'messages/s', 'overview', 'rabbitmq.message_rates', 'stacked'],
115 'lines': [
116 ['message_stats_ack', 'ack', 'incremental'],
117 ['message_stats_redeliver', 'redeliver', 'incremental'],
118 ['message_stats_deliver', 'deliver', 'incremental'],
119 ['message_stats_publish', 'publish', 'incremental']
108 - ]}
120 + ]
121 + }
122 }
123
124
python.d/redis.chart.py
+34 -22
@@ -44,29 +44,32 @@ CHARTS = {
44 'lines': [
45 ['total_commands_processed', 'commands', 'incremental'],
46 ['instantaneous_ops_per_sec', 'operations', 'absolute']
47 - ]},
47 + ]
48 + },
49 'hit_rate': {
50 'options': [None, 'Hit rate', 'percent', 'hits', 'redis.hit_rate', 'line'],
51 'lines': [
52 ['hit_rate', 'rate', 'absolute']
52 - ]},
53 + ]
54 + },
55 'memory': {
56 'options': [None, 'Memory utilization', 'kilobytes', 'memory', 'redis.memory', 'line'],
57 'lines': [
58 ['used_memory', 'total', 'absolute', 1, 1024],
59 ['used_memory_lua', 'lua', 'absolute', 1, 1024]
58 - ]},
60 + ]
61 + },
62 'net': {
63 'options': [None, 'Bandwidth', 'kilobits/s', 'network', 'redis.net', 'area'],
64 'lines': [
65 ['total_net_input_bytes', 'in', 'incremental', 8, 1024],
66 ['total_net_output_bytes', 'out', 'incremental', -8, 1024]
64 - ]},
67 + ]
68 + },
69 'keys_redis': {
70 'options': [None, 'Keys per Database', 'keys', 'keys', 'redis.keys', 'line'],
67 - 'lines': [
68 - # lines are created dynamically in `check()` method
69 - ]},
71 + 'lines': []
72 + },
73 'keys_pika': {
74 'options': [None, 'Keys', 'keys', 'keys', 'redis.keys', 'line'],
75 'lines': [
@@ -75,52 +78,61 @@ CHARTS = {
78 ['list_keys', 'list', 'absolute'],
79 ['zset_keys', 'zset', 'absolute'],
80 ['set_keys', 'set', 'absolute']
78 - ]},
81 + ]
82 + },
83 'eviction': {
84 'options': [None, 'Evicted Keys', 'keys', 'keys', 'redis.eviction', 'line'],
85 'lines': [
86 ['evicted_keys', 'evicted', 'absolute']
83 - ]},
87 + ]
88 + },
89 'connections': {
90 'options': [None, 'Connections', 'connections/s', 'connections', 'redis.connections', 'line'],
91 'lines': [
92 ['total_connections_received', 'received', 'incremental', 1],
93 ['rejected_connections', 'rejected', 'incremental', -1]
89 - ]},
94 + ]
95 + },
96 'clients': {
97 'options': [None, 'Clients', 'clients', 'connections', 'redis.clients', 'line'],
98 'lines': [
99 ['connected_clients', 'connected', 'absolute', 1],
100 ['blocked_clients', 'blocked', 'absolute', -1]
95 - ]},
101 + ]
102 + },
103 'slaves': {
104 'options': [None, 'Slaves', 'slaves', 'replication', 'redis.slaves', 'line'],
105 'lines': [
106 ['connected_slaves', 'connected', 'absolute']
100 - ]},
107 + ]
108 + },
109 'persistence': {
110 'options': [None, 'Persistence Changes Since Last Save', 'changes', 'persistence',
111 'redis.rdb_changes', 'line'],
112 'lines': [
113 ['rdb_changes_since_last_save', 'changes', 'absolute']
106 - ]},
114 + ]
115 + },
116 'bgsave_now': {
117 'options': [None, 'Duration of the RDB Save Operation', 'seconds', 'persistence',
118 'redis.bgsave_now', 'absolute'],
119 'lines': [
120 ['rdb_bgsave_in_progress', 'rdb save', 'absolute']
112 - ]},
121 + ]
122 + },
123 'bgsave_health': {
124 'options': [None, 'Status of the Last RDB Save Operation', 'status', 'persistence',
125 'redis.bgsave_health', 'line'],
126 'lines': [
127 ['rdb_last_bgsave_status', 'rdb save', 'absolute']
118 - ]},
128 + ]
129 + },
130 'uptime': {
131 'options': [None, 'Uptime', 'seconds', 'uptime', 'redis.uptime', 'line'],
132 'lines': [
133 ['uptime_in_seconds', 'uptime', 'absolute']
123 - ]}
134 + ]
135 + }
136 }
137
138
@@ -153,7 +165,7 @@ class Service(SocketService):
165 if not resp:
166 return False
167 if resp.strip() != '+OK':
156 - self.error("invalid password")
168 + self.error('invalid password')
169 return False
170 return True
171
@@ -169,7 +181,7 @@ class Service(SocketService):
181 parsed = RE.findall(resp)
182
183 if not parsed:
172 - self.error("response is invalid/empty")
184 + self.error('response is invalid/empty')
185 return None
186
187 return dict((k.replace(' ', '_'), v) for k, v in parsed)
@@ -215,12 +227,12 @@ class Service(SocketService):
227 if not data:
228 return False
229
218 - self.order = PIKA_ORDER if data.get("pika_version") else REDIS_ORDER
230 + self.order = PIKA_ORDER if data.get('pika_version') else REDIS_ORDER
231
232 for n in self.order:
233 self.definitions.update(copy_chart(n))
234
223 - if data.get("redis_version"):
235 + if data.get('redis_version'):
236 for k in data:
237 if k.startswith('db'):
238 self.definitions['keys_redis']['lines'].append([k, None, 'absolute'])
@@ -242,8 +254,8 @@ class Service(SocketService):
254 supposed = int(supposed)
255
256 if length - offset >= supposed:
245 - self.debug("received full response from redis")
257 + self.debug('received full response from redis')
258 return True
259
248 - self.debug("waiting more data from redis")
260 + self.debug('waiting more data from redis')
261 return False
python.d/rethinkdbs.chart.py
+7 -7
@@ -34,21 +34,21 @@ def cluster_charts():
34 'line'],
35 'lines': [
36 ['cluster_clients_active', 'active'],
37 - ]
38 - },
37 + ]
38 + },
39 'cluster_queries': {
40 'options': [None, 'Queries', 'queries/s', 'cluster', 'rethinkdb.cluster_queries', 'line'],
41 'lines': [
42 ['cluster_queries_per_sec', 'queries'],
43 - ]
44 - },
43 + ]
44 + },
45 'cluster_documents': {
46 'options': [None, 'Documents', 'documents/s', 'cluster', 'rethinkdb.cluster_documents', 'line'],
47 'lines': [
48 ['cluster_read_docs_per_sec', 'reads'],
49 ['cluster_written_docs_per_sec', 'writes'],
50 - ]
51 - },
50 + ]
51 + },
52 }
53
54
@@ -126,7 +126,7 @@ class Server:
126 'queries_total': qe['queries_total'],
127 'read_docs_total': qe['read_docs_total'],
128 'written_docs_total': qe['written_docs_total'],
129 - }
129 + }
130
131 return dict(('{0}_{1}'.format(self.name, k), d[k]) for k in d)
132
python.d/retroshare.chart.py
+6 -3
@@ -21,19 +21,22 @@ CHARTS = {
21 'lines': [
22 ['bandwidth_up_kb', 'Upload'],
23 ['bandwidth_down_kb', 'Download']
24 - ]},
24 + ]
25 + },
26 'peers': {
27 'options': [None, 'RetroShare Peers', 'peers', 'RetroShare', 'retroshare.peers', 'line'],
28 'lines': [
29 ['peers_all', 'All friends'],
30 ['peers_connected', 'Connected friends']
30 - ]},
31 + ]
32 + },
33 'dht': {
34 'options': [None, 'Retroshare DHT', 'peers', 'RetroShare', 'retroshare.dht', 'line'],
35 'lines': [
36 ['dht_size_all', 'DHT nodes estimated'],
37 ['dht_size_rs', 'RS nodes estimated']
36 - ]}
38 + ]
39 + }
40 }
41
42