X-Git-Url: https://arthur.barton.de/gitweb/?a=blobdiff_plain;f=python.d%2Fnginx.chart.py;h=88849a921c4728eff768d3926c5f33d4b8e506f4;hb=2079851112928fbfec53794776686bde2bbc2643;hp=89752f565d6b508bb004fe0437fd36b055c6c30b;hpb=bd67875f26d7f5e7cea7c77a451b27c47b8d000b;p=netdata.git diff --git a/python.d/nginx.chart.py b/python.d/nginx.chart.py index 89752f56..88849a92 100644 --- a/python.d/nginx.chart.py +++ b/python.d/nginx.chart.py @@ -1,5 +1,5 @@ # -*- coding: utf-8 -*- -# Description: nginx netdata python.d plugin +# Description: nginx netdata python.d module # Author: Pawel Krupa (paulfantom) from base import UrlService @@ -7,7 +7,7 @@ from base import UrlService # default module values (can be overridden per job in `config`) # update_every = 2 priority = 60000 -retries = 5 +retries = 60 # default job configuration (overridden by python.d.plugin) # config = {'local': { @@ -22,34 +22,27 @@ ORDER = ['connections', 'requests', 'connection_status', 'connect_rate'] CHARTS = { 'connections': { - 'options': "'' 'nginx Active Connections' 'connections' nginx nginx.connections line", + 'options': [None, 'nginx Active Connections', 'connections', 'active connections', 'nginx.connections', 'line'], 'lines': [ - {"name": "active", - "options": "'' absolute 1 1"} + ["active"] ]}, 'requests': { - 'options': "'' 'nginx Requests' 'requests/s' nginx nginx.requests line", + 'options': [None, 'nginx Requests', 'requests/s', 'requests', 'nginx.requests', 'line'], 'lines': [ - {"name": "requests", - "options": "'' incremental 1 1"} + ["requests", None, 'incremental'] ]}, 'connection_status': { - 'options': "'' 'nginx Active Connections by Status' 'connections' nginx nginx.connection.status line", + 'options': [None, 'nginx Active Connections by Status', 'connections', 'status', 'nginx.connection_status', 'line'], 'lines': [ - {"name": "reading", - "options": "'' absolute 1 1"}, - {"name": "writing", - "options": "'' absolute 1 1"}, - {"name": "waiting", - "options": "idle absolute 1 1"} + ["reading"], + ["writing"], + ["waiting", "idle"] ]}, 'connect_rate': { - 'options': "'' 'nginx Connections Rate' 'connections/s' nginx nginx.performance line", + 'options': [None, 'nginx Connections Rate', 'connections/s', 'connections rate', 'nginx.connect_rate', 'line'], 'lines': [ - {"name": "accepts", - "options": "accepted incremental 1 1"}, - {"name": "handled", - "options": "'' incremental 1 1"} + ["accepts", "accepted", "incremental"], + ["handled", None, "incremental"] ]} } @@ -60,21 +53,21 @@ class Service(UrlService): if len(self.url) == 0: self.url = "http://localhost/stub_status" self.order = ORDER - self.charts = CHARTS + self.definitions = CHARTS - def _formatted_data(self): + def _get_data(self): """ Format data received from http request :return: dict """ try: - raw = self._get_data().split(" ") + raw = self._get_raw_data().split(" ") return {'active': int(raw[2]), - 'requests': int(raw[7]), + 'requests': int(raw[9]), 'reading': int(raw[11]), 'writing': int(raw[13]), 'waiting': int(raw[15]), - 'accepts': int(raw[8]), - 'handled': int(raw[9])} + 'accepts': int(raw[7]), + 'handled': int(raw[8])} except (ValueError, AttributeError): return None