1 # -*- coding: utf-8 -*-
2 # Description: apache netdata python.d plugin
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 = ['bytesperreq', 'workers', 'reqpersec', 'bytespersec', 'requests', 'net', 'connections', 'conns_async']
25 'options': "'' 'apache Lifetime Avg. Response Size' 'bytes/request' statistics apache.bytesperreq area",
28 "options": "'' absolute 1"}
31 'options': "'' 'apache Workers' 'workers' workers apache.workers stacked",
34 "options": "'' absolute 1 1"},
36 "options": "'' absolute 1 1"}
39 'options': "'' 'apache Lifetime Avg. Requests/s' 'requests/s' statistics apache.reqpersec area",
41 {"name": "requests_sec",
42 "options": "'' absolute 1 1000000"}
45 'options': "'' 'apache Lifetime Avg. Response Size' 'bytes/request' statistics apache.bytesperreq area",
48 "options": "'' absolute 8 1000000000"}
51 'options': "''' 'apache Requests' 'requests/s' requests apache.requests line",
54 "options": "'' incremental 1 1"}
57 'options': "'' 'apache Bandwidth' 'kilobits/s' bandwidth apache.net area",
60 "options": "'' incremental 8 1"}
63 'options': "'' 'apache Connections' 'connections' connections apache.connections line",
65 {"name": "connections",
66 "options": "'' absolute 1 1"}
69 'options': "'' 'apache Async Connections' 'connections' connections apache.conns_async stacked",
72 "options": "'' absolute 1 1"},
74 "options": "'' absolute 1 1"},
76 "options": "'' absolute 1 1"}
81 class Service(UrlService):
82 # url = "http://localhost/server-status?auto"
83 url = "http://www.apache.org/server-status?auto"
86 assignment = {"BytesPerReq": 'size_req',
87 "IdleWorkers": 'idle',
88 "BusyWorkers": 'busy',
89 "ReqPerSec": 'requests_sec',
90 "BytesPerSec": 'size_sec',
91 "Total Accesses": 'requests',
92 "Total kBytes": 'sent',
93 "ConnsTotal": 'connections',
94 "ConnsAsyncKeepAlive": 'keepalive',
95 "ConnsAsyncClosing": 'closing',
96 "ConnsAsyncWriting": 'writing'}
98 def _formatted_data(self):
100 Format data received from http request
103 raw = self._get_data().split("\n")
107 if str(tmp[0]) in self.assignment:
109 data[self.assignment[tmp[0]]] = int(float(tmp[1]))
110 except (IndexError, ValueError) as a: