Icecast Exporter
Icecast Exporter exports statistics from Icecast into Prometheus.
We use this at University Radio Nottingham for pulling statistics from our web streaming into a Grafana instance which is used to find listener counts in time-series.
Install
Ensure you have a working Go installation (minimum 1.18) and run the following:
$ go install github.com/jb3/icecast-exporter@latest
Once installed, you will find the compiled binary at /home/user/go/bin/icecast-exporter
.
Usage
Once you have a binary, you can use the program with the following command line flags:
Flag | Default | Required | Description |
---|---|---|---|
url | N/A | ✅ | The URL of the Icecast status-json.xsl endpoint to poll from. |
port | 2112 | ❌ | The port to listen and serve metrics from. |
endpoint | /metrics | ❌ | Endpoint to serve metrics from. |
interval | 15 | ❌ | Timing interval to poll Icecast (seconds). |
An example invocation is as follows:
$ ./icecast-exporter -url https://icecast.example.com/status-json.xsl -port 1234
Running in the background
An example FreeBSD rc.d
service might look like:
#!/bin/sh
. /etc/rc.subr
name="icecast_exporter"
rcvar="icecast_exporter_enable"
pidfile="/var/run/icecast_exporter.pid"
command="/usr/sbin/daemon"
command_args="-P ${pidfile} -r -t icecast_exporter /home/joe/go/bin/icecast-exporter -url https://icecast.example.com/status-json.xsl"
load_rc_config $name
run_rc_command "$1"
Once this file has been edited and placed in `/usr/local/etc/rc.d/icecast-exporter` (and set to executable), run:
# Enable the Icecast Exporter service
$ sysrc icecast_exporter_enable=YES
# Start the Icecast Exporter service
$ service iceast_exporter start
License
This project is licensed under MIT.