Old 29th October 2014, 12:58   #1
Bryon Stout
Senior Member
 
Join Date: Feb 2011
Posts: 377
Stats using new DNAS

Hey guys / gals.

Is there a standard way to show stats with the new DNAS? Since the new DNAS clusters all your servers and relays I wanted to know if there is a particular way we should display stats on our website.

Or if I just have to do it the old school way and include all my relays in my code and add them to display the correct number.
Bryon Stout is offline   Reply With Quote
Old 29th October 2014, 13:03   #2
DrO
 
Join Date: Sep 2003
Posts: 27,873
you can display them however you want to do so. is really down to you whether you use /statistics (all streams on the same DNAS) or /stats or /7.html (not recommended) to do it on a per-stream basis and collate things as needed (assuming that's what you're wanting to do). but if you're looking for a single call to get all of the information from a DNAS cluster then that's not possible as the DNAS generally don't know about each other to be able to achieve that.
DrO is offline   Reply With Quote
Old 29th October 2014, 13:17   #3
Bryon Stout
Senior Member
 
Join Date: Feb 2011
Posts: 377
thanks DrO.

I want to do two things actually.

1. Show the total number of listeners of all my relays added up
2. Show individual stats separated by server/relay in a stats page on my website
Bryon Stout is offline   Reply With Quote
Old 29th October 2014, 13:24   #4
DrO
 
Join Date: Sep 2003
Posts: 27,873
query the DNAS via /statistics and then process / amalgamate the details as needed. that's the most direct way to do what you're wanting to do and worked well when i used it for a multi-server and multi-stream setup.
DrO is offline   Reply With Quote
Old 29th October 2014, 13:35   #5
Bryon Stout
Senior Member
 
Join Date: Feb 2011
Posts: 377
My man. Thanks!.

That's what I figured but wanted to make sure there wasn't a "duh" easier way that I wasn't aware of.
Bryon Stout is offline   Reply With Quote
Old 29th October 2014, 13:44   #6
DrO
 
