summaryrefslogtreecommitdiffstats
path: root/python.d/icecast.chart.py
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--collectors/python.d.plugin/icecast/icecast.chart.py (renamed from python.d/icecast.chart.py)15
1 files changed, 10 insertions, 5 deletions
diff --git a/python.d/icecast.chart.py b/collectors/python.d.plugin/icecast/icecast.chart.py
index 792b99f3f..d8813f9ba 100644
--- a/python.d/icecast.chart.py
+++ b/collectors/python.d.plugin/icecast/icecast.chart.py
@@ -1,6 +1,7 @@
# -*- coding: utf-8 -*-
# Description: icecast netdata python.d module
# Author: Ilya Mashchenko (l2isbad)
+# SPDX-License-Identifier: GPL-3.0-or-later
import json
@@ -15,10 +16,10 @@ ORDER = ['listeners']
CHARTS = {
'listeners': {
- 'options': [None, 'Number Of Listeners', 'listeners',
- 'listeners', 'icecast.listeners', 'line'],
+ 'options': [None, 'Number Of Listeners', 'listeners', 'listeners', 'icecast.listeners', 'line'],
'lines': [
- ]}
+ ]
+ }
}
@@ -86,7 +87,11 @@ class Service(UrlService):
try:
data = json.loads(raw_data)
except ValueError as error:
- self.error("JSON decode error:", error)
+ self.error('JSON decode error:', error)
return None
- return data['icestats'].get('source')
+ sources = data['icestats'].get('source')
+ if not sources:
+ return None
+
+ return sources if isinstance(sources, list) else [sources]