mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-21 18:41:03 +00:00
Merge pull request #1369 from codeurimpulsif/icecast2_stats_
[icecast2_stats_] Fix sources parsing if there is only one source
This commit is contained in:
commit
5b9b75e5b0
1 changed files with 9 additions and 1 deletions
|
@ -108,9 +108,17 @@ def _get_json_statistics():
|
||||||
|
|
||||||
def get_sources():
|
def get_sources():
|
||||||
sources = []
|
sources = []
|
||||||
for source in _get_json_statistics()["icestats"]["source"]:
|
if type(_get_json_statistics()["icestats"]["source"]) == dict:
|
||||||
|
source = _get_json_statistics()["icestats"]["source"]
|
||||||
path_name = source["listenurl"].split("/")[-1]
|
path_name = source["listenurl"].split("/")[-1]
|
||||||
sources.append({"name": path_name,
|
sources.append({"name": path_name,
|
||||||
|
"fieldname": clean_fieldname(path_name),
|
||||||
|
"listeners": source["listeners"],
|
||||||
|
"duration_days": get_iso8601_age_days(source["stream_start_iso8601"])})
|
||||||
|
else:
|
||||||
|
for source in _get_json_statistics()["icestats"]["source"]:
|
||||||
|
path_name = source["listenurl"].split("/")[-1]
|
||||||
|
sources.append({"name": path_name,
|
||||||
"fieldname": clean_fieldname(path_name),
|
"fieldname": clean_fieldname(path_name),
|
||||||
"listeners": source["listeners"],
|
"listeners": source["listeners"],
|
||||||
"duration_days": get_iso8601_age_days(source["stream_start_iso8601"])})
|
"duration_days": get_iso8601_age_days(source["stream_start_iso8601"])})
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue