diff options
Diffstat (limited to 'collectors')
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/collectors/python.d.plugin/example/example.chart.py +++ b/collectors/python.d.plugin/example/example.chart.py @@ -7,7 +7,6 @@ from random import SystemRandom from bases.FrameworkServices.SimpleService import SimpleService - priority = 90000 ORDER = [ diff --git a/collectors/python.d.plugin/exim/exim.chart.py b/collectors/python.d.plugin/exim/exim.chart.py index 68b7b5cfbe..7238a1beaa 100644 --- a/collectors/python.d.plugin/exim/exim.chart.py +++ b/collectors/python.d.plugin/exim/exim.chart.py @@ -5,7 +5,6 @@ from bases.FrameworkServices.ExecutableService import ExecutableService - EXIM_COMMAND = 'exim -bpc' ORDER = [ diff --git a/collectors/python.d.plugin/fail2ban/fail2ban.chart.py b/collectors/python.d.plugin/fail2ban/fail2ban.chart.py index 9f5f2dcc49..d9a77dd0d6 100644 --- a/collectors/python.d.plugin/fail2ban/fail2ban.chart.py +++ b/collectors/python.d.plugin/fail2ban/fail2ban.chart.py @@ -3,15 +3,13 @@ # Author: ilyam8 # SPDX-License-Identifier: GPL-3.0-or-later -import re import os - +import re from collections import defaultdict from glob import glob from bases.FrameworkServices.LogService import LogService - ORDER = [ 'jails_bans', 'jails_in_jail', @@ -25,13 +23,13 @@ def charts(jails): ch = { ORDER[0]: { - 'options': [None, 'Jails Ban Rate', 'bans/s', 'bans', 'jail.bans', 'line'], - 'lines': [] + 'options': [None, 'Jails Ban Rate', 'bans/s', 'bans', 'jail.bans', 'line'], + 'lines': [] }, ORDER[1]: { - 'options': [None, 'Banned IPs (since the last restart of netdata)', 'IPs', 'in jail', - |