diff options
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/apache/Makefile.inc | 13 | ||||
-rw-r--r-- | collectors/python.d.plugin/apache/README.md | 59 | ||||
-rw-r--r-- | collectors/python.d.plugin/apache/apache.chart.py (renamed from python.d/apache.chart.py) | 57 | ||||
-rw-r--r-- | collectors/python.d.plugin/apache/apache.conf (renamed from conf.d/python.d/apache.conf) | 2 |
4 files changed, 103 insertions, 28 deletions
diff --git a/collectors/python.d.plugin/apache/Makefile.inc b/collectors/python.d.plugin/apache/Makefile.inc new file mode 100644 index 000000000..70a421550 --- /dev/null +++ b/collectors/python.d.plugin/apache/Makefile.inc @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +# THIS IS NOT A COMPLETE Makefile +# IT IS INCLUDED BY ITS PARENT'S Makefile.am +# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT + +# install these files +dist_python_DATA += apache/apache.chart.py +dist_pythonconfig_DATA += apache/apache.conf + +# do not install these files, but include them in the distribution +dist_noinst_DATA += apache/README.md apache/Makefile.inc + diff --git a/collectors/python.d.plugin/apache/README.md b/collectors/python.d.plugin/apache/README.md new file mode 100644 index 000000000..c6d1d126a --- /dev/null +++ b/collectors/python.d.plugin/apache/README.md @@ -0,0 +1,59 @@ +# apache + +This module will monitor one or more Apache servers depending on configuration. + +**Requirements:** + * apache with enabled `mod_status` + +It produces the following charts: + +1. **Requests** in requests/s + * requests + +2. **Connections** + * connections + +3. **Async Connections** + * keepalive + * closing + * writing + +4. **Bandwidth** in kilobytes/s + * sent + +5. **Workers** + * idle + * busy + +6. **Lifetime Avg. Requests/s** in requests/s + * requests_sec + +7. **Lifetime Avg. Bandwidth/s** in kilobytes/s + * size_sec + +8. **Lifetime Avg. Response Size** in bytes/request + * size_req + +### configuration + +Needs only `url` to server's `server-status?auto` + +Here is an example for 2 servers: + +```yaml +update_every : 10 +priority : 90100 + +local: + url : 'http://localhost/server-status?auto' + retries : 20 + +remote: + url : 'http://www.apache.org/server-status?auto' + update_every : 5 + retries : 4 +``` + +Without configuration, module attempts to connect to `http://localhost/server-status?auto` + +--- diff --git a/python.d/apache.chart.py b/collectors/python.d.plugin/apache/apache.chart.py index 789b3c099..d136274d0 100644 --- a/python.d/apache.chart.py +++ b/collectors/python.d.plugin/apache/apache.chart.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Description: apache netdata python.d module # Author: Pawel Krupa (paulfantom) +# SPDX-License-Identifier: GPL-3.0-or-later from bases.FrameworkServices.UrlService import UrlService @@ -25,63 +26,65 @@ CHARTS = { 'options': [None, 'apache Lifetime Avg. Response Size', 'bytes/request', 'statistics', 'apache.bytesperreq', 'area'], 'lines': [ - ["size_req"] + ['size_req'] ]}, 'workers': { 'options': [None, 'apache Workers', 'workers', 'workers', 'apache.workers', 'stacked'], 'lines': [ - ["idle"], - ["busy"], + ['idle'], + ['busy'], ]}, 'reqpersec': { 'options': [None, 'apache Lifetime Avg. Requests/s', 'requests/s', 'statistics', 'apache.reqpersec', 'area'], 'lines': [ - ["requests_sec"] + ['requests_sec'] ]}, 'bytespersec': { 'options': [None, 'apache Lifetime Avg. Bandwidth/s', 'kilobits/s', 'statistics', 'apache.bytesperreq', 'area'], 'lines': [ - ["size_sec", None, 'absolute', 8, 1000] + ['size_sec', None, 'absolute', 8, 1000] ]}, 'requests': { 'options': [None, 'apache Requests', 'requests/s', 'requests', 'apache.requests', 'line'], 'lines': [ - ["requests", None, 'incremental'] + ['requests', None, 'incremental'] ]}, 'net': { 'options': [None, 'apache Bandwidth', 'kilobits/s', 'bandwidth', 'apache.net', 'area'], 'lines': [ - ["sent", None, 'incremental', 8, 1] + ['sent', None, 'incremental', 8, 1] ]}, 'connections': { 'options': [None, 'apache Connections', 'connections', 'connections', 'apache.connections', 'line'], 'lines': [ - ["connections"] + ['connections'] ]}, 'conns_async': { 'options': [None, 'apache Async Connections', 'connections', 'connections', 'apache.conns_async', 'stacked'], 'lines': [ - ["keepalive"], - ["closing"], - ["writing"] + ['keepalive'], + ['closing'], + ['writing'] ]} } -ASSIGNMENT = {"BytesPerReq": 'size_req', - "IdleWorkers": 'idle', - "IdleServers": 'idle_servers', - "BusyWorkers": 'busy', - "BusyServers": 'busy_servers', - "ReqPerSec": 'requests_sec', - "BytesPerSec": 'size_sec', - "Total Accesses": 'requests', - "Total kBytes": 'sent', - "ConnsTotal": 'connections', - "ConnsAsyncKeepAlive": 'keepalive', - "ConnsAsyncClosing": 'closing', - "ConnsAsyncWriting": 'writing'} +ASSIGNMENT = { + 'BytesPerReq': 'size_req', + 'IdleWorkers': 'idle', + 'IdleServers': 'idle_servers', + 'BusyWorkers': 'busy', + 'BusyServers': 'busy_servers', + 'ReqPerSec': 'requests_sec', + 'BytesPerSec': 'size_sec', + 'Total Accesses': 'requests', + 'Total kBytes': 'sent', + 'ConnsTotal': 'connections', + 'ConnsAsyncKeepAlive': 'keepalive', + 'ConnsAsyncClosing': 'closing', + 'ConnsAsyncWriting': 'writing' +} class Service(UrlService): @@ -102,8 +105,8 @@ class Service(UrlService): for chart in self.definitions: if chart == 'workers': lines = self.definitions[chart]['lines'] - lines[0] = ["idle_servers", 'idle'] - lines[1] = ["busy_servers", 'busy'] + 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') @@ -120,7 +123,7 @@ class Service(UrlService): data = dict() for row in raw_data.split('\n'): - tmp = row.split(":") + tmp = row.split(':') if tmp[0] in ASSIGNMENT: try: data[ASSIGNMENT[tmp[0]]] = int(float(tmp[1])) diff --git a/conf.d/python.d/apache.conf b/collectors/python.d.plugin/apache/apache.conf index 3bbc3f786..8b606f7e0 100644 --- a/conf.d/python.d/apache.conf +++ b/collectors/python.d.plugin/apache/apache.conf @@ -84,4 +84,4 @@ localipv4: localipv6: name : 'local' - url : 'http://::1/server-status?auto' + url : 'http://[::1]/server-status?auto' |