summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/unbound/unbound.chart.py
diff options
context:
space:
mode:
Diffstat (limited to 'collectors/python.d.plugin/unbound/unbound.chart.py')
-rw-r--r--collectors/python.d.plugin/unbound/unbound.chart.py10
1 files changed, 7 insertions, 3 deletions
diff --git a/collectors/python.d.plugin/unbound/unbound.chart.py b/collectors/python.d.plugin/unbound/unbound.chart.py
index adb58d417..dade2b204 100644
--- a/collectors/python.d.plugin/unbound/unbound.chart.py
+++ b/collectors/python.d.plugin/unbound/unbound.chart.py
@@ -9,7 +9,7 @@ import sys
from copy import deepcopy
from bases.FrameworkServices.SocketService import SocketService
-from bases.loaders import YamlOrderedLoader
+from bases.loaders import load_config
PRECISION = 1000
@@ -169,7 +169,7 @@ def _get_perthread_info(thread):
for key, value in PER_THREAD_STAT_MAP.items():
statmap[key.format(shortname=sname)] = (value[0].format(shortname=sname), value[1])
- return (charts, order, statmap)
+ return charts, order, statmap
class Service(SocketService):
@@ -205,7 +205,11 @@ class Service(SocketService):
def _auto_config(self):
if self.ubconf and os.access(self.ubconf, os.R_OK):
self.debug('Unbound config: {0}'.format(self.ubconf))
- conf = YamlOrderedLoader.load_config_from_file(self.ubconf)[0]
+ conf = dict()
+ try:
+ conf = load_config(self.ubconf)
+ except Exception as error:
+ self.error("error on loading '{0}' : {1}".format(self.ubconf, error))
if self.ext is None:
if 'extended-statistics' in conf['server']:
self.ext = conf['server']['extended-statistics']