powerdns plugin added
Ilya committed
Sep 9, 2017 at 21:35 UTC
4486f2945377b7bd4998c3cd61386d877d422e2b
1 file changed
+58
python.d/powerdns.chart.py
new
+58
@@ -0,0 +1,58 @@
1
+# -*- coding: utf-8 -*-
2
+# Description: powerdns netdata python.d module
3
+# Author: l2isbad
4
+
5
+from base import UrlService
6
+from json import loads
7
+
8
+priority = 60000
9
+retries = 60
10
+# update_every = 3
11
+
12
+ORDER = ['questions', 'cache_usage', 'cache_size', 'latency']
13
+CHARTS = {
14
+ 'questions': {
15
+ 'options': [None, 'PowerDNS Queries and Answers', 'count', 'questions', 'powerdns.questions', 'line'],
16
+ 'lines': [
17
+ ['udp-queries', None, 'incremental'],
18
+ ['udp-answers', None, 'incremental'],
19
+ ['tcp-queries', None, 'incremental'],
20
+ ['tcp-answers', None, 'incremental']
21
+ ]},
22
+ 'cache_usage': {
23
+ 'options': [None, 'PowerDNS Cache Usage', 'count', 'cache', 'powerdns.cache_usage', 'line'],
24
+ 'lines': [
25
+ ['query-cache-hit', None, 'incremental'],
26
+ ['query-cache-miss', None, 'incremental'],
27
+ ['packetcache-hit', 'packet-cache-hit', 'incremental'],
28
+ ['packetcache-miss', 'packet-cache-miss', 'incremental']
29
+ ]},
30
+ 'cache_size': {
31
+ 'options': [None, 'PowerDNS Cache Size', 'count', 'cache', 'powerdns.cache_size', 'line'],
32
+ 'lines': [
33
+ ['query-cache-size', None, 'absolute'],
34
+ ['packetcache-size', 'packet-cache-size', 'absolute'],
35
+ ['key-cache-size', None, 'absolute'],
36
+ ['meta-cache-size', None, 'absolute']
37
+ ]},
38
+ 'latency': {
39
+ 'options': [None, 'PowerDNS Latency', 'microseconds', 'latency', 'powerdns.latency', 'line'],
40
+ 'lines': [
41
+ ['latency', None, 'absolute']
42
+ ]}
43
+
44
+}
45
+
46
+
47
+class Service(UrlService):
48
+ def __init__(self, configuration=None, name=None):
49
+ UrlService.__init__(self, configuration=configuration, name=name)
50
+ self.order = ORDER
51
+ self.definitions = CHARTS
52
+
53
+ def _get_data(self):
54
+ data = self._get_raw_data()
55
+ if not data:
56
+ return None
57
+ return dict([(d['name'], d['value']) for d in loads(data)])
58
+