diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-upstream/1.11.0+dfsg.tar.xz netdata-upstream/1.11.0+dfsg.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py (renamed from python.d/dns_query_time.chart.py) | 27 |
1 files changed, 19 insertions, 8 deletions
diff --git a/python.d/dns_query_time.chart.py b/collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py index 9a794a9c9..d3c3db788 100644 --- a/python.d/dns_query_time.chart.py +++ b/collectors/python.d.plugin/dns_query_time/dns_query_time.chart.py @@ -1,20 +1,25 @@ # -*- coding: utf-8 -*- # Description: dns_query_time netdata python.d module # Author: l2isbad +# SPDX-License-Identifier: GPL-3.0-or-later from random import choice -from threading import Thread from socket import getaddrinfo, gaierror +from threading import Thread try: from time import monotonic as time except ImportError: from time import time + try: - import dns.message, dns.query, dns.name + import dns.message + import dns.query + import dns.name DNS_PYTHON = True except ImportError: DNS_PYTHON = False + try: from queue import Queue except ImportError: @@ -117,8 +122,12 @@ def check_ns(ns): def create_charts(aggregate, server_list): if aggregate: order = ['dns_group'] - definitions = {'dns_group': {'options': [None, 'DNS Response Time', 'ms', 'name servers', - 'dns_query_time.response_time', 'line'], 'lines': []}} + definitions = { + 'dns_group': { + 'options': [None, 'DNS Response Time', 'ms', 'name servers', 'dns_query_time.response_time', 'line'], + 'lines': [] + } + } for ns in server_list: definitions['dns_group']['lines'].append(['_'.join(['ns', ns.replace('.', '_')]), ns, 'absolute']) @@ -127,8 +136,10 @@ def create_charts(aggregate, server_list): order = [''.join(['dns_', ns.replace('.', '_')]) for ns in server_list] definitions = dict() for ns in server_list: - definitions[''.join(['dns_', ns.replace('.', '_')])] = {'options': [None, 'DNS Response Time', 'ms', ns, - 'dns_query_time.response_time', 'area'], - 'lines': [['_'.join(['ns', ns.replace('.', '_')]), - ns, 'absolute']]} + definitions[''.join(['dns_', ns.replace('.', '_')])] = { + 'options': [None, 'DNS Response Time', 'ms', ns, 'dns_query_time.response_time', 'area'], + 'lines': [ + ['_'.join(['ns', ns.replace('.', '_')]), ns, 'absolute'] + ] + } return order, definitions |