summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorIlya Mashchenko <ilyamaschenko@gmail.com>2018-12-17 18:50:20 +0300
committerGitHub <noreply@github.com>2018-12-17 18:50:20 +0300
commit97b32703c63569812ef6652d8a8ab3a75f21990d (patch)
tree46bc67e074e839a9c1ecda640487d7102d16715d
parent7ad91b8f9a840f7d8364a78dd396524c642ec786 (diff)
[python] make units compliant with IEC standard (#4995)
* apache units fix * beanstalk * bind_rndc * boinc * ceph * chrony * couchdb * dns_query * dnsdist * dockerd * dovecot * elasticsearch by @vlvkobal <3 * example * exim * fail2ban * freeradius minor fixes * freeradius minor fixes * freeradius minor fixes * go_expvar * haproxy * hddtemp * httpcheck * icecast * ipfs * isc_dhcpd * litespeed * logind * megacli * memcached * mongodb * monit * mysql * nginx * nginx_plus * nsd * ntpd * nvidia_smi * openldap * ovpn_status * phpfm * portcheck * postfix * postgres * powerdns * proxysql * puppet * rabbitmq * redis * restroshare * samba * sensors * smartdlog * spigotmc * springboot * squid * retroshare * tomcat * retroshare * tor * traefik * traefik * unbound * uwsgi * varnish * w1sensor * web_log * ok codacy * retroshare * ipfs
-rw-r--r--collectors/python.d.plugin/apache/apache.chart.py111
-rw-r--r--collectors/python.d.plugin/beanstalk/beanstalk.chart.py16
-rw-r--r--collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py29
-rw-r--r--collectors/python.d.plugin/boinc/boinc.chart.py14
-rw-r--r--collectors/python.d.plugin/ceph/ceph.chart.py16
-rw-r--r--collectors/python.d.plugin/chrony/chrony.chart.py15
-rw-r--r--collectors/python.d.plugin/couchdb/couchdb.chart.py46
-rw-r--r--collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py21
-rw-r--r--collectors/python.d.plugin/dnsdist/dnsdist.chart.py4
-rw-r--r--collectors/python.d.plugin/dockerd/dockerd.chart.py10
-rw-r--r--collectors/python.d.plugin/dovecot/dovecot.chart.py24
-rw-r--r--collectors/python.d.plugin/elasticsearch/elasticsearch.chart.py83
-rw-r--r--collectors/python.d.plugin/example/example.chart.py8
-rw-r--r--collectors/python.d.plugin/exim/exim.chart.py12
-rw-r--r--collectors/python.d.plugin/fail2ban/fail2ban.chart.py17
-rw-r--r--collectors/python.d.plugin/freeradius/freeradius.chart.py107
-rw-r--r--collectors/python.d.plugin/go_expvar/go_expvar.chart.py27
-rw-r--r--collectors/python.d.plugin/haproxy/haproxy.chart.py32
-rw-r--r--collectors/python.d.plugin/hddtemp/hddtemp.chart.py6
-rw-r--r--collectors/python.d.plugin/httpcheck/httpcheck.chart.py12
-rw-r--r--collectors/python.d.plugin/icecast/icecast.chart.py7
-rw-r--r--collectors/python.d.plugin/ipfs/ipfs.chart.py31
-rw-r--r--collectors/python.d.plugin/isc_dhcpd/isc_dhcpd.chart.py30
-rw-r--r--collectors/python.d.plugin/litespeed/litespeed.chart.py14
-rw-r--r--collectors/python.d.plugin/logind/logind.chart.py10
-rw-r--r--collectors/python.d.plugin/megacli/megacli.chart.py4
-rw-r--r--collectors/python.d.plugin/memcached/memcached.chart.py47
-rw-r--r--collectors/python.d.plugin/mongodb/mongodb.chart.py22
-rw-r--r--collectors/python.d.plugin/monit/monit.chart.py25
-rw-r--r--collectors/python.d.plugin/mysql/mysql.chart.py23
-rw-r--r--collectors/python.d.plugin/nginx/nginx.chart.py29
-rw-r--r--collectors/python.d.plugin/nginx_plus/nginx_plus.chart.py17
-rw-r--r--collectors/python.d.plugin/nsd/nsd.chart.py29
-rw-r--r--collectors/python.d.plugin/ntpd/ntpd.chart.py27
-rw-r--r--collectors/python.d.plugin/nvidia_smi/nvidia_smi.chart.py13
-rw-r--r--collectors/python.d.plugin/openldap/openldap.chart.py6
-rw-r--r--collectors/python.d.plugin/ovpn_status_log/ovpn_status_log.chart.py23
-rw-r--r--collectors/python.d.plugin/phpfpm/phpfpm.chart.py40
-rw-r--r--collectors/python.d.plugin/portcheck/portcheck.chart.py4
-rw-r--r--collectors/python.d.plugin/postfix/postfix.chart.py14
-rw-r--r--collectors/python.d.plugin/postgres/postgres.chart.py25
-rw-r--r--collectors/python.d.plugin/powerdns/powerdns.chart.py9
-rw-r--r--collectors/python.d.plugin/proxysql/proxysql.chart.py12
-rw-r--r--collectors/python.d.plugin/puppet/puppet.chart.py25
-rw-r--r--collectors/python.d.plugin/rabbitmq/rabbitmq.chart.py11
-rw-r--r--collectors/python.d.plugin/redis/redis.chart.py13
-rw-r--r--collectors/python.d.plugin/rethinkdbs/rethinkdbs.chart.py2
-rw-r--r--collectors/python.d.plugin/retroshare/retroshare.chart.py20
-rw-r--r--collectors/python.d.plugin/samba/samba.chart.py6
-rw-r--r--collectors/python.d.plugin/sensors/sensors.chart.py2
-rw-r--r--collectors/python.d.plugin/smartd_log/smartd_log.chart.py6
-rw-r--r--collectors/python.d.plugin/spigotmc/spigotmc.chart.py5
-rw-r--r--collectors/python.d.plugin/springboot/springboot.chart.py14
-rw-r--r--collectors/python.d.plugin/squid/squid.chart.py12
-rw-r--r--collectors/python.d.plugin/tomcat/tomcat.chart.py62
-rw-r--r--collectors/python.d.plugin/tor/tor.chart.py4
-rw-r--r--collectors/python.d.plugin/traefik/traefik.chart.py28
-rw-r--r--collectors/python.d.plugin/unbound/unbound.chart.py6
-rw-r--r--collectors/python.d.plugin/uwsgi/uwsgi.chart.py21
-rw-r--r--collectors/python.d.plugin/varnish/varnish.chart.py9
-rw-r--r--collectors/python.d.plugin/w1sensor/w1sensor.chart.py4
-rw-r--r--collectors/python.d.plugin/web_log/web_log.chart.py6
62 files changed, 747 insertions, 580 deletions
diff --git a/collectors/python.d.plugin/apache/apache.chart.py b/collectors/python.d.plugin/apache/apache.chart.py
index a9ac72581f..655616d072 100644
--- a/collectors/python.d.plugin/apache/apache.chart.py
+++ b/collectors/python.d.plugin/apache/apache.chart.py
@@ -5,63 +5,60 @@
from bases.FrameworkServices.UrlService import UrlService
-# default module values (can be overridden per job in `config`)
-# update_every = 2
-priority = 60000
-# default job configuration (overridden by python.d.plugin)
-# config = {'local': {
-# 'update_every': update_every,
-# 'retries': retries,
-# 'priority': priority,
-# 'url': 'http://www.apache.org/server-status?auto'
-# }}
-
-# charts order (can be overridden if you want less charts, or different order)
-ORDER = ['requests', 'connections', 'conns_async', 'net', 'workers', 'reqpersec', 'bytespersec', 'bytesperreq']
+ORDER = [
+ 'requests',
+ 'connections',
+ 'conns_async',
+ 'net',
+ 'workers',
+ 'reqpersec',
+ 'bytespersec',
+ 'bytesperreq',
+]
CHARTS = {
'bytesperreq': {
- 'options': [None, 'apache Lifetime Avg. Response Size', 'bytes/request',
+ 'options': [None, 'Lifetime Avg. Request Size', 'KiB',
'statistics', 'apache.bytesperreq', 'area'],
'lines': [
- ['size_req']
+ ['size_req', 'size', 'absolute', 1, 1024 * 100000]
]},
'workers': {
- 'options': [None, 'apache Workers', 'workers', 'workers', 'apache.workers', 'stacked'],
+ 'options': [None, 'Workers', 'workers', 'workers', 'apache.workers', 'stacked'],
'lines': [
['idle'],
['busy'],
]},
'reqpersec': {
- 'options': [None, 'apache Lifetime Avg. Requests/s', 'requests/s', 'statistics',
+ 'options': [None, 'Lifetime Avg. Requests/s', 'requests/s', 'statistics',
'apache.reqpersec', 'area'],
'lines': [
- ['requests_sec']
+ ['requests_sec', 'requests', 'absolute', 1, 100000]
]},
'bytespersec': {
- 'options': [None, 'apache Lifetime Avg. Bandwidth/s', 'kilobits/s', 'statistics',
+ 'options': [None, 'Lifetime Avg. Bandwidth/s', 'kilobits/s', 'statistics',
'apache.bytesperreq', 'area'],
'lines': [
- ['size_sec', None, 'absolute', 8, 1000]
+ ['size_sec', None, 'absolute', 8, 1000 * 100000]
]},
'requests': {
- 'options': [None, 'apache Requests', 'requests/s', 'requests', 'apache.requests', 'line'],
+ 'options': [None, 'Requests', 'requests/s', 'requests', 'apache.requests', 'line'],
'lines': [
['requests', None, 'incremental']
]},
'net': {
- 'options': [None, 'apache Bandwidth', 'kilobits/s', 'bandwidth', 'apache.net', 'area'],
+ 'options': [None, 'Bandwidth', 'kilobits/s', 'bandwidth', 'apache.net', 'area'],
'lines': [
['sent', None, 'incremental', 8, 1]
]},
'connections': {
- 'options': [None, 'apache Connections', 'connections', 'connections', 'apache.connections', 'line'],
+ 'options': [None, 'Connections', 'connections', 'connections', 'apache.connections', 'line'],
'lines': [
['connections']
]},
'conns_async': {
- 'options': [None, 'apache Async Connections', 'connections', 'connections', 'apache.conns_async', 'stacked'],
+ 'options': [None, 'Async Connections', 'connections', 'connections', 'apache.conns_async', 'stacked'],
'lines': [
['keepalive'],
['closing'],
@@ -85,6 +82,14 @@ ASSIGNMENT = {
'ConnsAsyncWriting': 'writing'
}
+FLOAT_VALUES = [
+ 'BytesPerReq',
+ 'ReqPerSec',
+ 'BytesPerSec',
+]
+
+LIGHTTPD_MARKER = 'idle_servers'
+
class Service(UrlService):
def __init__(self, configuration=None, name=None):
@@ -95,20 +100,15 @@ class Service(UrlService):
def check(self):
self._manager = self._build_manager()
+
data = self._get_data()
+
if not data:
return None
- if 'idle_servers' in data:
- self.module_name = 'lighttpd'
- for chart in self.definitions:
- if chart == 'workers':
- lines = self.definitions[chart]['lines']
- lines[0] = ['idle_servers', 'idle']
- lines[1] = ['busy_servers', 'busy']
- opts = self.definitions[chart]['options']
- opts[1] = opts[1].replace('apache', 'lighttpd')
- opts[4] = opts[4].replace('apache', 'lighttpd')
+ if LIGHTTPD_MARKER in data:
+ self.turn_into_lighttpd()
+
return True
def _get_data(self):
@@ -117,15 +117,44 @@ class Service(UrlService):
:return: dict
"""
raw_data = self._get_raw_data()
+
if not raw_data:
return None
+
data = dict()
- for row in raw_data.split('\n'):
- tmp = row.split(':')
- if tmp[0] in ASSIGNMENT:
- try:
- data[ASSIGNMENT[tmp[0]]] = int(float(tmp[1]))
- except (IndexError, ValueError):
- continue
+ for line in raw_data.split('\n'):
+ try:
+ parse_line(line, data)
+ except ValueError:
+ continue
+
return data or None
+
+ def turn_into_lighttpd(self):
+ self.module_name = 'lighttpd'
+ for chart in self.definitions:
+ if chart == 'workers':
+ lines = self.definitions[chart]['lines']
+ lines[0] = ['idle_servers', 'idle']
+ lines[1] = ['busy_servers', 'busy']
+ opts = self.definitions[chart]['options']
+ opts[1] = opts[1].replace('apache', 'lighttpd')
+ opts[4] = opts[4].replace('apache', 'lighttpd')
+
+
+def parse_line(line, data):
+ parts = line.split(':')
+
+ if len(parts) != 2:
+ return
+
+ key, value = parts[0], parts[1]
+
+ if key not in ASSIGNMENT:
+ return
+
+ if key in FLOAT_VALUES:
+ data[ASSIGNMENT[key]] = int((float(value) * 100000))
+ else:
+ data[ASSIGNMENT[key]] = int(value)
diff --git a/collectors/python.d.plugin/beanstalk/beanstalk.chart.py b/collectors/python.d.plugin/beanstalk/beanstalk.chart.py
index 8651eee5bb..ed945a7810 100644
--- a/collectors/python.d.plugin/beanstalk/beanstalk.chart.py
+++ b/collectors/python.d.plugin/beanstalk/beanstalk.chart.py
@@ -12,12 +12,18 @@ except ImportError:
from bases.FrameworkServices.SimpleService import SimpleService
from bases.loaders import safe_load
-# default module values (can be overridden per job in `config`)
-# update_every = 2
-priority = 60000
-ORDER = ['cpu_usage', 'jobs_rate', 'connections_rate', 'commands_rate', 'current_tubes', 'current_jobs',
- 'current_connections', 'binlog', 'uptime']
+ORDER = [
+ 'cpu_usage',
+ 'jobs_rate',
+ 'connections_rate',
+ 'commands_rate',
+ 'current_tubes',
+ 'current_jobs',
+ 'current_connections',
+ 'binlog',
+ 'uptime',
+]
CHARTS = {
'cpu_usage': {
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 c67aafc194..7ac1bc3dc1 100644
--- a/collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py
+++ b/collectors/python.d.plugin/bind_rndc/bind_rndc.chart.py
@@ -11,10 +11,15 @@ from subprocess import Popen
from bases.collection import find_binary
from bases.FrameworkServices.SimpleService import SimpleService
-priority = 60000
+
update_every = 30
-ORDER = ['name_server_statistics', 'incoming_queries', 'outgoing_queries', 'named_stats_size']
+ORDER = [
+ 'name_server_statistics',
+ 'incoming_queries',
+ 'outgoing_queries',
+ 'named_stats_size',
+]
CHARTS = {
'name_server_statistics': {
@@ -43,7 +48,7 @@ CHARTS = {
'lines': [
]},
'named_stats_size': {
- 'options': [None, 'Named Stats File Size', 'MB', 'file size', 'bind_rndc.stats_size', 'line'],
+ 'options': [None, 'Named Stats File Size', 'MiB', 'file size', 'bind_rndc.stats_size', 'line'],
'lines': [
['stats_size', None, 'absolute', 1, 1 << 20]
]
@@ -91,10 +96,20 @@ class Service(SimpleService):
self.definitions = CHARTS
self.named_stats_path = self.configuration.get('named_stats_path', '/var/log/bind/named.stats')
self.rndc = find_binary('rndc')
- self.data = dict(nms_requests=0, nms_responses=0, nms_failure=0, nms_auth=0,
- nms_non_auth=0, nms_nxrrset=0, nms_success=0, nms_nxdomain=0,
- nms_recursion=0, nms_duplicate=0, nms_rejected_queries=0,
- nms_dropped_queries=0)
+ self.data = dict(
+ nms_requests=0,
+ nms_responses=0,
+ nms_failure=0,
+ nms_auth=0,
+ nms_non_auth=0,
+ nms_nxrrset=0,
+ nms_success=0,
+ nms_nxdomain=0,
+ nms_recursion=0,
+ nms_duplicate=0,
+ nms_rejected_queries=0,
+ nms_dropped_queries=0,
+ )
def check(self):
if not self.rndc:
diff --git a/collectors/python.d.plugin/boinc/boinc.chart.py b/collectors/python.d.plugin/boinc/boinc.chart.py
index d14754c4bb..e10b28ceaf 100644
--- a/collectors/python.d.plugin/boinc/boinc.chart.py
+++ b/collectors/python.d.plugin/boinc/boinc.chart.py
@@ -10,7 +10,12 @@ from bases.FrameworkServices.SimpleService import SimpleService
from third_party import boinc_client
-ORDER = ['tasks', 'states', 'sched_states', 'process_states']
+ORDER = [
+ 'tasks',
+ 'states',
+ 'sched_states',
+ 'process_states',
+]
CHARTS = {
'tasks': {
@@ -141,14 +146,16 @@ class Service(SimpleService):
def _get_data(self):
if not self.is_alive():
return None
+
data = dict(_DATA_TEMPLATE)
- results = []
+
try:
results = self.client.get_tasks()
except socket.error:
self.error('Connection is dead')
self.alive = False
return None
+
for task in results:
data['total'] += 1
data[_TASK_MAP[task.state]] += 1
@@ -159,4 +166,5 @@ class Service(SimpleService):
data[_PROC_MAP[task.active_task_state]] += 1
except AttributeError:
pass
- return data
+
+ return data or None
diff --git a/collectors/python.d.plugin/ceph/ceph.chart.py b/collectors/python.d.plugin/ceph/ceph.chart.py
index 2f0c9211c2..6fd774d61a 100644
--- a/collectors/python.d.plugin/ceph/ceph.chart.py
+++ b/collectors/python.d.plugin/ceph/ceph.chart.py
@@ -9,13 +9,13 @@ try:
except ImportError:
CEPH = False
-import os
import json
+import os
+
from bases.FrameworkServices.SimpleService import SimpleService
# default module values (can be overridden per job in `config`)
update_every = 10
-priority = 60000
ORDER = [
'general_usage',
@@ -36,7 +36,7 @@ ORDER = [
CHARTS = {
'general_usage': {
- 'options': [None, 'Ceph General Space', 'KB', 'general', 'ceph.general_usage', 'stacked'],
+ 'options': [None, 'Ceph General Space', 'KiB', 'general', 'ceph.general_usage', 'stacked'],
'lines': [
['general_available', 'avail', 'absolute'],
['general_usage', 'used', 'absolute']
@@ -49,7 +49,7 @@ CHARTS = {
]
},
'general_bytes': {
- 'options': [None, 'Ceph General Read/Write Data/s', 'KB', 'general', 'ceph.general_bytes',
+ 'options': [None, 'Ceph General Read/Write Data/s', 'KiB/s', 'general', 'ceph.general_bytes',
'area'],
'lines': [
['general_read_bytes', 'read', 'absolute', 1, 1024],
@@ -73,7 +73,7 @@ CHARTS = {
]
},
'pool_usage': {
- 'options': [None, 'Ceph Pools', 'KB', 'pool', 'ceph.pool_usage', 'line'],
+ 'options': [None, 'Ceph Pools', 'KiB', 'pool', 'ceph.pool_usage', 'line'],
'lines': []
},
'pool_objects': {
@@ -81,11 +81,11 @@ CHARTS = {
'lines': []
},
'pool_read_bytes': {
- 'options': [None, 'Ceph Read Pool Data/s', 'KB', 'pool', 'ceph.pool_read_bytes', 'area'],
+ 'options': [None, 'Ceph Read Pool Data/s', 'KiB/s', 'pool', 'ceph.pool_read_bytes', 'area'],
'lines': []
},
'pool_write_bytes': {
- 'options': [None, 'Ceph Write Pool Data/s', 'KB', 'pool', 'ceph.pool_write_bytes', 'area'],
+ 'options': [None, 'Ceph Write Pool Data/s', 'KiB/s', 'pool', 'ceph.pool_write_bytes', 'area'],
'lines': []
},
'pool_read_operations': {
@@ -97,7 +97,7 @@ CHARTS = {
'lines': []
},
'osd_usage': {
- 'options': [None, 'Ceph OSDs', 'KB', 'osd', 'ceph.osd_usage', 'line'],
+ 'options': [None, 'Ceph OSDs', 'KiB', 'osd', 'ceph.osd_usage', 'line'],
'lines': []
},
'osd_apply_latency': {
diff --git a/collectors/python.d.plugin/chrony/chrony.chart.py b/collectors/python.d.plugin/chrony/chrony.chart.py
index 07fc3d1fcc..91f7250011 100644
--- a/collectors/python.d.plugin/chrony/chrony.chart.py
+++ b/collectors/python.d.plugin/chrony/chrony.chart.py
@@ -7,10 +7,19 @@ from bases.FrameworkServices.ExecutableService import ExecutableService
# default module values (can be overridden per job in `config`)
update_every = 5
-priority = 60000
+
+CHRONY_COMMAND = 'chronyc -n tracking'
# charts order (can be overridden if you want less charts, or different order)
-ORDER = ['system', 'offsets', 'stratum', 'root', 'frequency', 'residualfreq', 'skew']
+ORDER = [
+ 'system',
+ 'offsets',
+ 'stratum',
+ 'root',
+ 'frequency',
+ 'residualfreq',
+ 'skew',
+]
CHARTS = {
'system': {
@@ -76,9 +85,9 @@ class Service(ExecutableService):
def __init__(self, configuration=None, name=None):
ExecutableService.__init__(
self, configuration=configuration, name=name)
- self.command = 'chronyc -n tracking'
self.order = ORDER
self.definitions = CHARTS
+ self.command = CHRONY_COMMAND
def _get_data(self):
"""
diff --git a/collectors/python.d.plugin/couchdb/couchdb.chart.py b/collectors/python.d.plugin/couchdb/couchdb.chart.py
index 7b30b4200c..a58694d705 100644
--- a/collectors/python.d.plugin/couchdb/couchdb.chart.py
+++ b/collectors/python.d.plugin/couchdb/couchdb.chart.py
@@ -8,6 +8,7 @@ from collections import namedtuple, defaultdict
from json import loads
from threading import Thread
from socket import gethostbyname, gaierror
+
try:
from queue import Queue
except ImportError:
@@ -15,9 +16,9 @@ except ImportError:
from bases.FrameworkServices.UrlService import UrlService
-# default module values (can be overridden per job in `config`)
+
update_every = 1
-priority = 60000
+
METHODS = namedtuple('METHODS', ['get_data', 'url', 'stats'])
@@ -108,7 +109,7 @@ ORDER = [
CHARTS = {
'activity': {
- 'options': [None, 'Overall Activity', 'req/s',
+ 'options': [None, 'Overall Activity', 'requests/s',
'dbactivity', 'couchdb.activity', 'stacked'],
'lines': [
['couchdb_database_reads', 'DB reads', 'incremental'],
@@ -117,7 +118,7 @@ CHARTS = {
]
},
'request_methods': {
- 'options': [None, 'HTTP request methods', 'req/s',
+ 'options': [None, 'HTTP request methods', 'requests/s',
'httptraffic', 'couchdb.request_methods',
'stacked'],
'lines': [
@@ -132,7 +133,7 @@ CHARTS = {
]
},
'response_codes': {
- 'options': [None, 'HTTP response status c