icecast-exporter

A Prometheus Exporter for Icecast

MIT License

Stars
4

#+TITLE: Icecast Exporter

Icecast Exporter exports statistics from Icecast into Prometheus.

We use this at [[https://urn1350.net/][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:

#+BEGIN_SRC $ go install github.com/jb3/icecast-exporter@latest #+END_SRC

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:

#+BEGIN_SRC bash $ ./icecast-exporter -url https://icecast.example.com/status-json.xsl -port 1234 #+END_SRC

** Running in the background

An example FreeBSD rc.d service might look like:

#+BEGIN_SRC shell #!/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" #+END_SRC

Once this file has been edited and placed in /usr/local/etc/rc.d/icecast-exporter (and set to executable), run:

#+BEGIN_SRC shell

Enable the Icecast Exporter service

$ sysrc icecast_exporter_enable=YES

Start the Icecast Exporter service

$ service iceast_exporter start #+END_SRC

** License

This project is licensed under MIT.

Package Rankings
Top 8.17% on Proxy.golang.org