View previous topic :: View next topic |
Author |
Message |
baalpeteor
Joined: 16 Aug 2008 Posts: 23
|
Posted: Tue Apr 21, 2009 8:01 pm Post subject: listener statistics |
|
|
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 |
|
|
sonia
Joined: 28 Dec 2008 Posts: 67 Location: Greece
|
Posted: Fri Apr 24, 2009 1:12 am Post subject: Re: listener statistics |
|
|
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 |
|
|
Ant
Joined: 11 Jun 2008 Posts: 26 Location: Russia
|
Posted: Sun May 03, 2009 9:43 am Post subject: |
|
|
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 |
|
|
Ant
Joined: 11 Jun 2008 Posts: 26 Location: Russia
|
Posted: Sun May 03, 2009 4:07 pm Post subject: |
|
|
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 |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Tue May 05, 2009 12:29 am Post subject: |
|
|
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 |
|
|
Ant
Joined: 11 Jun 2008 Posts: 26 Location: Russia
|
Posted: Wed May 06, 2009 4:01 am Post subject: |
|
|
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.
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 |
|
|
karlH Code Warrior
Joined: 13 Jun 2005 Posts: 5476 Location: UK
|
Posted: Wed May 06, 2009 1:41 pm Post subject: |
|
|
Is the value always lower than expected?
karl. |
|
Back to top |
|
|
Ant
Joined: 11 Jun 2008 Posts: 26 Location: Russia
|
Posted: Thu May 07, 2009 7:01 am Post subject: |
|
|
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 |
|
|
DJ-Zath
Joined: 11 Feb 2009 Posts: 155 Location: Western Illinois - USA
|
Posted: Sat May 16, 2009 5:15 am Post subject: |
|
|
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-
|
|
Back to top |
|
|
baalpeteor
Joined: 16 Aug 2008 Posts: 23
|
Posted: Tue Jun 16, 2009 5:03 am Post subject: |
|
|
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 |
|
|
Ant
Joined: 11 Jun 2008 Posts: 26 Location: Russia
|
Posted: Sat Jul 04, 2009 7:07 am Post subject: |
|
|
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 |
|
|
|