@cryptotaxi247 / netdata-1 / commits / 46384503a

apache_cache module deleted (replaced by web_log)

lgz committed Oct 27, 2017 at 20:21 UTC 46384503a58f8fa75919b9be9052bdf1cbb1b562
4 files changed -138
conf.d/Makefile.am
-1
@@ -27,7 +27,6 @@ dist_nodeconfig_DATA = \
27 pythonconfigdir=$(configdir)/python.d
28 dist_pythonconfig_DATA = \
29 python.d/apache.conf \
30 - python.d/apache_cache.conf \
30 python.d/bind_rndc.conf \
31 python.d/chrony.conf \
32 python.d/couchdb.conf \
conf.d/python.d/apache_cache.conf deleted
-76
@@ -1,76 +0,0 @@
1 -# netdata python.d.plugin configuration for apache cache
2 -#
3 -# This file is in YaML format. Generally the format is:
4 -#
5 -# name: value
6 -#
7 -# There are 2 sections:
8 -# - global variables
9 -# - one or more JOBS
10 -#
11 -# JOBS allow you to collect values from multiple sources.
12 -# Each source will have its own set of charts.
13 -#
14 -# JOB parameters have to be indented (using spaces only, example below).
15 -
16 -# ----------------------------------------------------------------------
17 -# Global Variables
18 -# These variables set the defaults for all JOBs, however each JOB
19 -# may define its own, overriding the defaults.
20 -
21 -# update_every sets the default data collection frequency.
22 -# If unset, the python.d.plugin default is used.
23 -# update_every: 1
24 -
25 -# priority controls the order of charts at the netdata dashboard.
26 -# Lower numbers move the charts towards the top of the page.
27 -# If unset, the default for python.d.plugin is used.
28 -# priority: 60000
29 -
30 -# retries sets the number of retries to be made in case of failures.
31 -# If unset, the default for python.d.plugin is used.
32 -# Attempts to restore the service are made once every update_every
33 -# and only if the module has collected values in the past.
34 -# retries: 5
35 -
36 -# ----------------------------------------------------------------------
37 -# JOBS (data collection sources)
38 -#
39 -# The default JOBS share the same *name*. JOBS with the same name
40 -# are mutually exclusive. Only one of them will be allowed running at
41 -# any time. This allows autodetection to try several alternatives and
42 -# pick the one that works.
43 -#
44 -# Any number of jobs is supported.
45 -#
46 -# All python.d.plugin JOBS (for all its modules) support a set of
47 -# predefined parameters. These are:
48 -#
49 -# job_name:
50 -# name: myname # the JOB's name as it will appear at the
51 -# # dashboard (by default is the job_name)
52 -# # JOBs sharing a name are mutually exclusive
53 -# update_every: 1 # the JOB's data collection frequency
54 -# priority: 60000 # the JOB's order on the dashboard
55 -# retries: 5 # the JOB's number of restoration attempts
56 -#
57 -# Additionally to the above, apache_cache also supports the following:
58 -#
59 -# path: 'PATH' # the path to apache's cache.log
60 -#
61 -
62 -# ----------------------------------------------------------------------
63 -# AUTO-DETECTION JOBS
64 -# only one of them will run (they have the same name)
65 -
66 -apache:
67 - name: 'local'
68 - path: '/var/log/apache/cache.log'
69 -
70 -apache2:
71 - name: 'local'
72 - path: '/var/log/apache2/cache.log'
73 -
74 -httpd:
75 - name: 'local'
76 - path: '/var/log/httpd/cache.log'
python.d/Makefile.am
-1
@@ -14,7 +14,6 @@ dist_python_SCRIPTS = \
14 dist_python_DATA = \
15 README.md \
16 apache.chart.py \
17 - apache_cache.chart.py \
17 bind_rndc.chart.py \
18 chrony.chart.py \
19 couchdb.chart.py \
python.d/apache_cache.chart.py deleted
-60
@@ -1,60 +0,0 @@
1 -# -*- coding: utf-8 -*-
2 -# Description: apache cache netdata python.d module
3 -# Author: Pawel Krupa (paulfantom)
4 -
5 -from base import LogService
6 -
7 -priority = 60000
8 -retries = 60
9 -# update_every = 3
10 -
11 -ORDER = ['cache']
12 -CHARTS = {
13 - 'cache': {
14 - 'options': [None, 'apache cached responses', 'percent cached', 'cached', 'apache_cache.cache', 'stacked'],
15 - 'lines': [
16 - ["hit", 'cache', "percentage-of-absolute-row"],
17 - ["miss", None, "percentage-of-absolute-row"],
18 - ["other", None, "percentage-of-absolute-row"]
19 - ]}
20 -}
21 -
22 -
23 -class Service(LogService):
24 - def __init__(self, configuration=None, name=None):
25 - LogService.__init__(self, configuration=configuration, name=name)
26 - if len(self.log_path) == 0:
27 - self.log_path = "/var/log/apache2/cache.log"
28 - self.order = ORDER
29 - self.definitions = CHARTS
30 -
31 - def _get_data(self):
32 - """
33 - Parse new log lines
34 - :return: dict
35 - """
36 - try:
37 - raw = self._get_raw_data()
38 - if raw is None:
39 - return None
40 - elif not raw:
41 - return {'hit': 0,
42 - 'miss': 0,
43 - 'other': 0}
44 - except (ValueError, AttributeError):
45 - return None
46 -
47 - hit = 0
48 - miss = 0
49 - other = 0
50 - for line in raw:
51 - if "cache hit" in line:
52 - hit += 1
53 - elif "cache miss" in line:
54 - miss += 1
55 - else:
56 - other += 1
57 -
58 - return {'hit': hit,
59 - 'miss': miss,
60 - 'other': other}