1 # -*- coding: utf-8 -*-
2 # Description: apache netdata python.d module
3 # Author: Pawel Krupa (paulfantom)
5 from base import UrlService
7 # default module values (can be overridden per job in `config`)
12 # default job configuration (overridden by python.d.plugin)
13 # config = {'local': {
14 # 'update_every': update_every,
16 # 'priority': priority,
17 # 'url': 'http://www.apache.org/server-status?auto'
20 # charts order (can be overridden if you want less charts, or different order)
21 ORDER = ['requests', 'connections', 'conns_async', 'net', 'workers', 'reqpersec', 'bytespersec', 'bytesperreq']
25 'options': [None, 'apache Lifetime Avg. Response Size', 'bytes/request', 'statistics', 'apache.bytesperreq', 'area'],
30 'options': [None, 'apache Workers', 'workers', 'workers', 'apache.workers', 'stacked'],
36 'options': [None, 'apache Lifetime Avg. Requests/s', 'requests/s', 'statistics', 'apache.reqpersec', 'area'],
41 'options': [None, 'apache Lifetime Avg. Bandwidth/s', 'kilobytes/s', 'statistics', 'apache.bytesperreq', 'area'],
43 ["size_sec", None, 'absolute', 1, 1000]
46 'options': [None, 'apache Requests', 'requests/s', 'requests', 'apache.requests', 'line'],
48 ["requests", None, 'incremental']
51 'options': [None, 'apache Bandwidth', 'kilobytes/s', 'bandwidth', 'apache.net', 'area'],
53 ["sent", None, 'incremental']
56 'options': [None, 'apache Connections', 'connections', 'connections', 'apache.connections', 'line'],
61 'options': [None, 'apache Async Connections', 'connections', 'connections', 'apache.conns_async', 'stacked'],
70 class Service(UrlService):
71 def __init__(self, configuration=None, name=None):
72 UrlService.__init__(self, configuration=configuration, name=name)
73 if len(self.url) == 0:
74 self.url = "http://localhost/server-status?auto"
76 self.definitions = CHARTS
77 self.assignment = {"BytesPerReq": 'size_req',
78 "IdleWorkers": 'idle',
79 "BusyWorkers": 'busy',
80 "ReqPerSec": 'requests_sec',
81 "BytesPerSec": 'size_sec',
82 "Total Accesses": 'requests',
83 "Total kBytes": 'sent',
84 "ConnsTotal": 'connections',
85 "ConnsAsyncKeepAlive": 'keepalive',
86 "ConnsAsyncClosing": 'closing',
87 "ConnsAsyncWriting": 'writing'}
91 Format data received from http request
95 raw = self._get_raw_data().split("\n")
96 except AttributeError:
101 if str(tmp[0]) in self.assignment:
103 data[self.assignment[tmp[0]]] = int(float(tmp[1]))
104 except (IndexError, ValueError):