diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:19:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2018-11-07 12:20:17 +0000 |
commit | a64a253794ac64cb40befee54db53bde17dd0d49 (patch) | |
tree | c1024acc5f6e508814b944d99f112259bb28b1be /collectors/python.d.plugin/icecast/icecast.chart.py | |
parent | New upstream version 1.10.0+dfsg (diff) | |
download | netdata-upstream/1.11.0+dfsg.tar.xz netdata-upstream/1.11.0+dfsg.zip |
New upstream version 1.11.0+dfsgupstream/1.11.0+dfsg
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
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] |