summaryrefslogtreecommitdiffstats
path: root/collectors/python.d.plugin/icecast
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--collectors/python.d.plugin/icecast/Makefile.inc13
-rw-r--r--collectors/python.d.plugin/icecast/README.md26
-rw-r--r--collectors/python.d.plugin/icecast/icecast.chart.py (renamed from python.d/icecast.chart.py)15
-rw-r--r--collectors/python.d.plugin/icecast/icecast.conf (renamed from conf.d/python.d/icecast.conf)0
4 files changed, 49 insertions, 5 deletions
diff --git a/collectors/python.d.plugin/icecast/Makefile.inc b/collectors/python.d.plugin/icecast/Makefile.inc
new file mode 100644
index 000000000..cb7c6fa0e
--- /dev/null
+++ b/collectors/python.d.plugin/icecast/Makefile.inc
@@ -0,0 +1,13 @@
+# SPDX-License-Identifier: GPL-3.0-or-later
+
+# THIS IS NOT A COMPLETE Makefile
+# IT IS INCLUDED BY ITS PARENT'S Makefile.am
+# IT IS REQUIRED TO REFERENCE ALL FILES RELATIVE TO THE PARENT
+
+# install these files
+dist_python_DATA += icecast/icecast.chart.py
+dist_pythonconfig_DATA += icecast/icecast.conf
+
+# do not install these files, but include them in the distribution
+dist_noinst_DATA += icecast/README.md icecast/Makefile.inc
+
diff --git a/collectors/python.d.plugin/icecast/README.md b/collectors/python.d.plugin/icecast/README.md
new file mode 100644
index 000000000..a28a6c398
--- /dev/null
+++ b/collectors/python.d.plugin/icecast/README.md
@@ -0,0 +1,26 @@
+# icecast
+
+This module will monitor number of listeners for active sources.
+
+**Requirements:**
+ * icecast version >= 2.4.0
+
+It produces the following charts:
+
+1. **Listeners** in listeners
+ * source number
+
+### configuration
+
+Needs only `url` to server's `/status-json.xsl`
+
+Here is an example for remote server:
+
+```yaml
+remote:
+ url : 'http://1.2.3.4:8443/status-json.xsl'
+```
+
+Without configuration, module attempts to connect to `http://localhost:8443/status-json.xsl`
+
+---
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]
diff --git a/conf.d/python.d/icecast.conf b/collectors/python.d.plugin/icecast/icecast.conf
index a900d06d3..a900d06d3 100644
--- a/conf.d/python.d/icecast.conf
+++ b/collectors/python.d.plugin/icecast/icecast.conf