Join Date: Sep 2003
Posts: 27,873
for that stats that you seem to want, that's it as the API responses won't have the resolution needed (or the accuracy since they're typically up to a few minutes out from when the DNAS last provided them). maybe something official will come which would provide it for you but as you're doing it for your own website, it's probably better to do a custom solution like you are.
DrO is offline   Reply With Quote
Old 29th October 2014, 16:00   #7
Bryon Stout
Senior Member
 
Join Date: Feb 2011
Posts: 377
Righton.

As always, Thanks for your time and knowledge.
Bryon Stout is offline   Reply With Quote
Old 1st November 2014, 04:46   #8
dopelabs
Major Dude
 
dopelabs's Avatar
 
Join Date: Oct 2006
Location: Silicon Valley
Posts: 539
Send a message via AIM to dopelabs
any particular type of output your looking for or just simple totals/etc?
dopelabs is offline   Reply With Quote
Old 2nd November 2014, 19:07   #9
Bryon Stout
Senior Member
 
Join Date: Feb 2011
Posts: 377
@dopelabs

Well for this particular inquiry just simple stats for total amount of tune ins for all servers / relays for my homepage.

But I plan on building a stats page using [highcharts] to be interactive with my live stats.
Bryon Stout is offline   Reply With Quote
Old 2nd November 2014, 20:01   #10
dopelabs
Major Dude
 
dopelabs's Avatar
 
Join Date: Oct 2006
Location: Silicon Valley
Posts: 539
Send a message via AIM to dopelabs
tune ins as in stream hits or current listeners?
dopelabs is offline   Reply With Quote
Old 2nd November 2014, 20:29   #11
dopelabs
Major Dude
 
dopelabs's Avatar
 
Join Date: Oct 2006
Location: Silicon Valley
Posts: 539
Send a message via AIM to dopelabs
returns total listeners. requires sockets.

code:
<?php

$station_name = "Radio Station";

$timeout = "5"; // timeout

$ip[1] = "127.0.0.1";
$port[1] = "80";
$sid[1] = "1";

$ip[2] = "127.0.0.1";
$port[2] = "8000";
$sid[2] = "1";

$ip[3] = "127.0.0.1";
$port[3] = "8030";
$sid[3] = "1";

$ip[4] = "127.0.0.1";
$port[4] = "8050";
$sid[4] = "1";

/* ----- End config ----- */

$servers = count($ip);

$i = "1";
while($i<=$servers)
{
$fp = @fsockopen($ip[$i],$port[$i],$errno,$errstr,$timeout);
if (!$fp)
{
$listeners[$i] = "0";
$msg[$i] = "ERROR [Connection refused / Server down]";
$error[$i] = "1";
}
else
{
fputs($fp, "GET /7.html?sid=$sid[$i] HTTP/1.0\r\nUser-Agent: Mozilla (The King Kong of Lawn Care)\r\n\r\n");
while (!feof($fp))
{
$info = fgets($fp);
}

$stats = explode(',', $info);
if (empty($stats[1]) )
{
$listeners[$i] = "0";
$msg[$i] = "ERROR [There is no source connected]";
$error[$i] = "1";
}
else
{
if ($stats[1] == "1")
{
$listeners[$i] = $stats[4];
}
else
{
$listeners[$i] = "0";
$msg[$i] = "ERROR [Cannot get info from server]";
$error[$i] = "1";
}
}
}
$i++;
}
$total_listeners = array_sum($listeners);
print "$total_listeners";
?>


http://www.dlnetworks.net/scratch/multi-shout-totals/
dopelabs is offline   Reply With Quote
Old 2nd November 2014, 20:48   #12
DrO
 
Join Date: Sep 2003
Posts: 27,873
really /7.html? as Bryon is generally using 2.x, the /stats and /statistics options are far better options to be using and also a lot of more flexible due to being in XML and JSON versions instead of the hackish nature of the /7.html method.

which was why it was initially dropped in the early 2.x releases to push adoption of the newer formal methods but due to people not wanting to or not being able to update old tools / scripts, the /7.html hack was added back into 2.2+, but it's not a recommended mode to query the information needed. especially if there's multiple streams on a specific DNAS where the /statistics response excels in providing all of the information in one go instead of needing multiple method calls.
DrO is offline   Reply With Quote
Old 2nd November 2014, 21:05   #13
dopelabs
Major Dude
 
dopelabs's Avatar
 
Join Date: Oct 2006
Location: Silicon Valley
Posts: 539
Send a message via AIM to dopelabs
yes it is a bit old school. but i also wanted to retain support for v1 dnas's.

wavestreaming github has some useful tools that can be handy as well

https://github.com/Wavestreaming/jqu...iki/Easy-Setup

and

https://github.com/Wavestreaming/SHOUTcast-PHP-Class
dopelabs is offline   Reply With Quote
Old 2nd November 2014, 21:16   #14
DrO
 
Join Date: Sep 2003
Posts: 27,873
if someone is using 2.x and there isn't a dependency on pre-existing tools / scripts then there is zero reason to consider 1.x handling. all of this stuff keeping 1.x DNAS going is, to be blunt, a waste of time and just holds back everything to do with the SHOUTcast platform / infrastructure as a whole and it's that which got things into the whole mess this time last year.

keeping on using 1.x is just the same as using IE6 and i know there's nothing i can do to stop people using 1.x but it does more damage in the long run and hinders what users are screaming at us to provide but cannot due to the continued 1.x usage.
DrO is offline   Reply With Quote
Old 2nd November 2014, 21:30   #15
dopelabs
Major Dude
 
dopelabs's Avatar
 
Join Date: Oct 2006
Location: Silicon Valley
Posts: 539
Send a message via AIM to dopelabs
yea.. ill prob stop using the old methods once uvox2 protocol support in source clients becomes more widely supported.
dopelabs is offline   Reply With Quote
Old 2nd November 2014, 21:41   #16
DrO
 
Join Date: Sep 2003
Posts: 27,873
you don't need to be using 2.x based source clients (although it's preferred) for any of the methods i've mentioned to work with the 2.x DNAS - it provides things irrespective of the source type. the only limitation of 2.x is supporting multiple 1.x based source clients (which is already in the current 2.x releases but with limitations and that will be resolved for the next major 2.x DNAS update).
DrO is offline   Reply With Quote
Old 3rd November 2014, 12:00   #17
ecuastardj
Junior Member
 
Join Date: Oct 2014
Posts: 1
ican"t acces to my control the servise
ecuastardj is offline   Reply With Quote
Old 3rd November 2014, 14:26   #18
Bryon Stout
Senior Member
 
Join Date: Feb 2011
Posts: 377
Thanks fellas!

I think the xml and json is what we will be utilizing.
Bryon Stout is offline   Reply With Quote
Reply
Go Back   Winamp & Shoutcast Forums > Shoutcast > Shoutcast Technical Support

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump