diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /collectors/python.d.plugin/nginx | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-a64a253794ac64cb40befee54db53bde17dd0d49.tar.xz netdata-a64a253794ac64cb40befee54db53bde17dd0d49.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/nginx/Makefile.inc | 13 | ||||
-rw-r--r-- | collectors/python.d.plugin/nginx/README.md | 45 | ||||
-rw-r--r-- | collectors/python.d.plugin/nginx/nginx.chart.py (renamed from python.d/nginx.chart.py) | 27 | ||||
-rw-r--r-- | collectors/python.d.plugin/nginx/nginx.conf (renamed from conf.d/python.d/nginx.conf) | 0 | ||||
-rw-r--r-- | collectors/python.d.plugin/nginx_plus/Makefile.inc | 13 | ||||
-rw-r--r-- | collectors/python.d.plugin/nginx_plus/README.md | 125 | ||||
-rw-r--r-- | collectors/python.d.plugin/nginx_plus/nginx_plus.chart.py (renamed from python.d/nginx_plus.chart.py) | 107 | ||||
-rw-r--r-- | collectors/python.d.plugin/nginx_plus/nginx_plus.conf (renamed from conf.d/python.d/nginx_plus.conf) | 0 |
8 files changed, 266 insertions, 64 deletions
diff --git a/collectors/python.d.plugin/nginx/Makefile.inc b/collectors/python.d.plugin/nginx/Makefile.inc new file mode 100644 index 000000000..4636aa830 --- /dev/null +++ b/collectors/python.d.plugin/nginx/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 += nginx/nginx.chart.py +dist_pythonconfig_DATA += nginx/nginx.conf + +# do not install these files, but include them in the distribution +dist_noinst_DATA += nginx/README.md nginx/Makefile.inc + diff --git a/collectors/python.d.plugin/nginx/README.md b/collectors/python.d.plugin/nginx/README.md new file mode 100644 index 000000000..007f45c7c --- /dev/null +++ b/collectors/python.d.plugin/nginx/README.md @@ -0,0 +1,45 @@ +# nginx + +This module will monitor one or more nginx servers depending on configuration. Servers can be either local or remote. + +**Requirements:** + * nginx with configured 'ngx_http_stub_status_module' + * 'location /stub_status' + +Example nginx configuration can be found in 'python.d/nginx.conf' + +It produces following charts: + +1. **Active Connections** + * active + +2. **Requests** in requests/s + * requests + +3. **Active Connections by Status** + * reading + * writing + * waiting + +4. **Connections Rate** in connections/s + * accepts + * handled + +### configuration + +Needs only `url` to server's `stub_status` + +Here is an example for local server: + +```yaml +update_every : 10 +priority : 90100 + +local: + url : 'http://localhost/stub_status' + retries : 10 +``` + +Without configuration, module attempts to connect to `http://localhost/stub_status` + +--- diff --git a/python.d/nginx.chart.py b/collectors/python.d.plugin/nginx/nginx.chart.py index 2e4f0d1b5..09c6bbd37 100644 --- a/python.d/nginx.chart.py +++ b/collectors/python.d.plugin/nginx/nginx.chart.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Description: nginx netdata python.d module # Author: Pawel Krupa (paulfantom) +# SPDX-License-Identifier: GPL-3.0-or-later from bases.FrameworkServices.UrlService import UrlService @@ -25,28 +26,32 @@ CHARTS = { 'options': [None, 'nginx Active Connections', 'connections', 'active connections', 'nginx.connections', 'line'], 'lines': [ - ["active"] - ]}, + ['active'] + ] + }, 'requests': { 'options': [None, 'nginx Requests', 'requests/s', 'requests', 'nginx.requests', 'line'], 'lines': [ - ["requests", None, 'incremental'] - ]}, + ['requests', None, 'incremental'] + ] + }, 'connection_status': { 'options': [None, 'nginx Active Connections by Status', 'connections', 'status', 'nginx.connection_status', 'line'], 'lines': [ - ["reading"], - ["writing"], - ["waiting", "idle"] - ]}, + ['reading'], + ['writing'], + ['waiting', 'idle'] + ] + }, 'connect_rate': { 'options': [None, 'nginx Connections Rate', 'connections/s', 'connections rate', 'nginx.connect_rate', 'line'], 'lines': [ - ["accepts", "accepted", "incremental"], - ["handled", None, "incremental"] - ]} + ['accepts', 'accepted', 'incremental'], + ['handled', None, 'incremental'] + ] + } } diff --git a/conf.d/python.d/nginx.conf b/collectors/python.d.plugin/nginx/nginx.conf index 71c521066..71c521066 100644 --- a/conf.d/python.d/nginx.conf +++ b/collectors/python.d.plugin/nginx/nginx.conf diff --git a/collectors/python.d.plugin/nginx_plus/Makefile.inc b/collectors/python.d.plugin/nginx_plus/Makefile.inc new file mode 100644 index 000000000..d3fdeaf2b --- /dev/null +++ b/collectors/python.d.plugin/nginx_plus/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 += nginx_plus/nginx_plus.chart.py +dist_pythonconfig_DATA += nginx_plus/nginx_plus.conf + +# do not install these files, but include them in the distribution +dist_noinst_DATA += nginx_plus/README.md nginx_plus/Makefile.inc + diff --git a/collectors/python.d.plugin/nginx_plus/README.md b/collectors/python.d.plugin/nginx_plus/README.md new file mode 100644 index 000000000..43ec867a3 --- /dev/null +++ b/collectors/python.d.plugin/nginx_plus/README.md @@ -0,0 +1,125 @@ +# nginx_plus + +This module will monitor one or more nginx_plus servers depending on configuration. +Servers can be either local or remote. + +Example nginx_plus configuration can be found in 'python.d/nginx_plus.conf' + +It produces following charts: + +1. **Requests total** in requests/s + * total + +2. **Requests current** in requests + * current + +3. **Connection Statistics** in connections/s + * accepted + * dropped + +4. **Workers Statistics** in workers + * idle + * active + +5. **SSL Handshakes** in handshakes/s + * successful + * failed + +6. **SSL Session Reuses** in sessions/s + * reused + +7. **SSL Memory Usage** in percent + * usage + +8. **Processes** in processes + * respawned + +For every server zone: + +1. **Processing** in requests + * processing + +2. **Requests** in requests/s + * requests + +3. **Responses** in requests/s + * 1xx + * 2xx + * 3xx + * 4xx + * 5xx + +4. **Traffic** in kilobits/s + * received + * sent + +For every upstream: + +1. **Peers Requests** in requests/s + * peer name (dimension per peer) + +2. **All Peers Responses** in responses/s + * 1xx + * 2xx + * 3xx + * 4xx + * 5xx + +3. **Peer Responses** in requests/s (for every peer) + * 1xx + * 2xx + * 3xx + * 4xx + * 5xx + +4. **Peers Connections** in active + * peer name (dimension per peer) + +5. **Peers Connections Usage** in percent + * peer name (dimension per peer) + +6. **All Peers Traffic** in KB + * received + * sent + +7. **Peer Traffic** in KB/s (for every peer) + * received + * sent + +8. **Peer Timings** in ms (for every peer) + * header + * response + +9. **Memory Usage** in percent + * usage + +10. **Peers Status** in state + * peer name (dimension per peer) + +11. **Peers Total Downtime** in seconds + * peer name (dimension per peer) + +For every cache: + +1. **Traffic** in KB + * served + * written + * bypass + +2. **Memory Usage** in percent + * usage + +### configuration + +Needs only `url` to server's `status` + +Here is an example for local server: + +```yaml +local: + url : 'http://localhost/status' +``` + +Without configuration, module fail to start. + +--- diff --git a/python.d/nginx_plus.chart.py b/collectors/python.d.plugin/nginx_plus/nginx_plus.chart.py index 509ddd380..1392f5a56 100644 --- a/python.d/nginx_plus.chart.py +++ b/collectors/python.d.plugin/nginx_plus/nginx_plus.chart.py @@ -1,6 +1,7 @@ # -*- coding: utf-8 -*- # Description: nginx_plus netdata python.d module # Author: Ilya Mashchenko (l2isbad) +# SPDX-License-Identifier: GPL-3.0-or-later import re @@ -21,63 +22,71 @@ priority = 60000 retries = 60 # charts order (can be overridden if you want less charts, or different order) -ORDER = ['requests_total', 'requests_current', - 'connections_statistics', 'connections_workers', - 'ssl_handshakes', 'ssl_session_reuses', 'ssl_memory_usage', - 'processes'] +ORDER = [ + 'requests_total', + 'requests_current', + 'connections_statistics', + 'connections_workers', + 'ssl_handshakes', + 'ssl_session_reuses', + 'ssl_memory_usage', + 'processes' +] CHARTS = { 'requests_total': { - 'options': [None, 'Requests Total', 'requests/s', - 'requests', 'nginx_plus.requests_total', 'line'], + 'options': [None, 'Requests Total', 'requests/s', 'requests', 'nginx_plus.requests_total', 'line'], 'lines': [ ['requests_total', 'total', 'incremental'] - ]}, + ] + }, 'requests_current': { - 'options': [None, 'Requests Current', 'requests', - 'requests', 'nginx_plus.requests_current', 'line'], + 'options': [None, 'Requests Current', 'requests', 'requests', 'nginx_plus.requests_current', 'line'], 'lines': [ ['requests_current', 'current'] - ]}, + ] + }, 'connections_statistics': { 'options': [None, 'Connections Statistics', 'connections/s', 'connections', 'nginx_plus.connections_statistics', 'stacked'], 'lines': [ ['connections_accepted', 'accepted', 'incremental'], ['connections_dropped', 'dropped', 'incremental'] - ]}, + ] + }, 'connections_workers': { 'options': [None, 'Workers Statistics', 'workers', 'connections', 'nginx_plus.connections_workers', 'stacked'], 'lines': [ ['connections_idle', 'idle'], ['connections_active', 'active'] - ]}, + ] + }, 'ssl_handshakes': { - 'options': [None, 'SSL Handshakes', 'handshakes/s', - 'ssl', 'nginx_plus.ssl_handshakes', 'stacked'], + 'options': [None, 'SSL Handshakes', 'handshakes/s', 'ssl', 'nginx_plus.ssl_handshakes', 'stacked'], 'lines': [ ['ssl_handshakes', 'successful', 'incremental'], ['ssl_handshakes_failed', 'failed', 'incremental'] - ]}, + ] + }, 'ssl_session_reuses': { - 'options': [None, 'Session Reuses', 'sessions/s', - 'ssl', 'nginx_plus.ssl_session_reuses', 'line'], + 'options': [None, 'Session Reuses', 'sessions/s', 'ssl', 'nginx_plus.ssl_session_reuses', 'line'], 'lines': [ ['ssl_session_reuses', 'reused', 'incremental'] - ]}, + ] + }, 'ssl_memory_usage': { - 'options': [None, 'Memory Usage', '%', - 'ssl', 'nginx_plus.ssl_memory_usage', 'area'], + 'options': [None, 'Memory Usage', '%', 'ssl', 'nginx_plus.ssl_memory_usage', 'area'], 'lines': [ ['ssl_memory_usage', 'usage', 'absolute', 1, 100] - ]}, + ] + }, 'processes': { - 'options': [None, 'Processes', 'processes', - 'processes', 'nginx_plus.processes', 'line'], + 'options': [None, 'Processes', 'processes', 'processes', 'nginx_plus.processes', 'line'], 'lines': [ ['processes_respawned', 'respawned'] - ]} + ] + } } @@ -86,17 +95,15 @@ def cache_charts(cache): charts = OrderedDict() charts['{0}_traffic'.format(cache.name)] = { - 'options': [None, 'Traffic', 'KB', family, - 'nginx_plus.cache_traffic', 'stacked'], + 'options': [None, 'Traffic', 'KB', family, 'nginx_plus.cache_traffic', 'stacked'], 'lines': [ ['_'.join([cache.name, 'hit_bytes']), 'served', 'absolute', 1, 1024], ['_'.join([cache.name, 'miss_bytes_written']), 'written', 'absolute', 1, 1024], ['_'.join([cache.name, 'miss_bytes']), 'bypass', 'absolute', 1, 1024] - ] + ] } charts['{0}_memory_usage'.format(cache.name)] = { - 'options': [None, 'Memory Usage', '%', family, - 'nginx_plus.cache_memory_usage', 'area'], + 'options': [None, 'Memory Usage', '%', family, 'nginx_plus.cache_memory_usage', 'area'], 'lines': [ ['_'.join([cache.name, 'memory_usage']), 'usage', 'absolute', 1, 100], ] @@ -160,8 +167,7 @@ def web_upstream_charts(wu): # Requests charts['web_upstream_{name}_requests'.format(name=wu.name)] = { - 'options': [None, 'Peers Requests', 'requests/s', family, - 'nginx_plus.web_upstream_requests', 'line'], + 'options': [None, 'Peers Requests', 'requests/s', family, 'nginx_plus.web_upstream_requests', 'line'], 'lines': dimensions('requests', 'incremental') } # Responses Codes @@ -177,7 +183,7 @@ def web_upstream_charts(wu): ] } for peer in wu: - charts['web_upstream_{0}_{1}_responses'.format(wu.name, peer.id)] = { + charts['web_upstream_{0}_{1}_responses'.format(wu.name, peer.server)] = { 'options': [None, 'Peer "{0}" Responses'.format(peer.real_server), 'responses/s', family, 'nginx_plus.web_upstream_peer_responses', 'stacked'], 'lines': [ @@ -190,26 +196,23 @@ def web_upstream_charts(wu): } # Connections charts['web_upstream_{name}_connections'.format(name=wu.name)] = { - 'options': [None, 'Peers Connections', 'active', family, - 'nginx_plus.web_upstream_connections', 'line'], + 'options': [None, 'Peers Connections', 'active', family, 'nginx_plus.web_upstream_connections', 'line'], 'lines': dimensions('active') } charts['web_upstream_{name}_connections_usage'.format(name=wu.name)] = { - 'options': [None, 'Peers Connections Usage', '%', family, - 'nginx_plus.web_upstream_connections_usage', 'line'], + 'options': [None, 'Peers Connections Usage', '%', family, 'nginx_plus.web_upstream_connections_usage', 'line'], 'lines': dimensions('connections_usage', d=100) } # Traffic charts['web_upstream_{0}_all_net'.format(wu.name)] = { - 'options': [None, 'All Peers Traffic', 'kilobits/s', family, - 'nginx_plus.web_upstream_all_net', 'area'], + 'options': [None, 'All Peers Traffic', 'kilobits/s', family, 'nginx_plus.web_upstream_all_net', 'area'], 'lines': [ ['{0}_received'.format(wu.name), 'received', 'incremental', 1, 1000], ['{0}_sent'.format(wu.name), 'sent', 'incremental', -1, 1000] ] } for peer in wu: - charts['web_upstream_{0}_{1}_net'.format(wu.name, peer.id)] = { + charts['web_upstream_{0}_{1}_net'.format(wu.name, peer.server)] = { 'options': [None, 'Peer "{0}" Traffic'.format(peer.real_server), 'kilobits/s', family, 'nginx_plus.web_upstream_peer_traffic', 'area'], 'lines': [ @@ -219,7 +222,7 @@ def web_upstream_charts(wu): } # Response Time for peer in wu: - charts['web_upstream_{0}_{1}_timings'.format(wu.name, peer.id)] = { + charts['web_upstream_{0}_{1}_timings'.format(wu.name, peer.server)] = { 'options': [None, 'Peer "{0}" Timings'.format(peer.real_server), 'ms', family, 'nginx_plus.web_upstream_peer_timings', 'line'], 'lines': [ @@ -229,30 +232,27 @@ def web_upstream_charts(wu): } # Memory Usage charts['web_upstream_{name}_memory_usage'.format(name=wu.name)] = { - 'options': [None, 'Memory Usage', '%', family, - 'nginx_plus.web_upstream_memory_usage', 'area'], + 'options': [None, 'Memory Usage', '%', family, 'nginx_plus.web_upstream_memory_usage', 'area'], 'lines': [ ['_'.join([wu.name, 'memory_usage']), 'usage', 'absolute', 1, 100] ] } # State charts['web_upstream_{name}_status'.format(name=wu.name)] = { - 'options': [None, 'Peers Status', 'state', family, - 'nginx_plus.web_upstream_status', 'line'], + 'options': [None, 'Peers Status', 'state', family, 'nginx_plus.web_upstream_status', 'line'], 'lines': dimensions('state') } # Downtime charts['web_upstream_{name}_downtime'.format(name=wu.name)] = { - 'options': [None, 'Peers Downtime', 'seconds', family, - 'nginx_plus.web_upstream_peer_downtime', 'line'], + 'options': [None, 'Peers Downtime', 'seconds', family, 'nginx_plus.web_upstream_peer_downtime', 'line'], 'lines': dimensions('downtime', d=1000) } return charts -METRICS = dict( - SERVER=[ +METRICS = { + 'SERVER': [ 'processes.respawned', 'connections.accepted', 'connections.dropped', @@ -266,7 +266,7 @@ METRICS = dict( 'slabs.SSL.pages.free', 'slabs.SSL.pages.used' ], - WEB_ZONE=[ + 'WEB_ZONE': [ 'processing', 'requests', 'responses.1xx', @@ -278,7 +278,7 @@ METRICS = dict( 'received', 'sent' ], - WEB_UPSTREAM_PEER=[ + 'WEB_UPSTREAM_PEER': [ 'id', 'server', 'name', @@ -297,7 +297,7 @@ METRICS = dict( 'received', 'downtime' ], - WEB_UPSTREAM_SUMMARY=[ + 'WEB_UPSTREAM_SUMMARY': [ 'responses.1xx', 'responses.2xx', 'responses.3xx', @@ -306,13 +306,13 @@ METRICS = dict( 'sent', 'received' ], - CACHE=[ + 'CACHE': [ 'hit.bytes', # served 'miss.bytes_written', # written 'miss.bytes' # bypass ] -) +} BAD_SYMBOLS = re.compile(r'[:/.-]+') @@ -373,6 +373,7 @@ class WebUpstream: return peer def peers_stats(self, peers): + peers = {int(peer['id']): peer for peer in peers} data = dict() for peer in self.peers.values(): if not peer.active: diff --git a/conf.d/python.d/nginx_plus.conf b/collectors/python.d.plugin/nginx_plus/nginx_plus.conf index 7b5c8f43f..7b5c8f43f 100644 --- a/conf.d/python.d/nginx_plus.conf +++ b/collectors/python.d.plugin/nginx_plus/nginx_plus.conf |