diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-08-04 08:57:13 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2019-08-04 08:57:13 +0000 |
commit | cbf70980c060bde02906a8e9de2064459bacc93c (patch) | |
tree | 5b9ade02e0ed32a4b33f5e8647092d0c02ea586d /collectors/python.d.plugin/unbound/unbound.chart.py | |
parent | Releasing debian version 1.16.0-1. (diff) | |
download | netdata-cbf70980c060bde02906a8e9de2064459bacc93c.tar.xz netdata-cbf70980c060bde02906a8e9de2064459bacc93c.zip |
Merging upstream version 1.16.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | collectors/python.d.plugin/unbound/unbound.chart.py | 37 |
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 |