X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=python.d%2Fapache.chart.py;h=2e4d16dd379425d5d9ea32f0197a4b70565817cb;hb=719ba47914bad933bf4503d3340b9543d5e631a6;hp=71a68ba827e867042a18baf9efe5a39730bedca0;hpb=bd67875f26d7f5e7cea7c77a451b27c47b8d000b;p=netdata.git diff --git a/python.d/apache.chart.py b/python.d/apache.chart.py index 71a68ba8..2e4d16dd 100644 --- a/python.d/apache.chart.py +++ b/python.d/apache.chart.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Description: apache netdata python.d plugin +# Description: apache netdata python.d module # Author: Pawel Krupa (paulfantom) from base import UrlService @@ -7,7 +7,7 @@ from base import UrlService # default module values (can be overridden per job in `config`) # update_every = 2 priority = 60000 -retries = 5 +retries = 60 # default job configuration (overridden by python.d.plugin) # config = {'local': { @@ -22,58 +22,47 @@ ORDER = ['requests', 'connections', 'conns_async', 'net', 'workers', 'reqpersec' CHARTS = { 'bytesperreq': { - 'options': "'' 'apache Lifetime Avg. Response Size' 'bytes/request' statistics apache.bytesperreq area", + 'options': [None, 'apache Lifetime Avg. Response Size', 'bytes/request', 'statistics', 'apache.bytesperreq', 'area'], 'lines': [ - {"name": "size_req", - "options": "'' absolute 1 1000000"} + ["size_req"] ]}, 'workers': { - 'options': "'' 'apache Workers' 'workers' workers apache.workers stacked", + 'options': [None, 'apache Workers', 'workers', 'workers', 'apache.workers', 'stacked'], 'lines': [ - {"name": "idle", - "options": "'' absolute 1 1"}, - {"name": "busy", - "options": "'' absolute 1 1"} + ["idle"], + ["busy"] ]}, 'reqpersec': { - 'options': "'' 'apache Lifetime Avg. Requests/s' 'requests/s' statistics apache.reqpersec area", + 'options': [None, 'apache Lifetime Avg. Requests/s', 'requests/s', 'statistics', 'apache.reqpersec', 'area'], 'lines': [ - {"name": "requests_sec", - "options": "'' absolute 1 1000000"} + ["requests_sec"] ]}, 'bytespersec': { - 'options': "'' 'apache Lifetime Avg. Bandwidth/s' 'kilobits/s' statistics apache.bytesperreq area", + 'options': [None, 'apache Lifetime Avg. Bandwidth/s', 'kilobytes/s', 'statistics', 'apache.bytesperreq', 'area'], 'lines': [ - {"name": "size_sec", - "options": "'' absolute 8 1000000000"} + ["size_sec", None, 'absolute', 1, 1000] ]}, 'requests': { - 'options': "'' 'apache Requests' 'requests/s' requests apache.requests line", + 'options': [None, 'apache Requests', 'requests/s', 'requests', 'apache.requests', 'line'], 'lines': [ - {"name": "requests", - "options": "'' incremental 1 1"} + ["requests", None, 'incremental'] ]}, 'net': { - 'options': "'' 'apache Bandwidth' 'kilobits/s' bandwidth apache.net area", + 'options': [None, 'apache Bandwidth', 'kilobytes/s', 'bandwidth', 'apache.net', 'area'], 'lines': [ - {"name": "sent", - "options": "'' incremental 8 1"} + ["sent", None, 'incremental'] ]}, 'connections': { - 'options': "'' 'apache Connections' 'connections' connections apache.connections line", + 'options': [None, 'apache Connections', 'connections', 'connections', 'apache.connections', 'line'], 'lines': [ - {"name": "connections", - "options": "'' absolute 1 1"} + ["connections"] ]}, 'conns_async': { - 'options': "'' 'apache Async Connections' 'connections' connections apache.conns_async stacked", + 'options': [None, 'apache Async Connections', 'connections', 'connections', 'apache.conns_async', 'stacked'], 'lines': [ - {"name": "keepalive", - "options": "'' absolute 1 1"}, - {"name": "closing", - "options": "'' absolute 1 1"}, - {"name": "writing", - "options": "'' absolute 1 1"} + ["keepalive"], + ["closing"], + ["writing"] ]} } @@ -84,7 +73,7 @@ class Service(UrlService): if len(self.url) == 0: self.url = "http://localhost/server-status?auto" self.order = ORDER - self.charts = CHARTS + self.definitions = CHARTS self.assignment = {"BytesPerReq": 'size_req', "IdleWorkers": 'idle', "BusyWorkers": 'busy', @@ -97,13 +86,13 @@ class Service(UrlService): "ConnsAsyncClosing": 'closing', "ConnsAsyncWriting": 'writing'} - def _formatted_data(self): + def _get_data(self): """ Format data received from http request :return: dict """ try: - raw = self._get_data().split("\n") + raw = self._get_raw_data().split("\n") except AttributeError: return None data = {} @@ -111,12 +100,8 @@ class Service(UrlService): tmp = row.split(":") if str(tmp[0]) in self.assignment: try: - multiplier = 1 - if tmp[0] in ("BytesPerReq", "ReqPerSec", "BytesPerSec"): - multiplier = 1000 - data[self.assignment[tmp[0]]] = int(float(tmp[1])*multiplier) - except (IndexError, ValueError) as a: - print(a) + data[self.assignment[tmp[0]]] = int(float(tmp[1])) + except (IndexError, ValueError): pass if len(data) == 0: return None