1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
|
# -*- coding: utf-8 -*-
# SPDX-License-Identifier: GPL-3.0-or-later
from json import loads
from bases.FrameworkServices.UrlService import UrlService
ORDER = [
'queries',
'queries_dropped',
'packets_dropped',
'answers',
'backend_responses',
'backend_commerrors',
'backend_errors',
'cache',
'servercpu',
'servermem',
'query_latency',
'query_latency_avg'
]
CHARTS = {
'queries': {
'options': [None, 'Client queries received', 'queries/s', 'queries', 'dnsdist.queries', 'line'],
'lines': [
['queries', 'all', 'incremental'],
['rdqueries', 'recursive', 'incremental'],
['empty-queries', 'empty', 'incremental']
]
},
'queries_dropped': {
'options': [None, 'Client queries dropped', 'queries/s', 'queries', 'dnsdist.queries_dropped', 'line'],
'lines': [
['rule-drop', 'rule drop', 'incremental'],
['dyn-blocked', 'dynamic block', 'incremental'],
['no-policy', 'no policy', 'incremental'],
['noncompliant-queries', 'non compliant', 'incremental']
]
},
'packets_dropped': {
'options': [None, 'Packets dropped', 'packets/s', 'packets', 'dnsdist.packets_dropped', 'line'],
'lines': [
['acl-drops', 'acl', 'incremental']
]
},
'answers': {
'options': [None, 'Answers statistics', 'answers/s', 'answers', 'dnsdist.answers', 'line'],
'lines': [
['self-answered', 'self answered', 'incremental'],
['rule-nxdomain', 'nxdomain', 'incremental', -1],
['rule-refused', 'refused', 'incremental', -1],
['trunc-failures', 'trunc failures', 'incremental', -1]
]
},
'backend_responses': {
'options': [None, 'Backend responses', 'responses/s', 'backends', 'dnsdist.backend_responses', 'line'],
'lines': [
['responses', 'responses', 'incremental']
]
},
'backend_commerrors': {
'options': [None, 'Backend Communication Errors', 'errors/s', 'backends', 'dnsdist.backend_commerrors', 'line'],
'lines': [
['downstream-send-errors', 'send errors', 'incremental']
]
},
'backend_errors': {
'options': [None, 'Backend error responses', 'responses/s', 'backends', 'dnsdist.backend_errors', 'line'],
'lines': [
['downstream-timeouts', 'timeout', 'incremental'],
['servfail-responses', 'servfail', 'incremental'],
['noncompliant-responses', 'non compliant', 'incremental']
]
},
'cache': {
'options': [None, 'Cache performance', 'answers/s', 'cache', 'dnsdist.cache', 'area'],
'lines': [
['cache-hits', 'hits', 'incremental'],
['cache-misses', 'misses', 'incremental', -1]
]
},
'servercpu': {
'options': [None, 'DNSDIST server CPU utilization', 'ms/s', 'server', 'dnsdist.servercpu', 'stacked'],
'lines': [
['cpu-sys-msec', 'system state', 'incremental'],
['cpu-user-msec', 'user state', 'incremental']
]
},
'servermem': {
'options': [None, 'DNSDIST server memory utilization', 'MiB', 'server', 'dnsdist.servermem', 'area'],
'lines': [
['real-memory-usage', 'memory usage', 'absolute', 1, 1 << 20]
]
},
'query_latency': {
'options': [None, 'Query latency', 'queries/s', 'latency', 'dnsdist.query_latency', 'stacked'],
'lines': [
['latency0-1', '1ms', 'incremental'],
['latency1-10', '10ms', 'incremental'],
['latency10-50', '50ms', 'incremental'],
['latency50-100', '100ms', 'incremental'],
['latency100-1000', '1sec', 'incremental'],
['latency-slow', 'slow', 'incremental']
]
},
'query_latency_avg': {
'options': [None, 'Average latency for the last N queries', 'ms/query', 'latency',
'dnsdist.query_latency_avg', 'line'],
'lines': [
['latency-avg100', '100', 'absolute'],
['latency-avg1000', '1k', 'absolute'],
['latency-avg10000', '10k', 'absolute'],
['latency-avg1000000', '1000k', 'absolute']
]
}
}
class Service(UrlService):
def __init__(self, configuration=None, name=None):
UrlService.__init__(self, configuration=configuration, name=name)
self.order = ORDER
self.definitions = CHARTS
def _get_data(self):
data = self._get_raw_data()
if not data:
return None
return loads(data)
|