diff options
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/dns_query_time/Makefile.inc | 13 | ||||
-rw-r--r-- | collectors/python.d.plugin/dns_query_time/README.md | 10 | ||||
-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 | ||||
-rw-r--r-- | collectors/python.d.plugin/dns_query_time/dns_query_time.conf (renamed from conf.d/python.d/dns_query_time.conf) | 0 |
4 files changed, 42 insertions, 8 deletions
diff --git a/collectors/python.d.plugin/dns_query_time/Makefile.inc b/collectors/python.d.plugin/dns_query_time/Makefile.inc new file mode 100644 index 000000000..7eca3e0b6 --- /dev/null +++ b/collectors/python.d.plugin/dns_query_time/Makefile.inc @@ -0,0 +1,13 @@ +# SPDX-License-Identifier: GPL-3.0-or-later + +# THIS IS NOT A COMPLETE Makefile +# IT IS INCLUDED BY ITS PARENT'S Makefile.am +# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT + +# install these files +dist_python_DATA += dns_query_time/dns_query_time.chart.py +dist_pythonconfig_DATA += dns_query_time/dns_query_time.conf + +# do not install these files, but include them in the distribution +dist_noinst_DATA += dns_query_time/README.md dns_query_time/Makefile.inc + diff --git a/collectors/python.d.plugin/dns_query_time/README.md b/collectors/python.d.plugin/dns_query_time/README.md new file mode 100644 index 000000000..3703e8aaf --- /dev/null +++ b/collectors/python.d.plugin/dns_query_time/README.md @@ -0,0 +1,10 @@ +# dns_query_time + +This module provides DNS query time statistics. + +**Requirement:** +* `python-dnspython` package + +It produces one aggregate chart or one chart per DNS server, showing the query time. + +--- 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 diff --git a/conf.d/python.d/dns_query_time.conf b/collectors/python.d.plugin/dns_query_time/dns_query_time.conf index d32c6db83..d32c6db83 100644 --- a/conf.d/python.d/dns_query_time.conf +++ b/collectors/python.d.plugin/dns_query_time/dns_query_time.conf |