Wowza Community

HTTProvider that returns server, vhost, application, appInstance, stream conn. counts

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

Hi Charlie,

I’m trying to use http://[wowza-ip-address]:8086/connectioncounts to get the xml file with all the data.

I’d like to use that file use that file to store every 15 minutes all the informations on my mysql server.

My problem is that I’m not able to save that file: Internet Explorer shows me the file on screen but if I try to save it IE says:

“XML source file is unavailable for viewing”

If I try to use Automate from network automation to http download the file, I get a empty file.

If I try to use httrak command line to get the file using http://user:password@[wowza-ip-address]:8086/connectioncounts I get Authentication error.

So, could you help me to understand how can I get the xml file?

I need the file to elebarate it using a batch on a mysql server.

I’m doing the same thing with shoutcats and icecast, and we would like to offer our services with Wowza server (we are a streaming provider) so I’m trying to do this thing with the developer license.

Thanks for your help.

Dave

We don’t have specific example code for this. There is sample code here:

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

Charlie

simple php code using simplexml to retrieve datas from the httpProvider:

$xml = simplexml_load_file("wowzaip:8086/connectioncounts");     
//var_dump($xml);
foreach ($xml->Application as $item) {
    $tmp = (string) $item->Name;
    echo $tmp."<br>";
foreach ($item->ApplicationInstance as $item2) {
    $roomName = (string) $item2->Name;
	$Connections = (string) $item2->ConnectionsCurrent;
	echo $roomName.": ".$Connections."<br>";
	}
	}
}

etc…

enjoy !

The easiest solution is set the HTTProvider’s AuthenticationMethod to none. Look for this in /conf/VHost.xml

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

And change the AuthenticationMethod to none

<AuthenticationMethod>none</AuthenticationMethod>

Richard

definst” is the default Application Instance.

If you publish to:

rtmp://[wowza-address]:1935/test

You are actually publishing

rtmp://[wowza-address]:1935/test/definst

If you add an explicit Application Instance part to the rtmp url, that is what will be used:

rtmp://[wowza-address]:1935/test/instance1

A subscribing client will have to also connect to that instance to view the stream.

Richard

In some browsers, you might have to select View > Source from the menu to see the xml.

IE should work without doing that.

Richard

There are several HTTProvider examples with full source here:

http://www.wowza.com/community/c/-/10

Try these:

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

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

You have to modify one of /conf/VHost/ HostPort /HTTProviders lists, add your HTTProvider.

Richard

Total Connections is at that moment, how many connection there are. If 5 clients are connected at the moment this number will be 5.

ConnectionTotalAccepted is cumulative, since the server was last started. If 20 clients connect successfully since the server was started, this number will be 20.

If you are looking looking at a Load Balancer Listener, which is the server that clients connect to get redirected to edge server (Load Balance Senders) servers, you will see rejected connections because that is how the Load Balancer works: it rejects connections, sends back reject code 302 to the client with the information on which edge to connect to. JW Player and Flowplayer are designed to handle this. They then connect to the edge which accepts the connection.

Richard

One way is to modify the HTTProvider so that it only outputs the data you want, in which case you could provide a querystring with app name to filter on. See this post for how to parse querystring:

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

Another way is to take the whole output and use an xml parser to extract. Here is a couple of user post that explore that with php.

http://www.wowza.com/community/t/-/34374#3

Richard

A Wowza admin is in development. But I don’t have a time frame for its release.

Richard

I’m not sure about the Wowza admin, but it’s not imminent.

Richard

Hello,

How is possible to extract on xml only information about one application, for example:

http://[wowza.url]:8086/connectioncounts?application=test

to show:

<Application>
  <Name>test</Name> 
  <Status>loaded</Status> 
<ConnectionsCurrent>2</ConnectionsCurrent> 
  <ConnectionsTotal>3</ConnectionsTotal> 
  <ConnectionsTotalAccepted>3</ConnectionsTotalAccepted> 
</Application>

Only information about what application name i need.

Thanks

Hello Charly,

I am using this feature now to build my own admin panel.

But I was looking at something, I have an application with multiple streampoints, but I always get this:

<Application>
  <Name>test</Name> 
  <Status>loaded</Status> 
  <TimeRunning>1454.528</TimeRunning> 
  <ConnectionsCurrent>2</ConnectionsCurrent> 
  <ConnectionsTotal>3</ConnectionsTotal> 
  <ConnectionsTotalAccepted>3</ConnectionsTotalAccepted> 
  <ConnectionsTotalRejected>0</ConnectionsTotalRejected> 
  <MessagesInBytesRate>78872.0</MessagesInBytesRate> 
  <MessagesOutBytesRate>2.0</MessagesOutBytesRate> 
- <ApplicationInstance>
  <Name>_definst_</Name> 
  <TimeRunning>1454.504</TimeRunning> 
  <ConnectionsCurrent>2</ConnectionsCurrent> 
  <ConnectionsTotal>3</ConnectionsTotal> 
  <ConnectionsTotalAccepted>3</ConnectionsTotalAccepted> 
  <ConnectionsTotalRejected>0</ConnectionsTotalRejected> 
  <MessagesInBytesRate>78872.0</MessagesInBytesRate> 
  <MessagesOutBytesRate>2.0</MessagesOutBytesRate> 
- <Stream>
  <Name>alpha</Name> 
  <SessionsFlash>0</SessionsFlash> 
  <SessionsCupertino>0</SessionsCupertino> 
  <SessionsSmooth>0</SessionsSmooth> 
  <SessionsRTSP>0</SessionsRTSP> 
  <SessionsTotal>0</SessionsTotal> 
  </Stream>
- <Stream>
  <Name>omega</Name> 
  <SessionsFlash>0</SessionsFlash> 
  <SessionsCupertino>0</SessionsCupertino> 
  <SessionsSmooth>0</SessionsSmooth> 
  <SessionsRTSP>0</SessionsRTSP> 
  <SessionsTotal>0</SessionsTotal> 
  </Stream>
  </ApplicationInstance>
  </Application>

Is it possible to break up the mountpoints so that I have for each own the bytes in and out?

I can’t really figure out what definst does in this context?

Ah thanks, that wasn’t very clear, but it seems to work now yes!

That option is perfect because now I can monitor per publishpoint the IO data. Thanks!

thanks Richard,

without the AuthenticationMethod it works.

But I’ve changed the folliìowing section:

com.wowza.wms.http.HTTPConnectionCountsXML

connectioncounts*

none

Thanks again for your answer, you have helped me to bypass a serious problem for me.

ciao

Dave

Hi ffsdff,

We can help you with your request.

Please contact us: support[@]wmconsulting.info

Regards,

Alejandro

add

[php]

<?php [/php] at the beginning and [php] ?>

[/php]

at the end ?

Shamrock

Note the wowzaip part, you need to change this to the IP address of your server running Wowza. Please do note PHP is not supported here, although advice can be offered really you do need to source PHP help from a PHP forum.

Shamrock

I am looking for developer who can make connection count that need to display in my website or inside flash player, control bar.