Wowza Community

Display current listeners using PHP

Set the username and password in /conf/admin.password file

Richard

You can change AuthenticationMethod to “none” in the /conf/VHost.xml file. Find this HTTProvider:

<HTTPProvider>
	<BaseClass>com.wowza.wms.http.HTTPConnectionCountsXML</BaseClass>
	<RequestFilters>connectioncounts*</RequestFilters>
	<AuthenticationMethod>admin-digest</AuthenticationMethod>
</HTTPProvider>

Change to:

<HTTPProvider>
	<BaseClass>com.wowza.wms.http.HTTPConnectionCountsXML</BaseClass>
	<RequestFilters>connectioncounts*</RequestFilters>
	<AuthenticationMethod>none</AuthenticationMethod>
</HTTPProvider>

Richard

There is source code for you can modify to your needs:

http://www.wowza.com/community/t/-/84

Richard

Try using double quotes on line 8:

 $wms = $doc->getElementsByTagName("WowzaMediaServer"); 

Richard

I think you also have to change the connectioncounts HTTProvider in /conf/VHost.xml from “admin-digest” to “none”

Otherwise, I’m not sure. I’ve not used this.

Richard

You would have to modify the connectioncounts (an HTTProvider) source to handle a querystring or form variable and filter on a stream name.

https://www.wowza.com/docs/how-to-get-connection-counts-for-server-applications-application-instances-and-streams-with-an-http-provider

See this article also:

https://www.wowza.com/docs/how-to-parse-post-or-get-variables-in-an-http-provider

You need the Wowza IDE:

http://wowza.com/ide.html

Richard

What do you mean? How do you want it to work?

Richard

VHost.xml file. Post between code tags.

Which port are you using? There are two HostPort blocks in the default /conf/VHost.xml file.

Did you restart Wowza after changes to VHost.xml?

Richard

For your method to work, you have to change the /conf/VHost.xml HTTProvider /AuthenticationMethod from “admin-digest” to “admin-basic” or “none”

<HTTPProvider>
	<BaseClass>com.wowza.wms.http.HTTPConnectionCountsXML</BaseClass>
	<RequestFilters>connectioncounts*</RequestFilters>
	<AuthenticationMethod>admin-basic</AuthenticationMethod>
</HTTPProvider>

Then restart Wowza.

Richard

You can enable Application level logging in /conf/log4j.properties file (look for commented out section).

You can real-time stats from connectioncounts, but for all applications

https://www.wowza.com/docs/how-to-monitor-server-connections-load-and-application-statistics

Richard

The 2nd link I meant to be this

https://www.wowza.com/docs/how-to-monitor-server-connections-load-and-application-statistics

Cool. Thanks.

Richard

Xiaoqing Li,

Can you provide one example about how you pass the Header to Wowza?

You are using PHP?

Thanks,

Alejandro

I see than the port is 5800, are your changed the default admin port into the VHost.xml? and do you have the php-xml extension installed into your server?

Hi,

Are you using the load balancer code? The stuff I posted only works on the loadbalancer machine itself. If you hit: http://YOURHOST:1935//loadbalancer?serverInfoXML you should get something that looks like:

0

RUNNING

0

147 milliseconds

123.123.123.123

e062d-9da8-4532-8d87-eaea6894b

2

RUNNING

0

2 seconds 283 milliseconds

123.123.123.122

6dd6e8-742f-4399-88f-573ac9957

1

RUNNING

0

2 seconds 291 milliseconds

123.123.123.111

435e29-cf7a-4660-a52-30814d7a

If your not using a loadbalancer then you can do some slight modifications and roll thru this URL instead: http://YOURWOWZASERVER:8086/connectioncounts

Which gives detail about your specific server.

Right now i’m trying to figure out why I can’t do basic auth tho… the first example mentioned turning off authentication to make it work… which you have to do… but the ways I know of sending a un/pass for a file_get_contents isn’t working… annoying.

Also if someone doesn’t do it beforehand, i’m going to write up a quick script in a few in for making the connectioncount page look ‘pretty’.

–Chris

Here’s one that goes thru the connectioncounts and presents some info about the apps & streams. Also shows current outbound bitate for the server & apps.

