summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Mashchenko <ilya@netdata.cloud>2020-01-24 12:08:56 +0300
committerGitHub <noreply@github.com>2020-01-24 12:08:56 +0300
commitf1d133190bda44504a7f55834ec626ab4e3d32ee (patch)
tree0c2014011545a61b37066c8dafd1ad43d4e7cc32
parent6a3ad766bd48b7ee89fb14772a56b41d518cbd63 (diff)
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
-rw-r--r--collectors/python.d.plugin/adaptec_raid/adaptec_raid.chart.py2
-rw-r--r--collectors/python.d.plugin/am2320/am2320.chart.py9
-rw-r--r--collectors/python.d.plugin/apache/apache.chart.py1
-rw-r--r--collectors/python.d.plugin/beanstalk/beanstalk.chart.py4
-rw-r--r--collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py4
-rw-r--r--collectors/python.d.plugin/boinc/boinc.chart.py2
-rw-r--r--collectors/python.d.plugin/ceph/ceph.chart.py17
-rw-r--r--collectors/python.d.plugin/couchdb/couchdb.chart.py24
-rw-r--r--collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py2
-rw-r--r--collectors/python.d.plugin/dnsdist/dnsdist.chart.py2
-rw-r--r--collectors/python.d.plugin/dockerd/dockerd.chart.py5
-rw-r--r--collectors/python.d.plugin/dovecot/dovecot.chart.py5
-rw-r--r--collectors/python.d.plugin/energid/energid.chart.py19
-rw-r--r--collectors/python.d.plugin/example/example.chart.py1
-rw-r--r--collectors/python.d.plugin/exim/exim.chart.py1
-rw-r--r--collectors/python.d.plugin/fail2ban/fail2ban.chart.py14
-rw-r--r--collectors/python.d.plugin/freeradius/freeradius.chart.py2
-rw-r--r--collectors/python.d.plugin/gearman/gearman.chart.py4
-rw-r--r--collectors/python.d.plugin/go_expvar/go_expvar.chart.py3
-rw-r--r--collectors/python.d.plugin/haproxy/haproxy.chart.py7
-rw-r--r--collectors/python.d.plugin/hddtemp/hddtemp.chart.py2
-rw-r--r--collectors/python.d.plugin/hpssa/hpssa.chart.py2
-rw-r--r--collectors/python.d.plugin/httpcheck/httpcheck.chart.py3
-rw-r--r--collectors/python.d.plugin/icecast/icecast.chart.py1
-rw-r--r--collectors/python.d.plugin/ipfs/ipfs.chart.py11
-rw-r--r--collectors/python.d.plugin/isc_dhcpd/isc_dhcpd.chart.py3
-rw-r--r--collectors/python.d.plugin/litespeed/litespeed.chart.py20
-rw-r--r--collectors/python.d.plugin/megacli/megacli.chart.py5
-rw-r--r--collectors/python.d.plugin/memcached/memcached.chart.py1
-rw-r--r--collectors/python.d.plugin/mongodb/mongodb.chart.py2
-rw-r--r--collectors/python.d.plugin/mysql/mysql.chart.py1
-rw-r--r--collectors/python.d.plugin/nginx/nginx.chart.py1
-rw-r--r--collectors/python.d.plugin/nginx_plus/nginx_plus.chart.py1
-rw-r--r--collectors/python.d.plugin/nsd/nsd.chart.py1
-rw-r--r--collectors/python.d.plugin/ntpd/ntpd.chart.py3
-rw-r--r--collectors/python.d.plugin/openldap/openldap.chart.py6
-rw-r--r--collectors/python.d.plugin/oracledb/oracledb.chart.py3
-rw-r--r--collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.chart.py1
-rw-r--r--collectors/python.d.plugin/phpfpm/phpfpm.chart.py1
-rw-r--r--collectors/python.d.plugin/portcheck/portcheck.chart.py1
-rw-r--r--collectors/python.d.plugin/powerdns/powerdns.chart.py1
-rw-r--r--collectors/python.d.plugin/proxysql/proxysql.chart.py3
-rw-r--r--collectors/python.d.plugin/puppet/puppet.chart.py6
-rw-r--r--collectors/python.d.plugin/redis/redis.chart.py1
-rw-r--r--collectors/python.d.plugin/rethinkdbs/rethinkdbs.chart.py1
-rw-r--r--collectors/python.d.plugin/retroshare/retroshare.chart.py1
-rw-r--r--collectors/python.d.plugin/riakkv/riakkv.chart.py55
-rw-r--r--collectors/python.d.plugin/samba/samba.chart.py2
-rw-r--r--collectors/python.d.plugin/sensors/sensors.chart.py4
-rw-r--r--collectors/python.d.plugin/smartd_log/smartd_log.chart.py17
-rw-r--r--collectors/python.d.plugin/spigotmc/spigotmc.chart.py17
-rw-r--r--collectors/python.d.plugin/springboot/springboot.chart.py4
-rw-r--r--collectors/python.d.plugin/squid/squid.chart.py1
-rw-r--r--collectors/python.d.plugin/tomcat/tomcat.chart.py2
-rw-r--r--collectors/python.d.plugin/tor/tor.chart.py3
-rw-r--r--collectors/python.d.plugin/traefik/traefik.chart.py2
-rw-r--r--collectors/python.d.plugin/unbound/unbound.chart.py1
-rw-r--r--collectors/python.d.plugin/uwsgi/uwsgi.chart.py2
-rw-r--r--collectors/python.d.plugin/varnish/varnish.chart.py14
-rw-r--r--collectors/python.d.plugin/w1sensor/w1sensor.chart.py2
-rw-r--r--collectors/python.d.plugin/web_log/web_log.chart.py13
61 files changed, 162 insertions, 187 deletions
diff --git a/collectors/python.d.plugin/adaptec_raid/adaptec_raid.chart.py b/collectors/python.d.plugin/adaptec_raid/adaptec_raid.chart.py
index 3fcb5fda8d..564c2ce87e 100644
--- a/collectors/python.d.plugin/adaptec_raid/adaptec_raid.chart.py
+++ b/collectors/python.d.plugin/adaptec_raid/adaptec_raid.chart.py
@@ -5,13 +5,11 @@
import re
-
from copy import deepcopy
from bases.FrameworkServices.ExecutableService import ExecutableService
from bases.collection import find_binary
-
disabled_by_default = True
update_every = 5
diff --git a/collectors/python.d.plugin/am2320/am2320.chart.py b/collectors/python.d.plugin/am2320/am2320.chart.py
index c15e16eee2..8e66544bd5 100644
--- a/collectors/python.d.plugin/am2320/am2320.chart.py
+++ b/collectors/python.d.plugin/am2320/am2320.chart.py
@@ -7,14 +7,13 @@ try:
import board
import busio
import adafruit_am2320
+
HAS_AM2320 = True
except ImportError:
HAS_AM2320 = False
-
from bases.FrameworkServices.SimpleService import SimpleService
-
ORDER = [
'temperature',
'humidity',
@@ -60,9 +59,9 @@ class Service(SimpleService):
def get_data(self):
try:
return {
- 'temperature': self.am.temperature,
- 'humidity': self.am.relative_humidity,
- }
+ 'temperature': self.am.temperature,
+ 'humidity': self.am.relative_humidity,
+ }
except (OSError, RuntimeError) as error:
self.error(error)
diff --git a/collectors/python.d.plugin/apache/apache.chart.py b/collectors/python.d.plugin/apache/apache.chart.py
index 655616d072..14acb1602d 100644
--- a/collectors/python.d.plugin/apache/apache.chart.py
+++ b/collectors/python.d.plugin/apache/apache.chart.py
@@ -5,7 +5,6 @@
from bases.FrameworkServices.UrlService import UrlService
-
ORDER = [
'requests',
'connections',
diff --git a/collectors/python.d.plugin/beanstalk/beanstalk.chart.py b/collectors/python.d.plugin/beanstalk/beanstalk.chart.py
index 9c83198728..396543e5ae 100644
--- a/collectors/python.d.plugin/beanstalk/beanstalk.chart.py
+++ b/collectors/python.d.plugin/beanstalk/beanstalk.chart.py
@@ -5,6 +5,7 @@
try:
import beanstalkc
+
BEANSTALKC = True
except ImportError:
BEANSTALKC = False
@@ -12,7 +13,6 @@ except ImportError:
from bases.FrameworkServices.SimpleService import SimpleService
from bases.loaders import load_yaml
-
ORDER = [
'cpu_usage',
'jobs_rate',
@@ -109,7 +109,7 @@ CHARTS = {
'options': [None, 'Uptime', 'seconds', 'server statistics', 'beanstalk.uptime', 'line'],
'lines': [
['uptime'],
- ]
+ ]
}
}
diff --git a/collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py b/collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py
index 60f40c2f7a..9d6c9fec7d 100644
--- a/collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py
+++ b/collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py
@@ -4,13 +4,11 @@
# SPDX-License-Identifier: GPL-3.0-or-later
import os
-
from collections import defaultdict
from subprocess import Popen
-from bases.collection import find_binary
from bases.FrameworkServices.SimpleService import SimpleService
-
+from bases.collection import find_binary
update_every = 30
diff --git a/collectors/python.d.plugin/boinc/boinc.chart.py b/collectors/python.d.plugin/boinc/boinc.chart.py
index e10b28ceaf..a31eda1c2b 100644
--- a/collectors/python.d.plugin/boinc/boinc.chart.py
+++ b/collectors/python.d.plugin/boinc/boinc.chart.py
@@ -6,10 +6,8 @@
import socket
from bases.FrameworkServices.SimpleService import SimpleService
-
from third_party import boinc_client
-
ORDER = [
'tasks',
'states',
diff --git a/collectors/python.d.plugin/ceph/ceph.chart.py b/collectors/python.d.plugin/ceph/ceph.chart.py
index fe9b2b9ab2..a85576eebf 100644
--- a/collectors/python.d.plugin/ceph/ceph.chart.py
+++ b/collectors/python.d.plugin/ceph/ceph.chart.py
@@ -5,6 +5,7 @@
try:
import rados
+
CEPH = True
except ImportError:
CEPH = False
@@ -161,7 +162,7 @@ class Service(SimpleService):
:return: None
"""
# Pool lines
- for pool in sorted(self._get_df()['pools'], key=lambda x:sorted(x.keys())):
+ for pool in sorted(self._get_df()['pools'], key=lambda x: sorted(x.keys())):
self.definitions['pool_usage']['lines'].append([pool['name'],
pool['name'],
'absolute'])
@@ -169,20 +170,20 @@ class Service(SimpleService):
pool['name'],
'absolute'])
self.definitions['pool_read_bytes']['lines'].append(['read_{0}'.format(pool['name']),
- pool['name'],
- 'absolute', 1, 1024])
- self.definitions['pool_write_bytes']['lines'].append(['write_{0}'.format(pool['name']),
pool['name'],
'absolute', 1, 1024])
+ self.definitions['pool_write_bytes']['lines'].append(['write_{0}'.format(pool['name']),
+ pool['name'],
+ 'absolute', 1, 1024])
self.definitions['pool_read_operations']['lines'].append(['read_operations_{0}'.format(pool['name']),
- pool['name'],
- 'absolute'])
- self.definitions['pool_write_operations']['lines'].append(['write_operations_{0}'.format(pool['name']),
pool['name'],
'absolute'])
+ self.definitions['pool_write_operations']['lines'].append(['write_operations_{0}'.format(pool['name']),
+ pool['name'],
+ 'absolute'])
# OSD lines
- for osd in sorted(self._get_osd_df()['nodes'], key=lambda x:sorted(x.keys())):
+ for osd in sorted(self._get_osd_df()['nodes'], key=lambda x: sorted(x.keys())):
self.definitions['osd_usage']['lines'].append([osd['name'],
osd['name'],
'absolute'])
diff --git a/collectors/python.d.plugin/couchdb/couchdb.chart.py b/collectors/python.d.plugin/couchdb/couchdb.chart.py
index 50fe6669f5..a395f356cf 100644
--- a/collectors/python.d.plugin/couchdb/couchdb.chart.py
+++ b/collectors/python.d.plugin/couchdb/couchdb.chart.py
@@ -6,8 +6,8 @@
from collections import namedtuple, defaultdict
from json import loads
-from threading import Thread
from socket import gethostbyname, gaierror
+from threading import Thread
try:
from queue import Queue
@@ -16,10 +16,8 @@ except ImportError:
from bases.FrameworkServices.UrlService import UrlService
-
update_every = 1
-
METHODS = namedtuple('METHODS', ['get_data', 'url', 'stats'])
OVERVIEW_STATS = [
@@ -127,7 +125,7 @@ CHARTS = {
['couchdb_httpd_request_methods_GET', 'GET', 'incremental'],
['couchdb_httpd_request_methods_HEAD', 'HEAD', 'incremental'],
['couchdb_httpd_request_methods_OPTIONS', 'OPTIONS',
- 'incremental'],
+ 'incremental'],
['couchdb_httpd_request_methods_POST', 'POST', 'incremental'],
['couchdb_httpd_request_methods_PUT', 'PUT', 'incremental']
]
@@ -141,13 +139,13 @@ CHARTS = {
['couchdb_httpd_status_codes_201', '201 Created', 'incremental'],
['couchdb_httpd_status_codes_202', '202 Accepted', 'incremental'],
['couchdb_httpd_status_codes_2xx', 'Other 2xx Success',
- 'incremental'],
+ 'incremental'],
['couchdb_httpd_status_codes_3xx', '3xx Redirection',
- 'incremental'],
+ 'incremental'],
['couchdb_httpd_status_codes_4xx', '4xx Client error',
- 'incremental'],
+ 'incremental'],
['couchdb_httpd_status_codes_5xx', '5xx Server error',
- 'incremental']
+ 'incremental']
]
},
'open_files': {
@@ -280,19 +278,19 @@ class Service(UrlService):
if self._get_raw_data(self.url + '/' + db)]
for db in self.dbs:
self.definitions['db_sizes_file']['lines'].append(
- ['db_'+db+'_sizes_file', db, 'absolute', 1, 1000]
+ ['db_' + db + '_sizes_file', db, 'absolute', 1, 1000]
)
self.definitions['db_sizes_external']['lines'].append(
- ['db_'+db+'_sizes_external', db, 'absolute', 1, 1000]
+ ['db_' + db + '_sizes_external', db, 'absolute', 1, 1000]
)
self.definitions['db_sizes_active']['lines'].append(
- ['db_'+db+'_sizes_active', db, 'absolute', 1, 1000]
+ ['db_' + db + '_sizes_active', db, 'absolute', 1, 1000]
)
self.definitions['db_doc_counts']['lines'].append(
- ['db_'+db+'_doc_count', db, 'absolute']
+ ['db_' + db + '_doc_count', db, 'absolute']
)
self.definitions['db_doc_del_counts']['lines'].append(
- ['db_'+db+'_doc_del_count', db, 'absolute']
+ ['db_' + db + '_doc_del_count', db, 'absolute']
)
return UrlService.check(self)
diff --git a/collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py b/collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py
index 7fe8603147..7e1cb32b3c 100644
--- a/collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py
+++ b/collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py
@@ -11,6 +11,7 @@ try:
import dns.message
import dns.query
import dns.name
+
DNS_PYTHON = True
except ImportError:
DNS_PYTHON = False
@@ -22,7 +23,6 @@ except ImportError:
from bases.FrameworkServices.SimpleService import SimpleService
-
update_every = 5
diff --git a/collectors/python.d.plugin/dnsdist/dnsdist.chart.py b/collectors/python.d.plugin/dnsdist/dnsdist.chart.py
index d60858659d..a94928b22c 100644
--- a/collectors/python.d.plugin/dnsdist/dnsdist.chart.py
+++ b/collectors/python.d.plugin/dnsdist/dnsdist.chart.py
@@ -5,7 +5,6 @@ from json import loads
from bases.FrameworkServices.UrlService import UrlService
-
ORDER = [
'queries',
'queries_dropped',
@@ -21,7 +20,6 @@ ORDER = [
'query_latency_avg'
]
-
CHARTS = {
'queries': {
'options': [None, 'Client queries received', 'queries/s', 'queries', 'dnsdist.queries', 'line'],
diff --git a/collectors/python.d.plugin/dockerd/dockerd.chart.py b/collectors/python.d.plugin/dockerd/dockerd.chart.py
index 8bd45df9e4..bd9640bbf6 100644
--- a/collectors/python.d.plugin/dockerd/dockerd.chart.py
+++ b/collectors/python.d.plugin/dockerd/dockerd.chart.py
@@ -4,14 +4,14 @@
try:
import docker
+
HAS_DOCKER = True
except ImportError:
HAS_DOCKER = False
-from bases.FrameworkServices.SimpleService import SimpleService
-
from distutils.version import StrictVersion
+from bases.FrameworkServices.SimpleService import SimpleService
# charts order (can be overridden if you want less charts, or different order)
ORDER = [
@@ -44,7 +44,6 @@ CHARTS = {
}
}
-
MIN_REQUIRED_VERSION = '3.2.0'
diff --git a/collectors/python.d.plugin/dovecot/dovecot.chart.py b/collectors/python.d.plugin/dovecot/dovecot.chart.py
index be1fa53d5f..dfaef28b5a 100644
--- a/collectors/python.d.plugin/dovecot/dovecot.chart.py
+++ b/collectors/python.d.plugin/dovecot/dovecot.chart.py
@@ -5,10 +5,8 @@
from bases.FrameworkServices.SocketService import SocketService
-
UNIX_SOCKET = '/var/run/dovecot/stats'
-
ORDER = [
'sessions',
'logins',
@@ -51,7 +49,8 @@ CHARTS = {
]
},
'context_switches': {
- 'options': [None, 'Dovecot Context Switches', 'switches', 'context switches', 'dovecot.context_switches', 'line'],
+ 'options': [None, 'Dovecot Context Switches', 'switches', 'context switches', 'dovecot.context_switches',
+ 'line'],
'lines': [
['vol_cs', 'voluntary', 'absolute'],
['invol_cs', 'involuntary', 'absolute']
diff --git a/collectors/python.d.plugin/energid/energid.chart.py b/collectors/python.d.plugin/energid/energid.chart.py
index b8aa89e50d..079c32dc8f 100644
--- a/collectors/python.d.plugin/energid/energid.chart.py
+++ b/collectors/python.d.plugin/energid/energid.chart.py
@@ -41,9 +41,9 @@ CHARTS = {
'mempool': {
'options': [None, 'MemPool', 'MiB', 'memory', 'energid.mempool', 'area'],
'lines': [
- ['mempool_max', 'Max', 'absolute', None, 1024*1024],
- ['mempool_current', 'Usage', 'absolute', None, 1024*1024],
- ['mempool_txsize', 'TX Size', 'absolute', None, 1024*1024],
+ ['mempool_max', 'Max', 'absolute', None, 1024 * 1024],
+ ['mempool_current', 'Usage', 'absolute', None, 1024 * 1024],
+ ['mempool_txsize', 'TX Size', 'absolute', None, 1024 * 1024],
],
},
'secmem': {
@@ -93,22 +93,23 @@ METHODS = {
'mempool_max': r['maxmempool'],
},
'getmemoryinfo': lambda r: dict([
- ('secmem_' + k, v) for (k,v) in r['locked'].items()
+ ('secmem_' + k, v) for (k, v) in r['locked'].items()
]),
'getnetworkinfo': lambda r: {
- 'network_timeoffset' : r['timeoffset'],
+ 'network_timeoffset': r['timeoffset'],
'network_connections': r['connections'],
},
'gettxoutsetinfo': lambda r: {
- 'utxo_count' : r['txouts'],
- 'utxo_xfers' : r['transactions'],
- 'utxo_size' : r['disk_size'],
- 'utxo_amount' : r['total_amount'],
+ 'utxo_count': r['txouts'],
+ 'utxo_xfers': r['transactions'],
+ 'utxo_size': r['disk_size'],
+ 'utxo_amount': r['total_amount'],
},
}
JSON_RPC_VERSION = '1.1'
+
class Service(UrlService):
def __init__(self, configuration=None, name=None):
UrlService.__init__(self, configuration=configuration, name=name)
diff --git a/collectors/python.d.plugin/example/example.chart.py b/collectors/python.d.plugin/example/example.chart.py
index cc8c187592..61ae47f22d 100644
--- a/