summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/unbound
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2019-08-04 08:56:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2019-08-04 08:56:44 +0000
commit34f488f41ee820371159111bf621f11d0f54f669 (patch)
tree13eea1c3aa3d905ec929691bbf23d8b90bef1dcb /collectors/python.d.plugin/unbound
parentAdding upstream version 1.16.0. (diff)
downloadnetdata-34f488f41ee820371159111bf621f11d0f54f669.tar.xz
netdata-34f488f41ee820371159111bf621f11d0f54f669.zip
Adding upstream version 1.16.1.upstream/1.16.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'collectors/python.d.plugin/unbound')
-rw-r--r--collectors/python.d.plugin/unbound/unbound.chart.py37
1 files changed, 22 insertions, 15 deletions
diff --git a/collectors/python.d.plugin/unbound/unbound.chart.py b/collectors/python.d.plugin/unbound/unbound.chart.py
index dade2b204..6e5a22c58 100644
--- a/collectors/python.d.plugin/unbound/unbound.chart.py
+++ b/collectors/python.d.plugin/unbound/unbound.chart.py
@@ -253,15 +253,19 @@ class Service(SocketService):
else:
self.request = b'UBCT1 status\n'
raw = self._get_raw_data()
- for line in raw.splitlines():
- if line.startswith('threads'):
- self.threads = int(line.split()[1])
- self._generate_perthread_charts()
- break
- if self.threads is None:
- self.info('Unable to auto-detect thread counts, disabling per-thread stats.')
- self.perthread = False
- self.request = tmp
+ if raw is None:
+ result = False
+ self.warning('Received no data from socket.')
+ else:
+ for line in raw.splitlines():
+ if line.startswith('threads'):
+ self.threads = int(line.split()[1])
+ self._generate_perthread_charts()
+ break
+ if self.threads is None:
+ self.info('Unable to auto-detect thread counts, disabling per-thread stats.')
+ self.perthread = False
+ self.request = tmp
return result
@staticmethod
@@ -274,10 +278,13 @@ class Service(SocketService):
raw = self._get_raw_data()
data = dict()
tmp = dict()
- for line in raw.splitlines():
- stat = line.split('=')
- tmp[stat[0]] = stat[1]
- for item in self.statmap:
- if item in tmp:
- data[self.statmap[item][0]] = float(tmp[item]) * self.statmap[item][1]
+ if raw is not None:
+ for line in raw.splitlines():
+ stat = line.split('=')
+ tmp[stat[0]] = stat[1]
+ for item in self.statmap:
+ if item in tmp:
+ data[self.statmap[item][0]] = float(tmp[item]) * self.statmap[item][1]
+ else:
+ self.warning('Received no data from socket.')
return data