Sign inSign up

vladios13/icecast_exporter

By vladios13

•Updated 3 months ago

Icecast exporter for Prometheus

Image
Developer tools
Monitoring & observability
0

105

vladios13/icecast_exporter repository overview

⁠Icecast exporter for Prometheus

License Go Docker Prometheus Platform

A Prometheus⁠ exporter for the Icecast⁠ streaming media server. Requires the JSON API (/status-json.xsl) provided by Icecast 2.4.0 or newer.

A modernized fork of markuslindenberg/icecast_exporter⁠ by Markus Lindenberg (Apache License 2.0).

By default the exporter listens on port 9146.

⁠Quick start

docker pull vladios13/icecast_exporter
docker run --rm -p 9146:9146 vladios13/icecast_exporter \
  -icecast.scrape-uri http://192.168.10.1:9804/status-json.xsl

Then check http://localhost:9146/metrics.

⁠What's changed in this fork

  • Fixed the crash Can't read JSON: invalid character ' ' in numeric literal — Icecast can emit invalid JSON like "bitrate": 128 kbps; the response is now sanitized before parsing.
  • Modern Go module (Go 1.24+), current dependencies, log/slog.
  • Handles any form of the source field: array, single object, or absent.
  • New metrics: total listeners, listener peak, bitrate, source count, server info. All original metrics are unchanged.
  • Graceful shutdown and a /healthz endpoint.
  • Multi-stage Docker build with a minimal scratch image.
  • Unit and integration tests.

⁠Building

⁠With Docker
docker build -t icecast_exporter .
⁠Without Docker

Requires Go 1.24+:

go build -o icecast_exporter .
go test ./...

⁠Running

⁠With docker compose

Set your Icecast URL in docker-compose.yml, then:

docker compose up -d

The service is limited to 64 MB of RAM, restarts automatically (restart: unless-stopped) and has a built-in healthcheck.

⁠With docker run
docker run -d --rm -p 9146:9146 icecast_exporter \
  -icecast.scrape-uri http://192.168.10.1:9804/status-json.xsl

Then check http://localhost:9146/metrics.

⁠Flags
Usage of ./icecast_exporter:
  -healthcheck
        Check a running exporter instance and exit (for use as a container healthcheck).
  -icecast.scrape-uri string
        URI on which to scrape Icecast. (default "http://localhost:8000/status-json.xsl")
  -icecast.timeout duration
        Timeout for trying to get stats from Icecast. (default 5s)
  -web.listen-address string
        Address to listen on for web interface and telemetry. (default ":9146")
  -web.telemetry-path string
        Path under which to expose metrics. (default "/metrics")
⁠Endpoints
PathDescription
/metricsPrometheus metrics
/healthzLiveness check, returns 200 ok
/Landing page with a link to metrics

⁠Prometheus configuration

scrape_configs:
  - job_name: icecast
    static_configs:
      - targets: ["icecast-exporter:9146"]

⁠Metrics

MetricTypeLabelsDescription
icecast_upgauge—Was the last scrape of Icecast successful (1/0).
icecast_exporter_total_scrapescounter—Total Icecast scrapes.
icecast_exporter_json_parse_failurescounter—Number of JSON parse errors.
icecast_server_startgauge—Timestamp (unix) of server startup.
icecast_listenersgaugelistenurl, server_typeListeners per mount point.
icecast_stream_startgaugelistenurl, server_typeTimestamp (unix) when the source connected.
icecast_listeners_totalgauge—Total listeners across all mount points. (new)
icecast_listener_peakgaugelistenurl, server_typePeak listeners per mount point. (new)
icecast_bitrategaugelistenurl, server_typeSource bitrate (kbps). (new)
icecast_source_countgauge—Number of active sources. (new)
icecast_server_infogaugeserver_id, host, locationServer information; constant 1. (new)

Fields not reported by the server are not exported.

Tag summary

Content type

Image

Digest

sha256:d2698b6c0…

Size

4.3 MB

Last updated

3 months ago

docker pull vladios13/icecast_exporter