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 

listener statistics

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



Joined: 16 Aug 2008
Posts: 23

PostPosted: Tue Apr 21, 2009 8:01 pm    Post subject: listener statistics Reply with quote

is there a way or program that can show how many listeners icecast has over a period of time, when your peak listener count occurred, and how long they stayed connected?
Back to top
View user's profile Send private message
sonia



Joined: 28 Dec 2008
Posts: 67
Location: Greece

PostPosted: Fri Apr 24, 2009 1:12 am    Post subject: Re: listener statistics Reply with quote

DRS 2006 Internet Broadcaster , http://www.drs2006.com can do your job like a charm, but it's pc only.
aaa it's totally free also and works with icecast p-e-r-f-e-c-t.

baalpeteor wrote:
is there a way or program that can show how many listeners icecast has over a period of time, when your peak listener count occurred, and how long they stayed connected?
[/url]
_________________
www.freshwebradio.com
Back to top
View user's profile Send private message
Ant



Joined: 11 Jun 2008
Posts: 26
Location: Russia

PostPosted: Sun May 03, 2009 9:43 am    Post subject: Reply with quote

About statistics there is some faq and topic in it:
http://icecast.imux.net/viewtopic.php?t=337

So in case version 2.3.2 of icecast that perl script show wrong amount of listeners (too big).
We need little changes to get right results here is changed script:
(removed while and changed listeners string)

Code:

#!/usr/bin/perl

use strict;
#get the number of listeners on a icecast stream
#(find out total bytes later)

my $staturl = qq~http://radio.example.com:8000/admin/stats~;
my $user = 'admin';
my $pass = 'admin';
#my $stream = "sss";
my $uptime = '0 days';
my $listeners = 0;
my $sources = 0;

#get listeners
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => $staturl);
$req->authorization_basic($user, $pass);
my $stats = $ua->request($req)->as_string;
    $stats =~ /<listeners>(\d+)<\/listeners><location>/;
    $listeners += int($1);
    $stats =~ /<sources>(\d+)<\/sources>/;
    $sources = $1;
    if (!$listeners) {$listeners = 0;}
    if (!$sources) {$sources = 0;}

    #get uptime
    use Date::Manip;
    my $stuff = `ps --no-headers -C icecast -o pid,fname,lstart --sort lstart`;
    my @stuff = split(/\n/,$stuff);
    $stuff[0] =~ /icecast\s+(.*?)$/gi;
    my $start = ParseDate($1);
    my $now = ParseDate("Now");
    my $delta = DateCalc($start,$now);
    $uptime = Delta_Format($delta,0,"%dh days %hv hours");

    print qq~$listeners\n$sources\n$uptime\n~;
#    $stream\n~;
    exit;


So if someone can add this info to topic in faq it could be great.
Back to top
View user's profile Send private message
Ant



Joined: 11 Jun 2008
Posts: 26
Location: Russia

PostPosted: Sun May 03, 2009 4:07 pm    Post subject: Reply with quote

Well looks like bug in code of 2.3.2.
In global statistic listeners suddenly become very low.
So as workaround we must again count every source listener.
So changes can be like this:
Code:

#!/usr/bin/perl

use strict;
#get the number of listeners on a icecast stream
#(find out total bytes later)

my $staturl = qq~http://radio.example.com:8000/admin/stats~;
my $user = 'admin';
my $pass = 'admin';
#my $stream = "sss";
my $uptime = '0 days';
my $listeners = 0;
my $sources = 0;

#get listeners
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => $staturl);
$req->authorization_basic($user, $pass);
my $stats = $ua->request($req)->as_string;
while ($stats =~ /<listeners>(\d+)<\/listeners><listenurl>/g) {
    $listeners += int($1);
    }
    $stats =~ /<sources>(\d+)<\/sources>/;
    $sources = $1;
    if (!$listeners) {$listeners = 0;}
    if (!$sources) {$sources = 0;}

    #get uptime
    use Date::Manip;
    my $stuff = `ps --no-headers -C icecast -o pid,fname,lstart --sort lstart`;
    my @stuff = split(/\n/,$stuff);
    $stuff[0] =~ /icecast\s+(.*?)$/gi;
    my $start = ParseDate($1);
    my $now = ParseDate("Now");
    my $delta = DateCalc($start,$now);
    $uptime = Delta_Format($delta,0,"%dh days %hv hours");

    print qq~$listeners\n$sources\n$uptime\n~;
#    $stream\n~;
    exit;
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Tue May 05, 2009 12:29 am    Post subject: Reply with quote

If the global listener count is getting out of sync then the conditions that can lead to it need to be identified. Can you describe the setup you have or possibly show a case where the figures get out of line?

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



Joined: 11 Jun 2008
Posts: 26
Location: Russia

PostPosted: Wed May 06, 2009 4:01 am    Post subject: Reply with quote

