Icecast Streaming Media Server Forum Index Icecast Streaming Media Server
Icecast is a Xiph Foundation Project
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Icecast stats

 
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server
View previous topic :: View next topic  
Author Message
Anonymous
Guest





PostPosted: Mon Aug 20, 2007 10:39 am    Post subject: Icecast stats Reply with quote

Hi!
I'm looking for a script/program/whatever, to parse stats.xsl and if possible, save it in a *sql (preferibly mysql) database.
I've found a "class_icecast2.php", but maybe someone knows something better.
Thanks in advance! Very Happy
PS.- Sorry for my english!
Back to top
Anonymous
Guest





PostPosted: Wed Aug 29, 2007 1:44 pm    Post subject: Reply with quote

Well, if the solution is not found, then, create it! Very Happy
This script saves icecast admin page to a rudimentary (not boyce-codd, 5FN, any shit of that Very Happy) mysql database:
Code:

<?php

/********************************************************************************/
/* Script en php que se encarga de guardar todos los datos de un mountpoint.    */
/* Para usarlo: php -f mountpoint_to_sql.php puntomontaje                       */
/********************************************************************************/

include('icecounter.php');

/* Datos de la bbdd */
$dbhost='yourhost';
$dbuser='youruser';
$dbpass='yourpass';
$db='yourdb';

/* Comprobar si se le ha pasado el parametro puntomontaje */
if(is_null($argv[1])){
        exit;
}

$conexion=mysql_connect($dbhost,$dbuser,$dbpass);
$i=mysql_select_db($db,$conexion) or die;

$m1=$argv[1];

/* Array para almacenar los datos que quieren ser parseados */
$tags=array(
        array($m1,'LISTENERS'),
        array($m1,'BITRATE'),
        array($m1,'LISTENER_PEAK'),
        array($m1,'MAX_LISTENERS'),
        array($m1,'TITLE')
        );
$data=retrieve($tags,true);

/* El ancho de banda lo calculamos con bitrate X listeners */
$bw=$data[0]*$data[1];
$fecha=date("Y/m/d H:i:s");

/* Almacenamos todos los datos */
$query="INSERT INTO stats (id,mountpoint,listeners,bitrate,peak,max,bw,descripcion,hora) VALUES (NULL,'$m1','$data[0]','$data[1]','$data[2]','$data[3]','$bw','$data[4]','$fecha')";
$result=mysql_query($query,$conexion);

if (!$result) {
        $message  = 'Invalid query: ' . mysql_error() . "\n";
        $message .= 'Whole query: ' . $query;
        die($message);
}

mysql_close($conexion);
?>


It depends of icecounter.php (www.netzond.com), where it's located host data for the icecast server.
I hope it works for someone Smile
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Icecast Streaming Media Server Forum Index -> Icecast Server All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2002 phpBB Group
subRebel style by ktauber