summaryrefslogtreecommitdiffstats
path: root/python.d/dns_query_time.chart.py
diff options
context:
space:
mode:
Diffstat (limited to 'python.d/dns_query_time.chart.py')
-rw-r--r--python.d/dns_query_time.chart.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/python.d/dns_query_time.chart.py b/python.d/dns_query_time.chart.py
index 9053d9a1b..9a794a9c9 100644
--- a/python.d/dns_query_time.chart.py
+++ b/python.d/dns_query_time.chart.py
@@ -2,6 +2,10 @@
# Description: dns_query_time netdata python.d module
# Author: l2isbad
+from random import choice
+from threading import Thread
+from socket import getaddrinfo, gaierror
+
try:
from time import monotonic as time
except ImportError:
@@ -15,10 +19,8 @@ try:
from queue import Queue
except ImportError:
from Queue import Queue
-from random import choice
-from threading import Thread
-from socket import gethostbyname, gaierror
-from base import SimpleService
+
+from bases.FrameworkServices.SimpleService import SimpleService
# default module values (can be overridden per job in `config`)
@@ -43,7 +45,6 @@ class Service(SimpleService):
return False
self.timeout = self.timeout if isinstance(self.timeout, int) else 4
- self.update_every = self.timeout + 1 if self.update_every <= self.timeout else self.update_every
if not all([self.domains, self.server_list,
isinstance(self.server_list, str), isinstance(self.domains, str)]):
@@ -69,9 +70,7 @@ class Service(SimpleService):
if not self.server_list:
return False
- self._data_from_check = data
self.order, self.definitions = create_charts(aggregate=self.aggregate, server_list=self.server_list)
- self.info(str({'domains': len(self.domains), 'servers': self.server_list}))
return True
def _get_data(self, timeout=None):
@@ -110,7 +109,7 @@ def dns_request(server_list, timeout, domains):
def check_ns(ns):
try:
- return gethostbyname(ns)
+ return getaddrinfo(ns, 'domain')[0][4][0]
except gaierror:
return False