@cryptotaxi247 / netdata-1 / commits / 290cb6b06

removed nginx_log and gunicorn_log

Costa Tsaousis (ktsaou) committed Feb 11, 2017 at 10:16 UTC 290cb6b06ecbd8c8d7d284494b468be11c5e9934
4 files changed -158
conf.d/Makefile.am
-2
@@ -33,7 +33,6 @@ dist_pythonconfig_DATA = \
33 python.d/exim.conf \
34 python.d/fail2ban.conf \
35 python.d/freeradius.conf \
36 - python.d/gunicorn_log.conf \
36 python.d/haproxy.conf \
37 python.d/hddtemp.conf \
38 python.d/ipfs.conf \
@@ -42,7 +41,6 @@ dist_pythonconfig_DATA = \
41 python.d/memcached.conf \
42 python.d/mysql.conf \
43 python.d/nginx.conf \
45 - python.d/nginx_log.conf \
44 python.d/ovpn_status_log.conf \
45 python.d/phpfpm.conf \
46 python.d/postfix.conf \
python.d/Makefile.am
-2
@@ -19,7 +19,6 @@ dist_python_SCRIPTS = \
19 exim.chart.py \
20 fail2ban.chart.py \
21 freeradius.chart.py \
22 - gunicorn_log.chart.py \
22 haproxy.chart.py \
23 hddtemp.chart.py \
24 ipfs.chart.py \
@@ -28,7 +27,6 @@ dist_python_SCRIPTS = \
27 memcached.chart.py \
28 mysql.chart.py \
29 nginx.chart.py \
31 - nginx_log.chart.py \
30 ovpn_status_log.chart.py \
31 phpfpm.chart.py \
32 postfix.chart.py \
python.d/gunicorn_log.chart.py deleted
-72
@@ -1,72 +0,0 @@
1 -# -*- coding: utf-8 -*-
2 -# Description: nginx log netdata python.d module
3 -# Author: Pawel Krupa (paulfantom)
4 -# Modified for Gunicorn by: Jeff Willette (deltaskelta)
5 -
6 -from base import LogService
7 -import re
8 -
9 -priority = 60000
10 -retries = 60
11 -# update_every = 3
12 -
13 -ORDER = ['codes']
14 -CHARTS = {
15 - 'codes': {
16 - 'options': [None, 'gunicorn status codes', 'requests/s', 'requests', 'gunicorn_log.codes', 'stacked'],
17 - 'lines': [
18 - ["2xx", None, "incremental"],
19 - ["3xx", None, "incremental"],
20 - ["4xx", None, "incremental"],
21 - ["5xx", None, "incremental"]
22 - ]}
23 -}
24 -
25 -
26 -class Service(LogService):
27 - def __init__(self, configuration=None, name=None):
28 - LogService.__init__(self, configuration=configuration, name=name)
29 - if len(self.log_path) == 0:
30 - self.log_path = "/var/log/gunicorn/access.log"
31 - self.order = ORDER
32 - self.definitions = CHARTS
33 - pattern = r'" ([0-9]{3}) '
34 - #pattern = r'(?:" )([0-9][0-9][0-9]) ?'
35 - self.regex = re.compile(pattern)
36 -
37 - def _get_data(self):
38 - """
39 - Parse new log lines
40 - :return: dict
41 - """
42 - data = {'2xx': 0,
43 - '3xx': 0,
44 - '4xx': 0,
45 - '5xx': 0}
46 - try:
47 - raw = self._get_raw_data()
48 - if raw is None:
49 - return None
50 - elif not raw:
51 - return data
52 - except (ValueError, AttributeError):
53 - return None
54 -
55 - regex = self.regex
56 - for line in raw:
57 - code = regex.search(line)
58 - try:
59 - beginning = code.group(1)[0]
60 - except AttributeError:
61 - continue
62 -
63 - if beginning == '2':
64 - data["2xx"] += 1
65 - elif beginning == '3':
66 - data["3xx"] += 1
67 - elif beginning == '4':
68 - data["4xx"] += 1
69 - elif beginning == '5':
70 - data["5xx"] += 1
71 -
72 - return data
python.d/nginx_log.chart.py deleted
-82
@@ -1,82 +0,0 @@
1 -# -*- coding: utf-8 -*-
2 -# Description: nginx log netdata python.d module
3 -# Author: Pawel Krupa (paulfantom)
4 -
5 -from base import LogService
6 -import re
7 -
8 -priority = 60000
9 -retries = 60
10 -# update_every = 3
11 -
12 -ORDER = ['codes']
13 -CHARTS = {
14 - 'codes': {
15 - 'options': [None, 'nginx status codes', 'requests/s', 'requests', 'nginx_log.codes', 'stacked'],
16 - 'lines': [
17 - ["2xx", None, "incremental"],
18 - ["5xx", None, "incremental"],
19 - ["3xx", None, "incremental"],
20 - ["4xx", None, "incremental"],
21 - ["1xx", None, "incremental"],
22 - ["other", None, "incremental"]
23 - ]}
24 -}
25 -
26 -
27 -class Service(LogService):
28 - def __init__(self, configuration=None, name=None):
29 - LogService.__init__(self, configuration=configuration, name=name)
30 - if len(self.log_path) == 0:
31 - self.log_path = "/var/log/nginx/access.log"
32 - self.order = ORDER
33 - self.definitions = CHARTS
34 - pattern = r'" ([0-9]{3}) ?'
35 - #pattern = r'(?:" )([0-9][0-9][0-9]) ?'
36 - self.regex = re.compile(pattern)
37 -
38 - self.data = {
39 - '1xx': 0,
40 - '2xx': 0,
41 - '3xx': 0,
42 - '4xx': 0,
43 - '5xx': 0,
44 - 'other': 0
45 - }
46 -
47 - def _get_data(self):
48 - """
49 - Parse new log lines
50 - :return: dict
51 - """
52 - try:
53 - raw = self._get_raw_data()
54 - if raw is None:
55 - return None
56 - elif not raw:
57 - return self.data
58 - except (ValueError, AttributeError):
59 - return None
60 -
61 - regex = self.regex
62 - for line in raw:
63 - code = regex.search(line)
64 - try:
65 - beginning = code.group(1)[0]
66 - except AttributeError:
67 - continue
68 -
69 - if beginning == '2':
70 - self.data["2xx"] += 1
71 - elif beginning == '3':
72 - self.data["3xx"] += 1
73 - elif beginning == '4':
74 - self.data["4xx"] += 1
75 - elif beginning == '5':
76 - self.data["5xx"] += 1
77 - elif beginning == '1':
78 - self.data["1xx"] += 1
79 - else:
80 - self.data["other"] += 1
81 -
82 - return self.data