Present in the Next release. See the related bug
The current statistics of the FreeCast network can be retrieved in XML format.
Statistics are available at this URL http:<tracker host>:<tracker port>/stats.xml. Add
?networkid=<id> to retrieve the statistics of a specific network.
This returned xml file is compatible with icecast
specifications.
Examples: http://localhost:1665/stats.xml, http://localhost:1665/stats.xml?networkid=4e925fa33
===== Statistics consumers =====
Several consumers can be configured.
==== File consumer ====
Add a line for each network to a given text file.
Each line uses a configurable pattern. The default one is {0,date,yyyyMMdd-HHmmss} {1} {2} {3} {4} {5}.
The arguments are :
* 0: the date
* 1: the network identifier
* 2: the node connections
* 3: the root node connections
* 4: the connected listener
* 5: if the root node is present
With the default pattern, the consumer produces something like :
<file>20061007-205638 489ab78 1 1 0 true
20061007-205738 489ab78 2 1 1 true
20061007-205738 489ab78 5 1 4 true</file>
==== Exec consumer ====
Execute a given command for each network. The command arguments are the following:
* the date, in seconds from 1/1/1970
* the network identifier (or 'none' if the tracker manages a single network)
* the node connections
* the root node connections
* the connected listener
* true or false according to the root node is present or not
A working directory can be specified into the configuration.
For example, the following configuration :
<code xml>
…
<consumer>
<class>exec</class>
<command>/etc/freecast/update_rddtools</command>
<workingdir>/var/lib/freecast</workingdir>
</consumer>
…
</code>
leads the tracker to execute this kind of command /etc/freecast/update_rddtools 1160247699 983a8e 2 1 1 true''
==== Database consumer ====
Executes a given SQL request for each network statistics. Requires the needed JDBC driver.
The default request is :
<code sql>
insert into statistics (timestamp,networkid,node_connections,rootnode_connections,listeners,rootnode) values (?,?,?,?,?,?);
</code>
The request paramters must be :
* 1, the date (SQL timestamp, date + time)
* the network identifier (string)
* the node connections (integer)
* the root node connections (integer)
* the connected listener (integer)
* the root node is present or not (boolean)
Under Mysql, a simple statistics table can be created with :
<code sql>
create table statistics (
timestamp DATETIME,
networkid VARCHAR(50),
node_connections INT,
rootnode_connections INT,
listeners INT,
rootnode BIT
)
</code>
===== Configuration =====
There is a full/complete configuration example.
<code xml><freecast>
<tracker>
<statistics>
<xml>true</xml> <!– unable the XML statistics, by default: true –>
<update>60</update> <!– the delay in seconds between statistics update, by default: 60 –>
<consumer> <!– execute the given command –>
<class>exec</class>
<command>/etc/freecast/update_rrdtools</command>
<workingdir>/var/lib/freecast</workingdir> <!– optionnal –>
</consumer>
<consumer> <!– append statistics to –>
<class>file</class>
<file>/var/log/freecast/statistics.log</file>
</consumer>
<consumer> <!– update the given database –>
<class>database</class>
<driver>com.mysql.jdbc.Driver</driver>
<url>jdbc:mysql:localhost:3306/myfreecast?autoreconnect=true</url>
<user>root</user>
<password>p@ssword</password>
<request> <!– defines the SQL request to be executed, by default : this string –>
insert into statistics
(timestamp,networkid,node_connections,rootnode_connections,listeners,rootnode)
values (?,?,?,?,?,?);
</request>
</consumer>
</statistics>
</tracker>
</freecast></code>