Skip to content

Commit

Permalink
collectors/python.d: format modules code (netdata#7832)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
ilyam8 authored Jan 24, 2020
1 parent 6a3ad76 commit f1d1331
Show file tree
Hide file tree
Showing 61 changed files with 162 additions and 187 deletions.
2 changes: 0 additions & 2 deletions collectors/python.d.plugin/adaptec_raid/adaptec_raid.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
9 changes: 4 additions & 5 deletions collectors/python.d.plugin/am2320/am2320.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,13 @@
import board
import busio
import adafruit_am2320

HAS_AM2320 = True
except ImportError:
HAS_AM2320 = False


from bases.FrameworkServices.SimpleService import SimpleService


ORDER = [
'temperature',
'humidity',
Expand Down Expand Up @@ -60,9 +59,9 @@ def check(self):
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)
Expand Down
1 change: 0 additions & 1 deletion collectors/python.d.plugin/apache/apache.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from bases.FrameworkServices.UrlService import UrlService


ORDER = [
'requests',
'connections',
Expand Down
4 changes: 2 additions & 2 deletions collectors/python.d.plugin/beanstalk/beanstalk.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@

try:
import beanstalkc

BEANSTALKC = True
except ImportError:
BEANSTALKC = False

from bases.FrameworkServices.SimpleService import SimpleService
from bases.loaders import load_yaml


ORDER = [
'cpu_usage',
'jobs_rate',
Expand Down Expand Up @@ -109,7 +109,7 @@
'options': [None, 'Uptime', 'seconds', 'server statistics', 'beanstalk.uptime', 'line'],
'lines': [
['uptime'],
]
]
}
}

Expand Down
4 changes: 1 addition & 3 deletions collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 0 additions & 2 deletions collectors/python.d.plugin/boinc/boinc.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,8 @@
import socket

from bases.FrameworkServices.SimpleService import SimpleService

from third_party import boinc_client


ORDER = [
'tasks',
'states',
Expand Down
17 changes: 9 additions & 8 deletions collectors/python.d.plugin/ceph/ceph.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

try:
import rados

CEPH = True
except ImportError:
CEPH = False
Expand Down Expand Up @@ -161,28 +162,28 @@ def create_definitions(self):
: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'])
self.definitions['pool_objects']['lines'].append(["obj_{0}".format(pool['name']),
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'])
Expand Down
24 changes: 11 additions & 13 deletions collectors/python.d.plugin/couchdb/couchdb.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -16,10 +16,8 @@

from bases.FrameworkServices.UrlService import UrlService


update_every = 1


METHODS = namedtuple('METHODS', ['get_data', 'url', 'stats'])

OVERVIEW_STATS = [
Expand Down Expand Up @@ -127,7 +125,7 @@
['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']
]
Expand All @@ -141,13 +139,13 @@
['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': {
Expand Down Expand Up @@ -280,19 +278,19 @@ def check(self):
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)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import dns.message
import dns.query
import dns.name

DNS_PYTHON = True
except ImportError:
DNS_PYTHON = False
Expand All @@ -22,7 +23,6 @@

from bases.FrameworkServices.SimpleService import SimpleService


update_every = 5


Expand Down
2 changes: 0 additions & 2 deletions collectors/python.d.plugin/dnsdist/dnsdist.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from bases.FrameworkServices.UrlService import UrlService


ORDER = [
'queries',
'queries_dropped',
Expand All @@ -21,7 +20,6 @@
'query_latency_avg'
]


CHARTS = {
'queries': {
'options': [None, 'Client queries received', 'queries/s', 'queries', 'dnsdist.queries', 'line'],
Expand Down
5 changes: 2 additions & 3 deletions collectors/python.d.plugin/dockerd/dockerd.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = [
Expand Down Expand Up @@ -44,7 +44,6 @@
}
}


MIN_REQUIRED_VERSION = '3.2.0'


Expand Down
5 changes: 2 additions & 3 deletions collectors/python.d.plugin/dovecot/dovecot.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,8 @@

from bases.FrameworkServices.SocketService import SocketService


UNIX_SOCKET = '/var/run/dovecot/stats'


ORDER = [
'sessions',
'logins',
Expand Down Expand Up @@ -51,7 +49,8 @@
]
},
'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']
Expand Down
19 changes: 10 additions & 9 deletions collectors/python.d.plugin/energid/energid.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,9 @@
'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': {
Expand Down Expand Up @@ -93,22 +93,23 @@
'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)
Expand Down
1 change: 0 additions & 1 deletion collectors/python.d.plugin/example/example.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from bases.FrameworkServices.SimpleService import SimpleService


priority = 90000

ORDER = [
Expand Down
1 change: 0 additions & 1 deletion collectors/python.d.plugin/exim/exim.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

from bases.FrameworkServices.ExecutableService import ExecutableService


EXIM_COMMAND = 'exim -bpc'

ORDER = [
Expand Down
14 changes: 6 additions & 8 deletions collectors/python.d.plugin/fail2ban/fail2ban.chart.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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',
'jail.in_jail', 'line'],
'lines': []
'options': [None, 'Banned IPs (since the last restart of netdata)', 'IPs', 'in jail',
'jail.in_jail', 'line'],
'lines': []
},
}
for jail in jails:
Expand Down
Loading

0 comments on commit f1d1331

Please sign in to comment.