@cryptotaxi247 / netdata-1 / commits / f1d133190

collectors/python.d: format modules code (#7832)

* collectors/python.d/adaptec_raid: format code * collectors/python.d/am2320: format code * collectors/python.d/apache: format code * collectors/python.d/beanstalk: format code * collectors/python.d/bind_rndc: format code * collectors/python.d/boinc: format code * collectors/python.d/ceph: format code * collectors/python.d/couchdb: format code * collectors/python.d/dns_query_time: format code * collectors/python.d/dnsdist: format code * collectors/python.d/dockerd: format code * collectors/python.d/dovecot: format code * collectors/python.d/energid: format code * collectors/python.d/example: format code * collectors/python.d/exim: format code * collectors/python.d/fail2ban: format code * collectors/python.d/freeradius: format code * collectors/python.d/gearman: format code * collectors/python.d/go_expvar: format code * collectors/python.d/haproxy: format code * collectors/python.d/hddtemp: format code * collectors/python.d/hpssa: format code * collectors/python.d/httpcheck: format code * collectors/python.d/icecast: format code * collectors/python.d/ipfs: format code * collectors/python.d/isc_dhcpd: format code * collectors/python.d/litespeed: format code * collectors/python.d/megacli: format code * collectors/python.d/memcached: format code * collectors/python.d/mongodb: format code * collectors/python.d/mysql: format code * collectors/python.d/nginx: format code * collectors/python.d/nginx_plus: format code * collectors/python.d/nsd: format code * collectors/python.d/ntpd: format code * collectors/python.d/openldap: format code * collectors/python.d/oracledb: format code * collectors/python.d/ovpn_status_log: format code * collectors/python.d/phpfpm: format code * collectors/python.d/portcheck: format code * collectors/python.d/powerdns: format code * collectors/python.d/proxysql: format code * collectors/python.d/puppet: format code * collectors/python.d/redis: format code * collectors/python.d/rethinkdbs: format code * collectors/python.d/retroshare: format code * collectors/python.d/riakkv: format code * collectors/python.d/samba: format code * collectors/python.d/sensors: format code * collectors/python.d/smartd_log: format code * collectors/python.d/spigotmc: format code * collectors/python.d/springboot: format code * collectors/python.d/squid: format code * collectors/python.d/tomcat: format code * collectors/python.d/tor: format code * collectors/python.d/traefik: format code * collectors/python.d/unbound: format code * collectors/python.d/uwsgi: format code * collectors/python.d/varnish: format code * collectors/python.d/w1sensor: format code * collectors/python.d/weblog: format code

Ilya Mashchenko committed Jan 24, 2020 at 12:08 UTC f1d133190bda44504a7f55834ec626ab4e3d32ee
61 files changed +162 -187
collectors/python.d.plugin/adaptec_raid/adaptec_raid.chart.py
-2
@@ -5,13 +5,11 @@
5
6
7 import re
8 -
8 from copy import deepcopy
9
10 from bases.FrameworkServices.ExecutableService import ExecutableService
11 from bases.collection import find_binary
12
14 -
13 disabled_by_default = True
14
15 update_every = 5
collectors/python.d.plugin/am2320/am2320.chart.py
+4 -5
@@ -7,14 +7,13 @@ try:
7 import board
8 import busio
9 import adafruit_am2320
10 +
11 HAS_AM2320 = True
12 except ImportError:
13 HAS_AM2320 = False
14
14 -
15 from bases.FrameworkServices.SimpleService import SimpleService
16
17 -
17 ORDER = [
18 'temperature',
19 'humidity',
@@ -60,9 +59,9 @@ class Service(SimpleService):
59 def get_data(self):
60 try:
61 return {
63 - 'temperature': self.am.temperature,
64 - 'humidity': self.am.relative_humidity,
65 - }
62 + 'temperature': self.am.temperature,
63 + 'humidity': self.am.relative_humidity,
64 + }
65
66 except (OSError, RuntimeError) as error:
67 self.error(error)
collectors/python.d.plugin/apache/apache.chart.py
-1
@@ -5,7 +5,6 @@
5
6 from bases.FrameworkServices.UrlService import UrlService
7
8 -
8 ORDER = [
9 'requests',
10 'connections',
collectors/python.d.plugin/beanstalk/beanstalk.chart.py
+2 -2
@@ -5,6 +5,7 @@
5
6 try:
7 import beanstalkc
8 +
9 BEANSTALKC = True
10 except ImportError:
11 BEANSTALKC = False
@@ -12,7 +13,6 @@ except ImportError:
13 from bases.FrameworkServices.SimpleService import SimpleService
14 from bases.loaders import load_yaml
15
15 -
16 ORDER = [
17 'cpu_usage',
18 'jobs_rate',
@@ -109,7 +109,7 @@ CHARTS = {
109 'options': [None, 'Uptime', 'seconds', 'server statistics', 'beanstalk.uptime', 'line'],
110 'lines': [
111 ['uptime'],
112 - ]
112 + ]
113 }
114 }
115
collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py
+1 -3
@@ -4,13 +4,11 @@
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 import os
7 -
7 from collections import defaultdict
8 from subprocess import Popen
9
11 -from bases.collection import find_binary
10 from bases.FrameworkServices.SimpleService import SimpleService
13 -
11 +from bases.collection import find_binary
12
13 update_every = 30
14
collectors/python.d.plugin/boinc/boinc.chart.py
-2
@@ -6,10 +6,8 @@
6 import socket
7
8 from bases.FrameworkServices.SimpleService import SimpleService
9 -
9 from third_party import boinc_client
10
12 -
11 ORDER = [
12 'tasks',
13 'states',
collectors/python.d.plugin/ceph/ceph.chart.py
+9 -8
@@ -5,6 +5,7 @@
5
6 try:
7 import rados
8 +
9 CEPH = True
10 except ImportError:
11 CEPH = False
@@ -161,7 +162,7 @@ class Service(SimpleService):
162 :return: None
163 """
164 # Pool lines
164 - for pool in sorted(self._get_df()['pools'], key=lambda x:sorted(x.keys())):
165 + for pool in sorted(self._get_df()['pools'], key=lambda x: sorted(x.keys())):
166 self.definitions['pool_usage']['lines'].append([pool['name'],
167 pool['name'],
168 'absolute'])
@@ -169,20 +170,20 @@ class Service(SimpleService):
170 pool['name'],
171 'absolute'])
172 self.definitions['pool_read_bytes']['lines'].append(['read_{0}'.format(pool['name']),
172 - pool['name'],
173 - 'absolute', 1, 1024])
174 - self.definitions['pool_write_bytes']['lines'].append(['write_{0}'.format(pool['name']),
173 pool['name'],
174 'absolute', 1, 1024])
175 + self.definitions['pool_write_bytes']['lines'].append(['write_{0}'.format(pool['name']),
176 + pool['name'],
177 + 'absolute', 1, 1024])
178 self.definitions['pool_read_operations']['lines'].append(['read_operations_{0}'.format(pool['name']),
178 - pool['name'],
179 - 'absolute'])
180 - self.definitions['pool_write_operations']['lines'].append(['write_operations_{0}'.format(pool['name']),
179 pool['name'],
180 'absolute'])
181 + self.definitions['pool_write_operations']['lines'].append(['write_operations_{0}'.format(pool['name']),
182 + pool['name'],
183 + 'absolute'])
184
185 # OSD lines
185 - for osd in sorted(self._get_osd_df()['nodes'], key=lambda x:sorted(x.keys())):
186 + for osd in sorted(self._get_osd_df()['nodes'], key=lambda x: sorted(x.keys())):
187 self.definitions['osd_usage']['lines'].append([osd['name'],
188 osd['name'],
189 'absolute'])
collectors/python.d.plugin/couchdb/couchdb.chart.py
+11 -13
@@ -6,8 +6,8 @@
6
7 from collections import namedtuple, defaultdict
8 from json import loads
9 -from threading import Thread
9 from socket import gethostbyname, gaierror
10 +from threading import Thread
11
12 try:
13 from queue import Queue
@@ -16,10 +16,8 @@ except ImportError:
16
17 from bases.FrameworkServices.UrlService import UrlService
18
19 -
19 update_every = 1
20
22 -
21 METHODS = namedtuple('METHODS', ['get_data', 'url', 'stats'])
22
23 OVERVIEW_STATS = [
@@ -127,7 +125,7 @@ CHARTS = {
125 ['couchdb_httpd_request_methods_GET', 'GET', 'incremental'],
126 ['couchdb_httpd_request_methods_HEAD', 'HEAD', 'incremental'],
127 ['couchdb_httpd_request_methods_OPTIONS', 'OPTIONS',
130 - 'incremental'],
128 + 'incremental'],
129 ['couchdb_httpd_request_methods_POST', 'POST', 'incremental'],
130 ['couchdb_httpd_request_methods_PUT', 'PUT', 'incremental']
131 ]
@@ -141,13 +139,13 @@ CHARTS = {
139 ['couchdb_httpd_status_codes_201', '201 Created', 'incremental'],
140 ['couchdb_httpd_status_codes_202', '202 Accepted', 'incremental'],
141 ['couchdb_httpd_status_codes_2xx', 'Other 2xx Success',
144 - 'incremental'],
142 + 'incremental'],
143 ['couchdb_httpd_status_codes_3xx', '3xx Redirection',
146 - 'incremental'],
144 + 'incremental'],
145 ['couchdb_httpd_status_codes_4xx', '4xx Client error',
148 - 'incremental'],
146 + 'incremental'],
147 ['couchdb_httpd_status_codes_5xx', '5xx Server error',
150 - 'incremental']
148 + 'incremental']
149 ]
150 },
151 'open_files': {
@@ -280,19 +278,19 @@ class Service(UrlService):
278 if self._get_raw_data(self.url + '/' + db)]
279 for db in self.dbs:
280 self.definitions['db_sizes_file']['lines'].append(
283 - ['db_'+db+'_sizes_file', db, 'absolute', 1, 1000]
281 + ['db_' + db + '_sizes_file', db, 'absolute', 1, 1000]
282 )
283 self.definitions['db_sizes_external']['lines'].append(
286 - ['db_'+db+'_sizes_external', db, 'absolute', 1, 1000]
284 + ['db_' + db + '_sizes_external', db, 'absolute', 1, 1000]
285 )
286 self.definitions['db_sizes_active']['lines'].append(
289 - ['db_'+db+'_sizes_active', db, 'absolute', 1, 1000]
287 + ['db_' + db + '_sizes_active', db, 'absolute', 1, 1000]
288 )
289 self.definitions['db_doc_counts']['lines'].append(
292 - ['db_'+db+'_doc_count', db, 'absolute']
290 + ['db_' + db + '_doc_count', db, 'absolute']
291 )
292 self.definitions['db_doc_del_counts']['lines'].append(
295 - ['db_'+db+'_doc_del_count', db, 'absolute']
293 + ['db_' + db + '_doc_del_count', db, 'absolute']
294 )
295 return UrlService.check(self)
296
collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py
+1 -1
@@ -11,6 +11,7 @@ try:
11 import dns.message
12 import dns.query
13 import dns.name
14 +
15 DNS_PYTHON = True
16 except ImportError:
17 DNS_PYTHON = False
@@ -22,7 +23,6 @@ except ImportError:
23
24 from bases.FrameworkServices.SimpleService import SimpleService
25
25 -
26 update_every = 5
27
28
collectors/python.d.plugin/dnsdist/dnsdist.chart.py
-2
@@ -5,7 +5,6 @@ from json import loads
5
6 from bases.FrameworkServices.UrlService import UrlService
7
8 -
8 ORDER = [
9 'queries',
10 'queries_dropped',
@@ -21,7 +20,6 @@ ORDER = [
20 'query_latency_avg'
21 ]
22
24 -
23 CHARTS = {
24 'queries': {
25 'options': [None, 'Client queries received', 'queries/s', 'queries', 'dnsdist.queries', 'line'],
collectors/python.d.plugin/dockerd/dockerd.chart.py
+2 -3
@@ -4,14 +4,14 @@
4
5 try:
6 import docker
7 +
8 HAS_DOCKER = True
9 except ImportError:
10 HAS_DOCKER = False
11
11 -from bases.FrameworkServices.SimpleService import SimpleService
12 -
12 from distutils.version import StrictVersion
13
14 +from bases.FrameworkServices.SimpleService import SimpleService
15
16 # charts order (can be overridden if you want less charts, or different order)
17 ORDER = [
@@ -44,7 +44,6 @@ CHARTS = {
44 }
45 }
46
47 -
47 MIN_REQUIRED_VERSION = '3.2.0'
48
49
collectors/python.d.plugin/dovecot/dovecot.chart.py
+2 -3
@@ -5,10 +5,8 @@
5
6 from bases.FrameworkServices.SocketService import SocketService
7
8 -
8 UNIX_SOCKET = '/var/run/dovecot/stats'
9
11 -
10 ORDER = [
11 'sessions',
12 'logins',
@@ -51,7 +49,8 @@ CHARTS = {
49 ]
50 },
51 'context_switches': {
54 - 'options': [None, 'Dovecot Context Switches', 'switches', 'context switches', 'dovecot.context_switches', 'line'],
52 + 'options': [None, 'Dovecot Context Switches', 'switches', 'context switches', 'dovecot.context_switches',
53 + 'line'],
54 'lines': [
55 ['vol_cs', 'voluntary', 'absolute'],
56 ['invol_cs', 'involuntary', 'absolute']
collectors/python.d.plugin/energid/energid.chart.py
+10 -9
@@ -41,9 +41,9 @@ CHARTS = {
41 'mempool': {
42 'options': [None, 'MemPool', 'MiB', 'memory', 'energid.mempool', 'area'],
43 'lines': [
44 - ['mempool_max', 'Max', 'absolute', None, 1024*1024],
45 - ['mempool_current', 'Usage', 'absolute', None, 1024*1024],
46 - ['mempool_txsize', 'TX Size', 'absolute', None, 1024*1024],
44 + ['mempool_max', 'Max', 'absolute', None, 1024 * 1024],
45 + ['mempool_current', 'Usage', 'absolute', None, 1024 * 1024],
46 + ['mempool_txsize', 'TX Size', 'absolute', None, 1024 * 1024],
47 ],
48 },
49 'secmem': {
@@ -93,22 +93,23 @@ METHODS = {
93 'mempool_max': r['maxmempool'],
94 },
95 'getmemoryinfo': lambda r: dict([
96 - ('secmem_' + k, v) for (k,v) in r['locked'].items()
96 + ('secmem_' + k, v) for (k, v) in r['locked'].items()
97 ]),
98 'getnetworkinfo': lambda r: {
99 - 'network_timeoffset' : r['timeoffset'],
99 + 'network_timeoffset': r['timeoffset'],
100 'network_connections': r['connections'],
101 },
102 'gettxoutsetinfo': lambda r: {
103 - 'utxo_count' : r['txouts'],
104 - 'utxo_xfers' : r['transactions'],
105 - 'utxo_size' : r['disk_size'],
106 - 'utxo_amount' : r['total_amount'],
103 + 'utxo_count': r['txouts'],
104 + 'utxo_xfers': r['transactions'],
105 + 'utxo_size': r['disk_size'],
106 + 'utxo_amount': r['total_amount'],
107 },
108 }
109
110 JSON_RPC_VERSION = '1.1'
111
112 +
113 class Service(UrlService):
114 def __init__(self, configuration=None, name=None):
115 UrlService.__init__(self, configuration=configuration, name=name)
collectors/python.d.plugin/example/example.chart.py
-1
@@ -7,7 +7,6 @@ from random import SystemRandom
7
8 from bases.FrameworkServices.SimpleService import SimpleService
9
10 -
10 priority = 90000
11
12 ORDER = [
collectors/python.d.plugin/exim/exim.chart.py
-1
@@ -5,7 +5,6 @@
5
6 from bases.FrameworkServices.ExecutableService import ExecutableService
7
8 -
8 EXIM_COMMAND = 'exim -bpc'
9
10 ORDER = [
collectors/python.d.plugin/fail2ban/fail2ban.chart.py
+6 -8
@@ -3,15 +3,13 @@
3 # Author: ilyam8
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 -import re
6 import os
8 -
7 +import re
8 from collections import defaultdict
9 from glob import glob
10
11 from bases.FrameworkServices.LogService import LogService
12
14 -
13 ORDER = [
14 'jails_bans',
15 'jails_in_jail',
@@ -25,13 +23,13 @@ def charts(jails):
23
24 ch = {
25 ORDER[0]: {
28 - 'options': [None, 'Jails Ban Rate', 'bans/s', 'bans', 'jail.bans', 'line'],
29 - 'lines': []
26 + 'options': [None, 'Jails Ban Rate', 'bans/s', 'bans', 'jail.bans', 'line'],
27 + 'lines': []
28 },
29 ORDER[1]: {
32 - 'options': [None, 'Banned IPs (since the last restart of netdata)', 'IPs', 'in jail',
33 - 'jail.in_jail', 'line'],
34 - 'lines': []
30 + 'options': [None, 'Banned IPs (since the last restart of netdata)', 'IPs', 'in jail',
31 + 'jail.in_jail', 'line'],
32 + 'lines': []
33 },
34 }
35 for jail in jails:
collectors/python.d.plugin/freeradius/freeradius.chart.py
+1 -1
@@ -6,8 +6,8 @@
6 import re
7 from subprocess import Popen, PIPE
8
9 -from bases.collection import find_binary
9 from bases.FrameworkServices.SimpleService import SimpleService
10 +from bases.collection import find_binary
11
12 update_every = 15
13
collectors/python.d.plugin/gearman/gearman.chart.py
+3 -1
@@ -4,9 +4,9 @@
4
5 # Gearman Netdata Plugin
6
7 -from bases.FrameworkServices.SocketService import SocketService
7 from copy import deepcopy
8
9 +from bases.FrameworkServices.SocketService import SocketService
10
11 CHARTS = {
12 'total_workers': {
@@ -29,6 +29,7 @@ def job_chart_template(job_name):
29 ]
30 }
31
32 +
33 def build_result_dict(job):
34 """
35 Get the status for each job
@@ -46,6 +47,7 @@ def build_result_dict(job):
47 '{0}_running'.format(job['job_name']): running,
48 }
49
50 +
51 def parse_worker_data(job):
52 job_name = job[0]
53 job_metrics = job[1:]
collectors/python.d.plugin/go_expvar/go_expvar.chart.py
+1 -2
@@ -4,13 +4,12 @@
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 from __future__ import division
7 -import json
7
8 +import json
9 from collections import namedtuple
10
11 from bases.FrameworkServices.UrlService import UrlService
12
13 -
13 MEMSTATS_ORDER = [
14 'memstats_heap',
15 'memstats_stack',
collectors/python.d.plugin/haproxy/haproxy.chart.py
+2 -5
@@ -179,7 +179,6 @@ CHARTS = {
179 }
180 }
181
182 -
182 METRICS = {
183 'bin': {'algorithm': 'incremental', 'divisor': 1024},
184 'bout': {'algorithm': 'incremental', 'divisor': 1024},
@@ -193,7 +192,6 @@ METRICS = {
192 'hrsp_other': {'algorithm': 'incremental', 'divisor': 1}
193 }
194
196 -
195 BACKEND_METRICS = {
196 'qtime': {'algorithm': 'absolute', 'divisor': 1},
197 'ctime': {'algorithm': 'absolute', 'divisor': 1},
@@ -201,7 +199,6 @@ BACKEND_METRICS = {
199 'ttime': {'algorithm': 'absolute', 'divisor': 1}
200 }
201
204 -
202 REGEX = dict(url=re_compile(r'idle = (?P<idle>[0-9]+)'),
203 socket=re_compile(r'Idle_pct: (?P<idle>[0-9]+)'))
204
@@ -309,7 +306,7 @@ class Service(UrlService, SocketService):
306 name, METRICS[metric]['algorithm'], 1,
307 METRICS[metric]['divisor']])
308 self.definitions['fhrsp_total']['lines'].append(['_'.join(['frontend', 'hrsp_total', idx]),
312 - name, 'incremental', 1, 1])
309 + name, 'incremental', 1, 1])
310 for back in self.data['backend']:
311 name, idx = back['# pxname'], back['# pxname'].replace('.', '_')
312 for metric in METRICS:
@@ -317,7 +314,7 @@ class Service(UrlService, SocketService):
314 name, METRICS[metric]['algorithm'], 1,
315 METRICS[metric]['divisor']])
316 self.definitions['bhrsp_total']['lines'].append(['_'.join(['backend', 'hrsp_total', idx]),
320 - name, 'incremental', 1, 1])
317 + name, 'incremental', 1, 1])
318 for metric in BACKEND_METRICS:
319 self.definitions['b' + metric]['lines'].append(['_'.join(['backend', metric, idx]),
320 name, BACKEND_METRICS[metric]['algorithm'], 1,
collectors/python.d.plugin/hddtemp/hddtemp.chart.py
-2
@@ -6,12 +6,10 @@
6
7
8 import re
9 -
9 from copy import deepcopy
10
11 from bases.FrameworkServices.SocketService import SocketService
12
14 -
13 ORDER = [
14 'temperatures',
15 ]
collectors/python.d.plugin/hpssa/hpssa.chart.py
+1 -1
@@ -5,10 +5,10 @@
5
6 import os
7 import re
8 +from copy import deepcopy
9
10 from bases.FrameworkServices.ExecutableService import ExecutableService
11 from bases.collection import find_binary
11 -from copy import deepcopy
12
13 disabled_by_default = True
14 update_every = 5
collectors/python.d.plugin/httpcheck/httpcheck.chart.py
+2 -1
@@ -3,9 +3,10 @@
3 # Original Author: ccremer (github.com/ccremer)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 -import urllib3
6 import re
7
8 +import urllib3
9 +
10 try:
11 from time import monotonic as time
12 except ImportError:
collectors/python.d.plugin/icecast/icecast.chart.py
-1
@@ -7,7 +7,6 @@ import json
7
8 from bases.FrameworkServices.UrlService import UrlService
9
10 -
10 ORDER = [
11 'listeners',
12 ]
collectors/python.d.plugin/ipfs/ipfs.chart.py
+5 -6
@@ -7,7 +7,6 @@ import json
7
8 from bases.FrameworkServices.UrlService import UrlService
9
10 -
10 ORDER = [
11 'bandwidth',
12 'peers',
@@ -89,7 +88,7 @@ class Service(UrlService):
88 if store_max.endswith('b'):
89 val, units = store_max[:-2], store_max[-2]
90 if units in SI_zeroes:
92 - val += '0'*SI_zeroes[units]
91 + val += '0' * SI_zeroes[units]
92 store_max = val
93 try:
94 store_max = int(store_max)
@@ -117,10 +116,10 @@ class Service(UrlService):
116 [('size', 'RepoSize', int), ('objects', 'NumObjects', int), ('avail', 'StorageMax', self._storagemax)],
117 }
118 if self.do_pinapi:
120 - cfg.update({
121 - '/api/v0/pin/ls':
122 - [('pinned', 'Keys', len), ('recursive_pins', 'Keys', self._recursive_pins)]
123 - })
119 + cfg.update({
120 + '/api/v0/pin/ls':
121 + [('pinned', 'Keys', len), ('recursive_pins', 'Keys', self._recursive_pins)]
122 + })
123 r = dict()
124 for suburl in cfg:
125 in_json = self._get_json(suburl)
collectors/python.d.plugin/isc_dhcpd/isc_dhcpd.chart.py
+1 -2
@@ -7,9 +7,9 @@ import os
7 import re
8 import time
9
10 -
10 try:
11 import ipaddress
12 +
13 HAVE_IP_ADDRESS = True
14 except ImportError:
15 HAVE_IP_ADDRESS = False
@@ -19,7 +19,6 @@ from copy import deepcopy
19
20 from bases.FrameworkServices.SimpleService import SimpleService
21
22 -
22 ORDER = [
23 'pools_utilization',
24 'pools_active_leases',
collectors/python.d.plugin/litespeed/litespeed.chart.py
+9 -11
@@ -4,27 +4,25 @@
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 import glob
7 -import re
7 import os
9 -
8 +import re
9 from collections import namedtuple
10
11 from bases.FrameworkServices.SimpleService import SimpleService
12
14 -
13 update_every = 10
14
15 # charts order (can be overridden if you want less charts, or different order)
16 ORDER = [
19 - 'net_throughput_http', # net throughput
17 + 'net_throughput_http', # net throughput
18 'net_throughput_https', # net throughput
21 - 'connections_http', # connections
22 - 'connections_https', # connections
23 - 'requests', # requests
24 - 'requests_processing', # requests
25 - 'pub_cache_hits', # cache
26 - 'private_cache_hits', # cache
27 - 'static_hits', # static
19 + 'connections_http', # connections
20 + 'connections_https', # connections
21 + 'requests', # requests
22 + 'requests_processing', # requests
23 + 'pub_cache_hits', # cache
24 + 'private_cache_hits', # cache
25 + 'static_hits', # static
26 ]
27
28 CHARTS = {
collectors/python.d.plugin/megacli/megacli.chart.py
+2 -3
@@ -9,7 +9,6 @@ import re
9 from bases.FrameworkServices.ExecutableService import ExecutableService
10 from bases.collection import find_binary
11
12 -
12 disabled_by_default = True
13
14 update_every = 5
@@ -27,7 +26,7 @@ def adapter_charts(ads):
26 'adapter_degraded': {
27 'options': [None, 'Adapter State', 'is degraded', 'adapter', 'megacli.adapter_degraded', 'line'],
28 'lines': dims(ads)
30 - },
29 + },
30 }
31
32 return order, charts
@@ -111,7 +110,7 @@ def find_adapters(d):
110
111
112 def find_pds(d):
114 - keys = ('Slot Number', 'Media Error Count', 'Predictive Failure Count')
113 + keys = ('Slot Number', 'Media Error Count', 'Predictive Failure Count')
114 d = ' '.join(v.strip() for v in d if v.startswith(keys))
115 return [PD(*v) for v in RE_VD.findall(d)]
116
collectors/python.d.plugin/memcached/memcached.chart.py
-1
@@ -5,7 +5,6 @@
5
6 from bases.FrameworkServices.SocketService import SocketService
7
8 -
8 ORDER = [
9 'cache',
10 'net',
collectors/python.d.plugin/mongodb/mongodb.chart.py
+1 -1
@@ -12,13 +12,13 @@ from sys import exc_info
12 try:
13 from pymongo import MongoClient, ASCENDING, DESCENDING
14 from pymongo.errors import PyMongoError
15 +
16 PYMONGO = True
17 except ImportError:
18 PYMONGO = False
19
20 from bases.FrameworkServices.SimpleService import SimpleService
21
21 -
22 REPL_SET_STATES = [
23 ('1', 'primary'),
24 ('8', 'down'),
collectors/python.d.plugin/mysql/mysql.chart.py
-1
@@ -6,7 +6,6 @@
6
7 from bases.FrameworkServices.MySQLService import MySQLService
8
9 -
9 # query executed on MySQL server
10 QUERY_GLOBAL = 'SHOW GLOBAL STATUS;'
11 QUERY_SLAVE = 'SHOW SLAVE STATUS;'
collectors/python.d.plugin/nginx/nginx.chart.py
-1
@@ -5,7 +5,6 @@
5
6 from bases.FrameworkServices.UrlService import UrlService
7
8 -
8 ORDER = [
9 'connections',
10 'requests',
collectors/python.d.plugin/nginx_plus/nginx_plus.chart.py
-1
@@ -16,7 +16,6 @@ except ImportError:
16
17 from bases.FrameworkServices.UrlService import UrlService
18
19 -
19 ORDER = [
20 'requests_total',
21 'requests_current',
collectors/python.d.plugin/nsd/nsd.chart.py
-1
@@ -7,7 +7,6 @@ import re
7
8 from bases.FrameworkServices.ExecutableService import ExecutableService
9
10 -
10 update_every = 30
11
12 NSD_CONTROL_COMMAND = 'nsd-control stats_noreset'
collectors/python.d.plugin/ntpd/ntpd.chart.py
+1 -2
@@ -4,12 +4,11 @@
4 # Author: Ilya Mashchenko (ilyam8)
5 # SPDX-License-Identifier: GPL-3.0-or-later
6
7 -import struct
7 import re
8 +import struct
9
10 from bases.FrameworkServices.SocketService import SocketService
11
12 -
12 # NTP Control Message Protocol constants
13 MODE = 6
14 HEADER_FORMAT = '!BBHHHHH'
collectors/python.d.plugin/openldap/openldap.chart.py
+3 -3
@@ -5,13 +5,13 @@
5
6 try:
7 import ldap
8 +
9 HAS_LDAP = True
10 except ImportError:
11 HAS_LDAP = False
12
13 from bases.FrameworkServices.SimpleService import SimpleService
14
14 -
15 DEFAULT_SERVER = 'localhost'
16 DEFAULT_PORT = '389'
17 DEFAULT_TLS = False
@@ -110,7 +110,7 @@ SEARCH_LIST = {
110 'add_operations': (
111 'cn=Add,cn=Operations,cn=Monitor', 'monitorOpInitiated',
112 ),
113 - 'delete_operations': (
113 + 'delete_operations': (
114 'cn=Delete,cn=Operations,cn=Monitor', 'monitorOpCompleted',
115 ),
116 'modify_operations': (
@@ -193,7 +193,7 @@ class Service(SimpleService):
193 num = self.conn.search(dn, ldap.SCOPE_BASE, 'objectClass=*', [attr, ])
194 result_type, result_data = self.conn.result(num, 1)
195 except ldap.LDAPError as error:
196 - self.error("Empty result. Check bind username/password. Message: ",error)
196 + self.error("Empty result. Check bind username/password. Message: ", error)
197 self.alive = False
198 return None
199
collectors/python.d.plugin/oracledb/oracledb.chart.py
+1 -2
@@ -9,11 +9,11 @@ from bases.FrameworkServices.SimpleService import SimpleService
9
10 try:
11 import cx_Oracle
12 +
13 HAS_ORACLE = True
14 except ImportError:
15 HAS_ORACLE = False
16
16 -
17 ORDER = [
18 'session_count',
19 'session_limit_usage',
@@ -172,7 +172,6 @@ CHARTS = {
172 },
173 }
174
175 -
175 CX_CONNECT_STRING = "{0}/{1}@//{2}/{3}"
176
177 QUERY_SYSTEM = '''
collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.chart.py
-1
@@ -7,7 +7,6 @@ import re
7
8 from bases.FrameworkServices.SimpleService import SimpleService
9
10 -
10 update_every = 10
11
12 ORDER = [
collectors/python.d.plugin/phpfpm/phpfpm.chart.py
-1
@@ -9,7 +9,6 @@ import re
9
10 from bases.FrameworkServices.UrlService import UrlService
11
12 -
12 REGEX = re.compile(r'([a-z][a-z ]+): ([\d.]+)')
13
14 POOL_INFO = [
collectors/python.d.plugin/portcheck/portcheck.chart.py
-1
@@ -12,7 +12,6 @@ except ImportError:
12
13 from bases.FrameworkServices.SimpleService import SimpleService
14
15 -
15 PORT_LATENCY = 'connect'
16
17 PORT_SUCCESS = 'success'
collectors/python.d.plugin/powerdns/powerdns.chart.py
-1
@@ -8,7 +8,6 @@ from json import loads
8
9 from bases.FrameworkServices.UrlService import UrlService
10
11 -
11 ORDER = [
12 'questions',
13 'cache_usage',
collectors/python.d.plugin/proxysql/proxysql.chart.py
+2 -1
@@ -189,7 +189,8 @@ CHARTS = {
189 'lines': []
190 },
191 'commands_duration': {
192 - 'options': [None, 'ProxySQL Commands Duration', 'milliseconds', 'commands', 'proxysql.commands_duration', 'line'],
192 + 'options': [None, 'ProxySQL Commands Duration', 'milliseconds', 'commands', 'proxysql.commands_duration',
193 + 'line'],
194 'lines': []
195 }
196 }
collectors/python.d.plugin/puppet/puppet.chart.py
+2 -4
@@ -12,14 +12,12 @@
12 #
13
14 import socket
15 -
15 from json import loads
16
17 from bases.FrameworkServices.UrlService import UrlService
18
19 update_every = 5
20
22 -
21 MiB = 1 << 20
22 CPU_SCALE = 1000
23
@@ -108,8 +106,8 @@ class Service(UrlService):
106 non_heap_mem = jvm_metrics['non-heap-memory']
107
108 for k in ['max', 'committed', 'used', 'init']:
111 - data['jvm_heap_'+k] = heap_mem[k]
112 - data['jvm_nonheap_'+k] = non_heap_mem[k]
109 + data['jvm_heap_' + k] = heap_mem[k]
110 + data['jvm_nonheap_' + k] = non_heap_mem[k]
111
112 fd_open = jvm_metrics['file-descriptors']
113 data['fd_max'] = fd_open['max']
collectors/python.d.plugin/redis/redis.chart.py
-1
@@ -5,7 +5,6 @@
5 # SPDX-License-Identifier: GPL-3.0-or-later
6
7 import re
8 -
8 from copy import deepcopy
9
10 from bases.FrameworkServices.SocketService import SocketService
collectors/python.d.plugin/rethinkdbs/rethinkdbs.chart.py
+1
@@ -5,6 +5,7 @@
5
6 try:
7 import rethinkdb as rdb
8 +
9 HAS_RETHINKDB = True
10 except ImportError:
11 HAS_RETHINKDB = False
collectors/python.d.plugin/retroshare/retroshare.chart.py
-1
@@ -7,7 +7,6 @@ import json
7
8 from bases.FrameworkServices.UrlService import UrlService
9
10 -
10 ORDER = [
11 'bandwidth',
12 'peers',
collectors/python.d.plugin/riakkv/riakkv.chart.py
+37 -18
@@ -67,14 +67,16 @@ ORDER = [
67 CHARTS = {
68 # Throughput metrics
69 "kv.node_operations": {
70 - "options": [None, "Reads & writes coordinated by this node", "operations/s", "throughput", "riak.kv.throughput", "line"],
70 + "options": [None, "Reads & writes coordinated by this node", "operations/s", "throughput", "riak.kv.throughput",
71 + "line"],
72 "lines": [
73 ["node_gets_total", "gets", "incremental"],
74 ["node_puts_total", "puts", "incremental"]
75 ]
76 },
77 "dt.vnode_updates": {
77 - "options": [None, "Update operations coordinated by local vnodes by data type", "operations/s", "throughput", "riak.dt.vnode_updates", "line"],
78 + "options": [None, "Update operations coordinated by local vnodes by data type", "operations/s", "throughput",
79 + "riak.dt.vnode_updates", "line"],
80 "lines": [
81 ["vnode_counter_update_total", "counters", "incremental"],
82 ["vnode_set_update_total", "sets", "incremental"],
@@ -94,7 +96,8 @@ CHARTS = {
96 ]
97 },
98 "consistent.operations": {
97 - "options": [None, "Consistent node operations", "operations/s", "throughput", "riak.consistent.operations", "line"],
99 + "options": [None, "Consistent node operations", "operations/s", "throughput", "riak.consistent.operations",
100 + "line"],
101 "lines": [
102 ["consistent_gets_total", "gets", "incremental"],
103 ["consistent_puts_total", "puts", "incremental"],
@@ -103,7 +106,8 @@ CHARTS = {
106
107 # Latency metrics
108 "kv.latency.get": {
106 - "options": [None, "Time between reception of a client GET request and subsequent response to client", "ms", "latency", "riak.kv.latency.get", "line"],
109 + "options": [None, "Time between reception of a client GET request and subsequent response to client", "ms",
110 + "latency", "riak.kv.latency.get", "line"],
111 "lines": [
112 ["node_get_fsm_time_mean", "mean", "absolute", 1, 1000],
113 ["node_get_fsm_time_median", "median", "absolute", 1, 1000],
@@ -113,7 +117,8 @@ CHARTS = {
117 ]
118 },
119 "kv.latency.put": {
116 - "options": [None, "Time between reception of a client PUT request and subsequent response to client", "ms", "latency", "riak.kv.latency.put", "line"],
120 + "options": [None, "Time between reception of a client PUT request and subsequent response to client", "ms",
121 + "latency", "riak.kv.latency.put", "line"],
122 "lines": [
123 ["node_put_fsm_time_mean", "mean", "absolute", 1, 1000],
124 ["node_put_fsm_time_median", "median", "absolute", 1, 1000],
@@ -123,7 +128,8 @@ CHARTS = {
128 ]
129 },
130 "dt.latency.counter": {
126 - "options": [None, "Time it takes to perform an Update Counter operation", "ms", "latency", "riak.dt.latency.counter_merge", "line"],
131 + "options": [None, "Time it takes to perform an Update Counter operation", "ms", "latency",
132 + "riak.dt.latency.counter_merge", "line"],
133 "lines": [
134 ["object_counter_merge_time_mean", "mean", "absolute", 1, 1000],
135 ["object_counter_merge_time_median", "median", "absolute", 1, 1000],
@@ -133,7 +139,8 @@ CHARTS = {
139 ]
140 },
141 "dt.latency.set": {
136 - "options": [None, "Time it takes to perform an Update Set operation", "ms", "latency", "riak.dt.latency.set_merge", "line"],
142 + "options": [None, "Time it takes to perform an Update Set operation", "ms", "latency",
143 + "riak.dt.latency.set_merge", "line"],
144 "lines": [
145 ["object_set_merge_time_mean", "mean", "absolute", 1, 1000],
146 ["object_set_merge_time_median", "median", "absolute", 1, 1000],
@@ -143,7 +150,8 @@ CHARTS = {
150 ]
151 },
152 "dt.latency.map": {
146 - "options": [None, "Time it takes to perform an Update Map operation", "ms", "latency", "riak.dt.latency.map_merge", "line"],
153 + "options": [None, "Time it takes to perform an Update Map operation", "ms", "latency",
154 + "riak.dt.latency.map_merge", "line"],
155 "lines": [
156 ["object_map_merge_time_mean", "mean", "absolute", 1, 1000],
157 ["object_map_merge_time_median", "median", "absolute", 1, 1000],
@@ -164,7 +172,8 @@ CHARTS = {
172 ]
173 },
174 "search.latency.index": {
167 - "options": [None, "Time it takes Search to index a new document", "ms", "latency", "riak.search.latency.index", "line"],
175 + "options": [None, "Time it takes Search to index a new document", "ms", "latency", "riak.search.latency.index",
176 + "line"],
177 "lines": [
178 ["search_index_latency_median", "median", "absolute", 1, 1000],
179 ["search_index_latency_min", "min", "absolute", 1, 1000],
@@ -205,7 +214,8 @@ CHARTS = {
214 ]
215 },
216 "vm.memory.processes": {
208 - "options": [None, "Memory allocated & used by Erlang processes", "MB", "vm", "riak.vm.memory.processes", "line"],
217 + "options": [None, "Memory allocated & used by Erlang processes", "MB", "vm", "riak.vm.memory.processes",
218 + "line"],
219 "lines": [
220 ["memory_processes", "allocated", "absolute", 1, 1024 * 1024],
221 ["memory_processes_used", "used", "absolute", 1, 1024 * 1024]
@@ -214,7 +224,8 @@ CHARTS = {
224
225 # General Riak Load/Health metrics
226 "kv.siblings_encountered.get": {
217 - "options": [None, "Number of siblings encountered during GET operations by this node during the past minute", "siblings", "load", "riak.kv.siblings_encountered.get", "line"],
227 + "options": [None, "Number of siblings encountered during GET operations by this node during the past minute",
228 + "siblings", "load", "riak.kv.siblings_encountered.get", "line"],
229 "lines": [
230 ["node_get_fsm_siblings_mean", "mean", "absolute"],
231 ["node_get_fsm_siblings_median", "median", "absolute"],
@@ -224,7 +235,8 @@ CHARTS = {
235 ]
236 },
237 "kv.objsize.get": {
227 - "options": [None, "Object size encountered by this node during the past minute", "KB", "load", "riak.kv.objsize.get", "line"],
238 + "options": [None, "Object size encountered by this node during the past minute", "KB", "load",
239 + "riak.kv.objsize.get", "line"],
240 "lines": [
241 ["node_get_fsm_objsize_mean", "mean", "absolute", 1, 1024],
242 ["node_get_fsm_objsize_median", "median", "absolute", 1, 1024],
@@ -234,7 +246,9 @@ CHARTS = {
246 ]
247 },
248 "search.vnodeq_size": {
237 - "options": [None, "Number of unprocessed messages in the vnode message queues of Search on this node in the past minute", "messages", "load", "riak.search.vnodeq_size", "line"],
249 + "options": [None,
250 + "Number of unprocessed messages in the vnode message queues of Search on this node in the past minute",
251 + "messages", "load", "riak.search.vnodeq_size", "line"],
252 "lines": [
253 ["riak_search_vnodeq_mean", "mean", "absolute"],
254 ["riak_search_vnodeq_median", "median", "absolute"],
@@ -244,20 +258,23 @@ CHARTS = {
258 ]
259 },
260 "search.index_errors": {
247 - "options": [None, "Number of document index errors encountered by Search", "errors", "load", "riak.search.index", "line"],
261 + "options": [None, "Number of document index errors encountered by Search", "errors", "load",
262 + "riak.search.index", "line"],
263 "lines": [
264 ["search_index_fail_count", "errors", "absolute"]
265 ]
266 },
267 "core.pbc": {
253 - "options": [None, "Protocol buffer connections by status", "connections", "load", "riak.core.protobuf_connections", "line"],
268 + "options": [None, "Protocol buffer connections by status", "connections", "load",
269 + "riak.core.protobuf_connections", "line"],
270 "lines": [
271 ["pbc_active", "active", "absolute"],
272 # ["pbc_connects", "established_pastmin", "absolute"]
273 ]
274 },
275 "core.repairs": {
260 - "options": [None, "Number of repair operations this node has coordinated", "repairs", "load", "riak.core.repairs", "line"],
276 + "options": [None, "Number of repair operations this node has coordinated", "repairs", "load",
277 + "riak.core.repairs", "line"],
278 "lines": [
279 ["read_repairs", "read", "absolute"]
280 ]
@@ -275,7 +292,8 @@ CHARTS = {
292 # Writing "Sidejob's" here seems to cause some weird issues: it results in this chart being rendered in
293 # its own context and additionally, moves the entire Riak graph all the way up to the top of the Netdata
294 # dashboard for some reason.
278 - "options": [None, "Finite state machines being rejected by Sidejobs overload protection", "fsms", "load", "riak.core.fsm_rejected", "line"],
295 + "options": [None, "Finite state machines being rejected by Sidejobs overload protection", "fsms", "load",
296 + "riak.core.fsm_rejected", "line"],
297 "lines": [
298 ["node_get_fsm_rejected", "get", "absolute"],
299 ["node_put_fsm_rejected", "put", "absolute"]
@@ -284,7 +302,8 @@ CHARTS = {
302
303 # General Riak Search Load / Health metrics
304 "search.errors": {
287 - "options": [None, "Number of writes to Search failed due to bad data format by reason", "writes", "load", "riak.search.index", "line"],
305 + "options": [None, "Number of writes to Search failed due to bad data format by reason", "writes", "load",
306 + "riak.search.index", "line"],
307 "lines": [
308 ["search_index_bad_entry_count", "bad_entry", "absolute"],
309 ["search_index_extract_fail_count", "extract_fail", "absolute"],
collectors/python.d.plugin/samba/samba.chart.py
+1 -1
@@ -18,8 +18,8 @@
18
19 import re
20
21 -from bases.collection import find_binary
21 from bases.FrameworkServices.ExecutableService import ExecutableService
22 +from bases.collection import find_binary
23
24 disabled_by_default = True
25
collectors/python.d.plugin/sensors/sensors.chart.py
+1 -3
@@ -3,10 +3,8 @@
3 # Author: Pawel Krupa (paulfantom)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 -from third_party import lm_sensors as sensors
7 -
6 from bases.FrameworkServices.SimpleService import SimpleService
9 -
7 +from third_party import lm_sensors as sensors
8
9 ORDER = [
10 'temperature',
collectors/python.d.plugin/smartd_log/smartd_log.chart.py
+8 -9
@@ -5,13 +5,11 @@
5
6 import os
7 import re
8 -
8 from copy import deepcopy
9 from time import time
10
12 -from bases.collection import read_last_line
11 from bases.FrameworkServices.SimpleService import SimpleService
14 -
12 +from bases.collection import read_last_line
13
14 INCREMENTAL = 'incremental'
15 ABSOLUTE = 'absolute'
@@ -59,7 +57,6 @@ ATTR_VERIFY_ERR_COR = 'verify-total-err-corrected'
57 ATTR_VERIFY_ERR_UNC = 'verify-total-unc-errors'
58 ATTR_TEMPERATURE = 'temperature'
59
62 -
60 RE_ATA = re.compile(
61 '(\d+);' # attribute
62 '(\d+);' # normalized value
@@ -533,7 +530,9 @@ def handle_error(*errors):
530 return method(*args)
531 except errors:
532 return None
533 +
534 return on_call
535 +
536 return on_method
537
538
@@ -653,10 +652,10 @@ class Service(SimpleService):
652 current_time = time()
653 for disk in self.disks[:]:
654 if any(
656 - [
657 - not disk.alive,
658 - not disk.log_file.is_active(current_time, self.age),
659 - ]
655 + [
656 + not disk.alive,
657 + not disk.log_file.is_active(current_time, self.age),
658 + ]
659 ):
660 self.disks.remove(disk.raw_name)
661 self.remove_disk_from_charts(disk)
@@ -673,7 +672,7 @@ class Service(SimpleService):
672
673 return len(self.disks)
674
676 - def create_disk_from_file(self, full_name, current_time):
675 + def create_disk_from_file(self, full_name, current_time):
676 if not full_name.endswith(CSV):
677 self.debug('skipping {0}: not a csv file'.format(full_name))
678 return None
collectors/python.d.plugin/spigotmc/spigotmc.chart.py
+8 -9
@@ -3,12 +3,11 @@
3 # Author: Austin S. Hemmelgarn (Ferroin)
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 -import socket
6 import platform
7 import re
8 +import socket
9
10 from bases.FrameworkServices.SimpleService import SimpleService
11 -
11 from third_party import mcrcon
12
13 # Update only every 5 seconds because collection takes in excess of
@@ -43,9 +42,8 @@ CHARTS = {
42 }
43 }
44
46 -
45 _TPS_REGEX = re.compile(
48 - r'^.*: .*?' # Message lead-in
46 + r'^.*: .*?' # Message lead-in
47 r'(\d{1,2}.\d+), .*?' # 1-minute TPS value
48 r'(\d{1,2}.\d+), .*?' # 5-minute TPS value
49 r'(\d{1,2}\.\d+).*$', # 15-minute TPS value
@@ -107,10 +105,10 @@ class Service(SimpleService):
105
106 def is_alive(self):
107 if any(
110 - [
111 - not self.alive,
112 - self.console.socket.getsockopt(socket.IPPROTO_TCP, socket.TCP_INFO, 0) != 1
113 - ]
108 + [
109 + not self.alive,
110 + self.console.socket.getsockopt(socket.IPPROTO_TCP, socket.TCP_INFO, 0) != 1
111 + ]
112 ):
113 return self.reconnect()
114 return True
@@ -131,7 +129,8 @@ class Service(SimpleService):
129 else:
130 self.error('Unable to process TPS values.')
131 if not raw:
134 - self.error("'{0}' command returned no value, make sure you set correct password".format(COMMAND_TPS))
132 + self.error(
133 + "'{0}' command returned no value, make sure you set correct password".format(COMMAND_TPS))
134 except mcrcon.MCRconException:
135 self.error('Unable to fetch TPS values.')
136 except socket.error:
collectors/python.d.plugin/springboot/springboot.chart.py
+2 -2
@@ -4,8 +4,8 @@
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 import json
7 -from bases.FrameworkServices.UrlService import UrlService
7
8 +from bases.FrameworkServices.UrlService import UrlService
9
10 DEFAULT_ORDER = [
11 'response_code',
@@ -146,7 +146,7 @@ class Service(UrlService):
146 }
147
148 for line in lines:
149 - dimension = line.get('dimension', None) or self.die('dimension is missing: %s' % chart_id)
149 + dimension = line.get('dimension', None) or self.die('dimension is missing: %s' % chart_id)
150 name = line.get('name', dimension)
151 algorithm = line.get('algorithm', 'absolute')
152 multiplier = line.get('multiplier', 1)
collectors/python.d.plugin/squid/squid.chart.py
-1
@@ -5,7 +5,6 @@
5
6 from bases.FrameworkServices.SocketService import SocketService
7
8 -
8 ORDER = [
9 'clients_net',
10 'clients_requests',
collectors/python.d.plugin/tomcat/tomcat.chart.py
+1 -1
@@ -4,8 +4,8 @@
4 # Author: Wei He (Wing924)
5 # SPDX-License-Identifier: GPL-3.0-or-later
6
7 -import xml.etree.ElementTree as ET
7 import re
8 +import xml.etree.ElementTree as ET
9
10 from bases.FrameworkServices.UrlService import UrlService
11
collectors/python.d.plugin/tor/tor.chart.py
+2 -1
@@ -11,11 +11,11 @@ try:
11 import stem
12 import stem.connection
13 import stem.control
14 +
15 STEM_AVAILABLE = True
16 except ImportError:
17 STEM_AVAILABLE = False
18
18 -
19 DEF_PORT = 'default'
20
21 ORDER = [
@@ -35,6 +35,7 @@ CHARTS = {
35
36 class Service(SimpleService):
37 """Provide netdata service for Tor"""
38 +
39 def __init__(self, configuration=None, name=None):
40 super(Service, self).__init__(configuration=configuration, name=name)
41 self.order = ORDER
collectors/python.d.plugin/traefik/traefik.chart.py
-2
@@ -4,12 +4,10 @@
4 # SPDX-License-Identifier: GPL-3.0-or-later
5
6 from collections import defaultdict
7 -
7 from json import loads
8
9 from bases.FrameworkServices.UrlService import UrlService
10
12 -
11 ORDER = [
12 'response_statuses',
13 'response_codes',
collectors/python.d.plugin/unbound/unbound.chart.py
-1
@@ -5,7 +5,6 @@
5
6 import os
7 import sys
8 -
8 from copy import deepcopy
9
10 from bases.FrameworkServices.SocketService import SocketService
collectors/python.d.plugin/uwsgi/uwsgi.chart.py
+1 -1
@@ -5,8 +5,8 @@
5
6 import json
7 from copy import deepcopy
8 -from bases.FrameworkServices.SocketService import SocketService
8
9 +from bases.FrameworkServices.SocketService import SocketService
10
11 ORDER = [
12 'requests',
collectors/python.d.plugin/varnish/varnish.chart.py
+7 -7
@@ -281,15 +281,15 @@ class Service(ExecutableService):
281
282 chart = {
283 chart_name:
284 - {
285 - 'options': [None, title, 'kilobits/s', 'backend response statistics',
286 - 'varnish.backend', 'area'],
287 - 'lines': [
288 - [hdr_bytes, 'header', 'incremental', 8, 1000],
289 - [body_bytes, 'body', 'incremental', -8, 1000]
284 + {
285 + 'options': [None, title, 'kilobits/s', 'backend response statistics',
286 + 'varnish.backend', 'area'],
287 + 'lines': [
288 + [hdr_bytes, 'header', 'incremental', 8, 1000],
289 + [body_bytes, 'body', 'incremental', -8, 1000]
290 ]
291 }
292 - }
292 + }
293
294 self.order.insert(0, chart_name)
295 self.definitions.update(chart)
collectors/python.d.plugin/w1sensor/w1sensor.chart.py
+2
@@ -5,6 +5,7 @@
5
6 import os
7 import re
8 +
9 from bases.FrameworkServices.SimpleService import SimpleService
10
11 # default module values (can be overridden per job in `config`)
@@ -40,6 +41,7 @@ THERM_FAMILY = {
41
42 class Service(SimpleService):
43 """Provide netdata service for 1-Wire sensors"""
44 +
45 def __init__(self, configuration=None, name=None):
46 SimpleService.__init__(self, configuration=configuration, name=name)
47 self.order = ORDER
collectors/python.d.plugin/web_log/web_log.chart.py
+6 -7
@@ -23,7 +23,6 @@ except ImportError:
23 from bases.collection import read_last_line
24 from bases.FrameworkServices.LogService import LogService
25
26 -
26 ORDER_APACHE_CACHE = [
27 'apache_cache',
28 ]
@@ -821,8 +820,8 @@ class Web:
820 dim_id = match_dict['vhost'].replace('.', '_')
821 if dim_id not in self.data:
822 self.charts['vhost'].add_dimension([dim_id,
824 - match_dict['vhost'],
825 - 'incremental'])
823 + match_dict['vhost'],
824 + 'incremental'])
825 self.data[dim_id] = 0
826 self.data[dim_id] += 1
827
@@ -961,9 +960,9 @@ class Squid:
960 return False
961 self.storage['dynamic'] = {
962 'http_code': {
964 - 'chart': 'squid_detailed_response_codes',
965 - 'func_dim_id': None,
966 - 'func_dim': None
963 + 'chart': 'squid_detailed_response_codes',
964 + 'func_dim_id': None,
965 + 'func_dim': None
966 },
967 'hier_code': {
968 'chart': 'squid_hier_code',
@@ -1105,7 +1104,7 @@ def get_hist(index, buckets, time):
1104 :param time: time
1105 :return: None
1106 """
1108 - for i in range(len(index)-1, -1, -1):
1107 + for i in range(len(index) - 1, -1, -1):
1108 if time <= index[i]:
1109 buckets[i] += 1
1110 else: