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 global stats

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





PostPosted: Thu Mar 30, 2006 6:19 pm    Post subject: icecast global stats Reply with quote

Hi anybody who developed icecast v2 !

I love him but want to implement some really need for me stats globally

total_bytes_read_over_server
total_bytes_sent_over_server

how can i implement this?

learning sources i found source.c as a injection starting point.
static get_next_buffer()
{
.....
if (current >= source->client_stats_update)
{
stats_event_args (source->mount, "total_bytes_read",
FORMAT_UINT64, source->format->read_bytes);
stats_event_args (source->mount, "total_bytes_sent",
FORMAT_UINT64, source->format->sent_bytes);
source->client_stats_update = current + 5;

//MY (PROBABLY) ADDITION
char *sval=stats_get_value(NULL, "tot_bytes_read");
uint64_t ival= atol(sval) + source->format->read_bytes;
stats_event_args (NULL, "tot_bytes_read", FORMAT_UINT64, ival);
sval=stats_get_value(NULL, "tot_bytes_sent");
ival= atol(sval) + source->format->sent_bytes;
stats_event_args (NULL, "tot_bytes_sent", FORMAT_UINT64, ival);
}
.....
}


but i got incorrect stats over server. Sad(((

how i can CORRECTLY implements required stats?
Back to top
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Thu Mar 30, 2006 7:16 pm    Post subject: Reply with quote

The section you are referring to is actually per-source, but you are updating stats globally, so it's not an accumulation of all streams. I've done some tweaking to my latest branch work to show the total sent by all streams. http://mediacast1.com/~karl/icecast-2.3-kh4.tar.gz
let me know if 'stream_kbytes_sent' is what you expect, that bit could be merged easily.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
unnamed_devel
Guest





PostPosted: Thu Mar 30, 2006 8:03 pm    Post subject: Reply with quote

KarlH eeeeahhh!!! Love you more!

This is what i expected!
I've looked at your source and make some patch for icecast 2.3.1 source tree.
U give me an idea how to implement this :) thx for advice!

i can upload or send you my sources. and you 'diff' at em :)
My addons is:

per source count :
+total LISTENERS HITS (only listeners)
per server (or server-wide):
+total traffic out
+total traffic in
+current listeners (ONLY listeners!)

changes sources:
auth.c
function add_client_to_source
{
....
stats_event_inc (NULL, "listener_connections");

//NEW
stats_event_inc (source->mount, "listenershits")

//CONTINUE
if (source->running == 0 && source->on_demand)
....
}



source.c
function source_clear_source
{
....
source->client_stats_update = 0;

//NEW
source->bytes_read_since_update=0;
source->bytes_sent_since_update=0;

//CONTINUE
util_dict_free (source->audio_info);
....
}


function get_next_buffer
{
...
if (current >= source->client_stats_update)
{
//NEW
stats_event_add (NULL, "tot_kbytes_read", (source->format->read_bytes - source->bytes_read_since_update)/1024);
source->bytes_read_since_update=source->format->read_bytes;
stats_event_add (NULL, "tot_kbytes_sent", (source->format->sent_bytes - source->bytes_sent_since_update)/1024);
source->bytes_sent_since_update=source->format->sent_bytes;

//CONTINUE
stats_event_args (source->mount, "total_bytes_read",
FORMAT_UINT64, source->format->read_bytes);
...
}


function source_init
{
....
stats_event_args (source->mount, "listeners", "%lu", source->listeners);

//NEW
stats_event (source->mount, "listenershits", "0");

//CONTINUE
stats_event_args (source->mount, "listener_peak", "%lu", source->peak_listeners);
....
}



function source_main
{
....
avl_delete(source->client_tree, (void *)client, _free_client);

//NEW
stats_event_dec (NULL, "listeners");

//CONTINUE
source->listeners--;
DEBUG0("Client removed");
....
....
avl_insert(source->client_tree, client_node->key);

//NEW
stats_event_inc (NULL, "listeners");

//CONTINUE
source->listeners++;
DEBUG0("Client added");
....
}
Back to top
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Thu Mar 30, 2006 8:43 pm    Post subject: Reply with quote

I'm not so sure about the stats name "listenershits", doesn't read quite right Smile

An accumulated listener count per-source should really be added and a similar global stat for total read is ok.

karl.
Back to top
View user's profile Send private message Send e-mail Visit poster's website
unnamed_devel
Guest





PostPosted: Thu Mar 30, 2006 9:07 pm    Post subject: Reply with quote

"listenershits" is accumulate client audio players hits. some simular to web browsers hits on WWW-servers Smile

an example:
initially listenershits=0 (on source creation)

now connect at mount http://server:port/mount (NOT PLAYLIST(!), ONLY REAL REQUEST FOR THAT STREAM!)
listenershists will be 1

now disconnect and connect ...hmm five times again.
listenershits will be 6
(1+5)

and this statistics needed _per all sources_ Smile


anyway, KarlH thx for all 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