# Icecast 2 Server Statistics

- Overview
- HTML interface, XSLT generated
- Advanced machine readable data, XSLT generated
- Available raw data

## Overview

Icecast provides extensive run time statistics. Both in the form of active connection numbers and cumulative counters (since server startup or respectively source connection startup).

## HTML interface, XSLT generated

Icecast comes with a basic, XHTML web interface. It exposes a basic set of server statistics that should fulfil basic user needs. If so desired the files in web-root can be customized to contain more or less information (see section on raw XML data below).
We strongly discourage attempts to scrape data from this interface as we do not consider this an API and will change it, even completely, between versions. The preferred ways are custom XSLT, JSON and raw XML.

## Advanced machine readable data, XSLT generated

Icecast uses the very powerful libXSLT engine to transform its internal raw statistical data into custom tailored interfaces. Many people have written custom XSLT code that produces e.g. plain text "now playing", XSPF, VCLT, munin interface data, etc.

Since version 2.4.0 Icecast includes a basic JSON API (/status-json.xsl) based on a xml2json template by Doeke Zanstra (see xml2json.xslt). It exposes a basic set of server statistics that should fulfil basic user needs. The intention is to not break backwards compatibility of this interface in the future, still we recommend to design robust software that can deal with possible changes like addition or removal of variables.

## Available raw data

This section contains information about the raw XML server statistics data available inside icecast. An example stats XML tree will be shown and each element will be described. The following example stats tree will be used:

    <?xml version="1.0"?>
    <icestats>
    	<admin>icemaster@example.org</admin>
    	<client_connections>13</client_connections>
    	<clients>2</clients>
    	<connections>14</connections>
    	<file_connections>1</file_connections>
    	<host>stream.example.org</host>
    	<listener_connections>7</listener_connections>
    	<listeners>1</listeners>
    	<location>Earth</location>
    	<server_id>Icecast 2.4.0</server_id>
    	<server_start>Tue, 01 Apr 2014 23:42:05 +0000</server_start>
    	<server_start_iso8601>2014-04-01T23:42:05+0000</server_start>
    	<source_client_connections>1</source_client_connections>
    	<source_relay_connections>0</source_relay_connections>
    	<source_total_connections>1</source_total_connections>
    	<sources>1</sources>
    	<stats>0</stats>
    	<stats_connections>0</stats_connections>
    	<source mount="/test.ogg">
    		<artist>Test artist</artist>
    		<audio_bitrate>32000</audio_bitrate>
    		<audio_channels>2</audio_channels>
    		<audio_info>samplerate=32000;channels=2;quality=-1;ice-channels=1</audio_info>
    		<ice-bitrate>32</ice-bitrate>
    		<listener_peak>2</listener_peak>
    		<listeners>0</listeners>
    		<listenurl>http://stream.example.org:8000/test.ogg</listenurl>
    		<max_listeners>unlimited</max_listeners>
    		<public>0</public>
    		<quality>-1.00</quality>
    		<samplerate>32000</samplerate>
    		<server_description>A stream for testing ogg/vorbis.</server_description>
    		<server_name>TestStream</server_name>
    		<server_type>application/ogg</server_type>
    		<slow_listeners>1</slow_listeners>
    		<source_ip>203.0.113.42</source_ip>
    		<stream_start>Wed, 02 Apr 2014 13:37:42 +0000</stream_start>
    		<stream_start_iso8601>2014-04-02T13:37:42+0000</stream_start>
    		<subtype>Vorbis</subtype>
    		<title>Test title</title>
    		<total_bytes_read>448632</total_bytes_read>
    		<total_bytes_sent>207463</total_bytes_sent>
    		<user_agent>IceS 2.0.1</user_agent>
    	</source>
    </icestats>

### General Statistics

#### admin

As set in the server config, this should contain contact details for getting in touch with the server administrator. Usually this will be an email address, but as this can be an arbitrary string it could also be a phone number.

#### client_connections

Client connections are basically anything that is not a source connection. These include listeners (not concurrent, but cumulative), any admin function accesses, and any static content (file serving) accesses. This is an accumulating counter.

#### clients

Number of currently active client connections.

#### connections

The total of all inbound TCP connections since start-up. This is an accumulating counter.

#### file_connections

This is an accumulating counter.

#### host

As set in the server config, this should be the full DNS resolveable name or FQDN for the host on which this icecast instance is running.

#### listener_connections

Number of listener connections to mount points. This is an accumulating counter.

#### listeners

Number of currently active listener connections.

#### location

As set in the server config, this is a free form field that should describe e.g. the physical location of this server.

#### server_id

Defaults to the version string of the currently running Icecast server. While not recommended it can be overriden in the server config.

#### server_start_iso8601

Timestamp of server startup in ISO 8601 date format.

#### server_start

Timestamp of server startup in RFC 2822 date format. This field is deprecated and may be removed in a future version, please use server_start_iso8601 instead.

#### source_client_connections

Source client connections are the number of times (cumulative since start-up, not just currently connected) a source client has connected to icecast. This is an accumulating counter.

#### source_relay_connections

Number of outbound relay connections to (master) icecast servers. This is an accumulating counter.

#### source_total_connections

Both clients and relays. This is an accumulating counter.

#### sources

The total of currently connected sources.

#### stats

The total of currently connected STATS clients.

#### stats_connections

Number of times a stats client has connected to icecast. This is an accumulating counter.

### Source-specific Statistics

Please note that the statistics are valid within the scope of the current source connection. A reconnect or disconnection will reset those.

#### artist

Artist of the current song (metadata set by source client).

#### title

Title of the current song (metadata set by source client).

#### audio_bitrate

(metadata set by source client).

#### audio_channels

(metadata set by source client).

#### audio-info

Information about the bitrate/samplerate/quality of the stream (metadata set by source client). Also used for YP entries.

#### ice-bitrate

#### samplerate

Information about the bitrate/samplerate/quality of the stream (metadata set by source client).

#### listener_peak

Peak concurrent number of listener connections for this mountpoint.

#### listeners

The number of currently connected listeners.

#### listenurl

URL to this mountpoint. (This is not aware of aliases)

#### max_listeners

Maximum number of listeners permitted to concurrently connect to this mountpoint.

#### public

Flag that indicates whether this mount is to be listed on a YP (set by source client, can be overriden by server config).

#### quality

(metadata set by source client).

#### samplerate

(metadata set by source client).

#### server_description

(metadata set by source client).

#### server_name

(metadata set by source client).

#### server_type

MIME-type for the stream currently active on this mountpoint.

#### slow_listeners

#### source_ip

IP address of the currently connected source client. In case of relays the content of <server>.

#### stream_start_iso8601

Timestamp of when the currently active source client connected to this mount point in ISO 8601 date format.

#### stream_start

Timestamp of when the currently active source client connected to this mount point in RFC 2822 date format. This field is deprecated and may be removed in a future version, please use stream_start_iso8601 instead.

#### subtype

MIME-subtype, can be e.g. codecs like Opus, Vorbis, Theora.

#### total_bytes_read

Total number of bytes received from the source client.

#### total_bytes_sent

Total number of bytes sent to all listener connections since last source connect.

#### user_agent

HTTP user agent string as sent by the source client.
Additional data can be accessed through the admin interface, as every page of the admin interface has an XML equivalent.