karlH wrote:
If the global listener count is getting out of sync then the conditions that can lead to it need to be identified. Can you describe the setup you have or possibly show a case where the figures get out of line?

karl.

Well.
Now in globa stats i saw:
listeners -20
It's minus. Shocked
In this moment when i count amount of listeners on mountpoints: 33.

So, our config mainly just a relay from other sources. (about 20 stations, sometimes some of them online, some don't, but option on-demand - 0)
If i restart server this value becomes normal.
But in next 24h it again becomes too low or even negative values.

Do you need any other info?
Back to top
View user's profile Send private message
karlH
Code Warrior
Code Warrior


Joined: 13 Jun 2005
Posts: 5476
Location: UK

PostPosted: Wed May 06, 2009 1:41 pm    Post subject: Reply with quote

Is the value always lower than expected?

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



Joined: 11 Jun 2008
Posts: 26
Location: Russia

PostPosted: Thu May 07, 2009 7:01 am    Post subject: Reply with quote

Not always.
After restart it show correct values some time.
As example, after my last post i restart icecast.
And now i saw on admin page on global stats:
listeners 32

But in reality it's about 130 listeners.
Back to top
View user's profile Send private message
DJ-Zath



Joined: 11 Feb 2009
Posts: 155
Location: Western Illinois - USA

PostPosted: Sat May 16, 2009 5:15 am    Post subject: Reply with quote

I saw this problem (or one simular) some time ago..

I wrote some code to correct this issue.. I called it the HOP DETECTOR

Simply put, it aquires the counts from the last active mount thats being (re)directed to the current mount- and forewards them to the current mount, thus "detecting a hop" in the mounts and then displays the "overwritten" listener counts.. to keep them accurate.

I also did a version in TCL for eggdrop...

but, without knowing the exact setups of your Icecast server configs or streaming layouts, it wouldn't make sense to post the code here, therefore I didn't.. perhaps I could, if enough peeps wanted to see it but they would probably have to "work it in" for their particular situations.

I mention this, to also note that this is, not nessessarily a bug, but, more of an oversight in Icecast, and Steamcast, and all the other multi-mount streaming server packages I have tried.

-DjZ-
Smile Smile
Back to top
View user's profile Send private message Visit poster's website
baalpeteor



Joined: 16 Aug 2008
Posts: 23

PostPosted: Tue Jun 16, 2009 5:03 am    Post subject: Reply with quote

Ant wrote:
About statistics there is some faq and topic in it:
http://icecast.imux.net/viewtopic.php?t=337

So in case version 2.3.2 of icecast that perl script show wrong amount of listeners (too big).
We need little changes to get right results here is changed script:
(removed while and changed listeners string)

Code:

#!/usr/bin/perl

use strict;
#get the number of listeners on a icecast stream
#(find out total bytes later)

my $staturl = qq~http://radio.example.com:8000/admin/stats~;
my $user = 'admin';
my $pass = 'admin';
#my $stream = "sss";
my $uptime = '0 days';
my $listeners = 0;
my $sources = 0;

#get listeners
use LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $req = HTTP::Request->new(GET => $staturl);
$req->authorization_basic($user, $pass);
my $stats = $ua->request($req)->as_string;
    $stats =~ /<listeners>(\d+)<\/listeners><location>/;
    $listeners += int($1);
    $stats =~ /<sources>(\d+)<\/sources>/;
    $sources = $1;
    if (!$listeners) {$listeners = 0;}
    if (!$sources) {$sources = 0;}

    #get uptime
    use Date::Manip;
    my $stuff = `ps --no-headers -C icecast -o pid,fname,lstart --sort lstart`;
    my @stuff = split(/\n/,$stuff);
    $stuff[0] =~ /icecast\s+(.*?)$/gi;
    my $start = ParseDate($1);
    my $now = ParseDate("Now");
    my $delta = DateCalc($start,$now);
    $uptime = Delta_Format($delta,0,"%dh days %hv hours");

    print qq~$listeners\n$sources\n$uptime\n~;
#    $stream\n~;
    exit;


So if someone can add this info to topic in faq it could be great.


as far as the above ( and the 2nd post talking about the broadcaster software) I can't run that on a computer that runs ONLY darkice? I send my darkice mp3 stream to an online host (icecast). so i have to get HIM to run these scripts?
Back to top
View user's profile Send private message
Ant



Joined: 11 Jun 2008
Posts: 26
Location: Russia

PostPosted: Sat Jul 04, 2009 7:07 am    Post subject: Reply with quote

You can run it everywhere you want.

All it do, just connects to icecast (you can specify it' s address, that's why you can place it even on some third machine with webserver for example) and talk to you results.
You can use them with php scripts ot mrtg ot whatever you want.
Back to top
View user's profile Send private message
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