[PHP]

<?php $hostname = "YOURWOWZAHOSTNAMEHERE.COM"; $xml_data=file_get_contents("http://$hostname:8086/connectioncounts"); $doc = new DOMDocument(); $doc->loadXML($xml_data); $wms = $doc->getElementsByTagName('WowzaMediaServer'); $wmstotalactive = $wms->item(0)->getElementsByTagName("ConnectionsCurrent")->item(0)->nodeValue; $wmstotaloutbytes = $wms->item(0)->getElementsByTagName("MessagesOutBytesRate")->item(0)->nodeValue; $wmstotaloutbits = $wmstotaloutbytes * '8'; echo "Hostname: $hostname

Server Total Active Connections: $wmstotalactive
Total Outbo und bitrate: $wmstotaloutbits

"; $wmsapp = $doc->getElementsByTagName('Application'); $wmscnt = $wmsapp->length; echo "Applications"; for ($idx = 0; $idx < $wmscnt; $idx++) { $appname = $wmsapp->item($idx)->getElementsByTagName("Name")->item(0)->nodeValue; $appccount = $wmsapp->item($idx)->getElementsByTagName("ConnectionsCurrent")->item(0)->nodeValue; $appoutbytes = $wmsapp->item($idx)->getElementsByTagName("MessagesOutBytesRate")->item(0)->nodeValue; $appoutbits = $appoutbytes * '8'; echo "
Application Name: $appname
Active Connections: $appccount
Application Bits Out: $appoutbits
"; } echo "
Streams"; $wmsast = $doc->getElementsByTagName('Stream'); $wmsasct = $wmsast->length; for ($sidx = 0; $sidx < $wmsasct; $sidx++) { $strname = $wmsast->item($sidx)->getElementsByTagName("Name")->item(0)->nodeValue; $strctot = $wmsast->item($sidx)->getElementsByTagName("SessionsTotal")->item(0)->nodeValue; echo "
Stream URL: $strname
Connections to Stream: $strctot
"; } ?>

[/PHP]

For an easier way to get info on just 1 VHost, you can use the original script and just break out of a loop when you find the one you want (Poor man’s single VHost info :wink: )

Here’s my code I wrote from scratch, similar to the first post but it uses PHP’s simpleXML and I am looping through the vhosts. This way you can get info on 1 stream (although you still have to download all vhost info before you can get it)

<?php
// Get connection counts for all vhosts; print single VHost info
$url = 'http://MYHOST:8086/connectioncounts';
$page = simplexml_load_file($url);
/*
echo '<pre>';
print_r($page);
echo '</pre>';
*/
// All VHosts in an array
$vhosts = $page->VHost;
// Loop through each VHost
foreach($vhosts as $vh)
{
    $vh_name          = $vh->Name;
    $vh_conn_cur      = $vh->ConnectionsCurrent;
    $vh_conn_accepted = $vh->ConnectionsTotalAccepted;
    $vh_conn_rejected = $vh->ConnectionsTotalRejected;
    if($vh_name == 'coolVhost')
    {
        break;
    }
}
// JSON Output for portability
echo '{"current":"' . $vh_conn_cur . '","accepted":"' . $vh_conn_accepted . '","rejected":"' . $vh_conn_rejected . '"}';
?>

If there is any more info on an easy way how to get info on just 1 vhost and NOT all Vhosts’s at once, I am all ears! The current method takes roughly 3 seconds on my server to get info on all vhosts.

I think he means he wants to have to authenticate instead of it just openly giving him the info.

IF that’s what he means, you said it earlier:

…I think you also have to change the connectioncounts HTTProvider in /conf/VHost.xml from “admin-digest” to “none”

If he makes the HTTProvider for connectioncounts back to “admin-digest”, it should try and authenticate. Then using PHP, instead of using “$page = simplexml_load_file($url);”, you’d use CURL and authenticate with a regular auth. Then just use simplexml_load_string().

Hi guys !!

What about people who is using Wowza Media Server Pro Unlimited 1.7.2 build12107

Like me !!

Thks a lot

Hi guys !!

What about people who is using Wowza Media Server Pro Unlimited 1.7.2 build12107

Like me !!

Thks a lot