@cryptotaxi247 / netdata-1 / commits / 6c3c76369

Added support for dnsdist

nobody-nobody committed Nov 13, 2017 at 21:15 UTC 6c3c76369792e17701a04a42d2e17e2c6109af8e
2 files changed +181
conf.d/python.d/dnsdist.conf new
+85
@@ -0,0 +1,85 @@
1 +# netdata python.d.plugin configuration for dnsdist
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: 600000
35 +
36 +# autodetection_retry sets the job re-check interval in seconds.
37 +# The job is not deleted if check fails.
38 +# Attempts to start the job are made once every autodetection_retry.
39 +# This feature is disabled by default.
40 +#autodetection_retry: 1
41 +
42 +# ----------------------------------------------------------------------
43 +# JOBS (data collection sources)
44 +#
45 +# The default JOBS share the same *name*. JOBS with the same name
46 +# are mutually exclusive. Only one of them will be allowed running at
47 +# any time. This allows autodetection to try several alternatives and
48 +# pick the one that works.
49 +#
50 +# Any number of jobs is supported.
51 +#
52 +# All python.d.plugin JOBS (for all its modules) support a set of
53 +# predefined parameters. These are:
54 +#
55 +# job_name:
56 +# name: myname # the JOB's name as it will appear at the
57 +# # dashboard (by default is the job_name)
58 +# # JOBs sharing a name are mutually exclusive
59 +# update_every: 1 # the JOB's data collection frequency
60 +# priority: 60000 # the JOB's order on the dashboard
61 +# retries: 60 # the JOB's number of restoration attempts
62 +# autodetection_retry: 0 # the JOB's re-check interval in seconds
63 +#
64 +#
65 +# Additionally to the above, dnsdist also supports the following:
66 +#
67 +# url: 'URL' # the URL to fetch dnsdist performance statistics
68 +# user: 'username' # username for basic auth
69 +# pass: 'password' # password for basic auth
70 +# header:
71 +# X-API-Key: 'Key' # API key
72 +#
73 +# ----------------------------------------------------------------------
74 +# AUTO-DETECTION JOBS
75 +# only one of them will run (they have the same name)
76 +
77 +# localhost:
78 +# name : 'local'
79 +# url : 'http://127.0.0.1:5053/jsonstat?command=stats'
80 +# user : 'username'
81 +# pass : 'password'
82 +# header:
83 +# X-API-Key: 'dnsdist-api-key'
84 +
85 +
python.d/dnsdist.chart.py new
+96
@@ -0,0 +1,96 @@
1 +# -*- coding: utf-8 -*-
2 +from json import loads
3 +from bases.FrameworkServices.UrlService import UrlService
4 +
5 +ORDER = ['latency_rel', 'latency_abs', 'cache_rel', 'cache_abs', 'acl_abs', 'invalid_abs', 'queries_rel', 'queries_abs', 'health_abs']
6 +CHARTS = {
7 + 'latency_rel': {
8 + 'options': [None, 'Average latency', 'value', 'Latency', 'dnsdist.latency_rel', 'area'],
9 + 'lines': [
10 + ['latency-slow', '> 1sec', 'incremental'],
11 + ['latency100-1000', '100-1000ms', 'incremental'],
12 + ['latency50-100', '50-100ms', 'incremental'],
13 + ['latency10-50', '10-50ms', 'incremental'],
14 + ['latency1-10', '1-10ms', 'incremental'],
15 + ['latency0-1', '< 1ms', 'incremental']
16 + ]},
17 + 'latency_abs': {
18 + 'options': [None, 'Absolute latency', 'value', 'Latency', 'dnsdist.latency_abs', 'line'],
19 + 'lines': [
20 + ['latency-slow', '> 1sec', 'absolute'],
21 + ['latency100-1000', '100-1000ms', 'absolute'],
22 + ['latency50-100', '50-100ms', 'absolute'],
23 + ['latency10-50', '10-50ms', 'absolute'],
24 + ['latency1-10', '1-10ms', 'absolute'],
25 + ['latency0-1', '< 1ms', 'absolute']
26 + ]},
27 + 'cache_rel': {
28 + 'options': [None, 'Relative cache stats', 'value', 'Cache', 'dnsdist.cache_rel', 'area'],
29 + 'lines': [
30 + ['cache-hits', 'hits', 'incremental'],
31 + ['cache-misses', 'misses', 'incremental']
32 + ]},
33 + 'cache_abs': {
34 + 'options': [None, 'Absolute cache stats', 'value', 'Cache', 'dnsdist.cache_abs', 'area'],
35 + 'lines': [
36 + ['cache-hits', 'hits', 'absolute'],
37 + ['cache-misses', 'misses', 'absolute']
38 + ]},
39 + 'acl_abs': {
40 + 'options': [None, 'AccessControlList stats', 'value', 'ACL', 'dnsdist.acl_abs', 'line'],
41 + 'lines': [
42 + ['acl-drops', 'drop by acl', 'absolute'],
43 + ['rule-drop', 'drop by rule', 'absolute'],
44 + ['rule-nxdomain', 'rnxdomain by rule', 'absolute'],
45 + ['rule-refused', 'refused by rule', 'absolute']
46 + ]},
47 + 'noncompliant_abs': {
48 + 'options': [None, 'Noncompliant data', 'value', 'Invalid', 'dnsdist.noncompliant_abs', 'line'],
49 + 'lines': [
50 + ['empty-queries', 'empty queries', 'absolute'],
51 + ['no-policy', 'no policy', 'absolute'],
52 + ['noncompliant-queries', 'noncompliant queries', 'absolute'],
53 + ['noncompliant-responses', 'noncompliant responses', 'absolute']
54 + ]},
55 + 'queries_rel': {
56 + 'options': [None, 'Relative query stats', 'value', 'Queries', 'dnsdist.queries_rel', 'line'],
57 + 'lines': [
58 + ['queries', 'queries', 'incremental'],
59 + ['rdqueries', 'rd queries', 'incremental'],
60 + ['responses', 'responses', 'incremental']
61 + ]},
62 + 'queries_abs': {
63 + 'options': [None, 'Absolute query stats', 'value', 'Queries', 'dnsdist.queries_abs', 'line'],
64 + 'lines': [
65 + ['queries', 'queries', 'absolute'],
66 + ['rdqueries', 'rd queries', 'absolute'],
67 + ['responses', 'responses', 'absolute']
68 + ]},
69 + 'health_abs': {
70 + 'options': [None, 'Health', 'value', 'Health', 'dnsdist.health_abs', 'line'],
71 + 'lines': [
72 + ['downstream-send-errors', 'ds send errors', 'absolute'],
73 + ['downstream-timeouts', 'ds timeouts', 'absolute'],
74 + ['servfail-responses', 'servfail responses', 'absolute'],
75 + ['trunc-failures', 'trunc failures', 'absolute']
76 + ]}
77 +}
78 +
79 +class Service(UrlService):
80 + def __init__(self, configuration=None, name=None):
81 + UrlService.__init__(self, configuration=configuration, name=name)
82 + self.order = ORDER
83 + self.definitions = CHARTS
84 +
85 + def _get_data(self):
86 + data = self._get_raw_data()
87 + if not data:
88 + return None
89 +
90 + rdict = dict()
91 + jdata = loads(data)
92 + for d in jdata:
93 + rdict[str(d)] = jdata[str(d)]
94 +
95 + return rdict
96 +