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 1000000*1000"}
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"
85 assignment = {"BytesPerReq": 'size_req',
86 "IdleWorkers": 'idle',
87 "BusyWorkers": 'busy',
88 "ReqPerSec": 'requests_sec',
89 "BytesPerSec": 'size_sec',
90 "Total Accesses": 'requests',
91 "Total kBytes": 'sent',
92 "ConnsTotal": 'connections',
93 "ConnsAsyncKeepAlive": 'keepalive',
94 "ConnsAsyncClosing": 'closing',
95 "ConnsAsyncWriting": 'writing'}
97 def _formatted_data(self):
99 Format data received from http request
102 raw = self._get_data().split("\n")
106 if str(tmp[0]) in self.assignment:
108 data[self.assignment[tmp[0]]] = int(float(tmp[1]))
109 except (IndexError, ValueError) as a: