<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>streamNerd</title>
	<atom:link href="http://blog.ianbeyer.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.ianbeyer.com</link>
	<description>Thoughts on technology and media</description>
	<lastBuildDate>Mon, 30 Jan 2012 23:54:55 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Go big, or go home!</title>
		<link>http://blog.ianbeyer.com/2012/01/21/go-big-or-go-home/</link>
		<comments>http://blog.ianbeyer.com/2012/01/21/go-big-or-go-home/#comments</comments>
		<pubDate>Sun, 22 Jan 2012 04:03:19 +0000</pubDate>
		<dc:creator>Ian Beyer</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Wowza]]></category>

		<guid isPermaLink="false">http://blog.ianbeyer.com/?p=1116</guid>
		<description><![CDATA[I&#8217;m currently working on setting up Wowza on an EC2 &#8220;Cluster Compute Quadruple Extra Large&#8221; instance (or as I&#8217;ve heard it called, the &#8220;super-duper-quadruple&#8221;, which sounds like something I&#8217;d get at Five Guys). There&#8217;s no pre-built AMI for this one, so you have to use a stock Linux image (I use the  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m currently working on setting up Wowza on an EC2 &#8220;Cluster Compute Quadruple Extra Large&#8221; instance (or as I&#8217;ve heard it called, the &#8220;super-duper-quadruple&#8221;, which sounds like something I&#8217;d get at Five Guys). There&#8217;s no pre-built AMI for this one, so you have to use a stock Linux image (I use the standard Amazon one) and install Wowza with a subscription license, and do the tuning yourself. But the payoff is this: for $1.30 an hour, you get a streaming server capable of delivering 10Gbps of data.  On a 750Kbps stream, that&#8217;s over 13,000 concurrent clients. This for about the same cost as nine or ten m1.small instances which can deliver an aggregate of about 1.5Gbps. On a reserved instance, you can get this down to just under 75 cents an hour.</p>
<p>In addition to Ludicrous Speed on the network I/O, this instance comes with 8 multithreaded Xeon 5570 cores (at 2.97GHz), 23 GB of RAM, and 1.7TB of local storage. (a quick speed test downloaded a half-gigabyte file in about four seconds, limited by the gigabit interface at the remote server). This is roughly equivalent to a moderately configured Dell R710. There&#8217;s also a GPU-enabled version of this that adds a pair of nVidia Tesla GPU cores.</p>
<p>If that&#8217;s not enough, you can go bigger, with 16 cores, 60GB of memory, and 3.5TB, Recently, someone clustered just over a thousand of these instances into the 42nd largest supercomputer in the world.</p>
<p>As of right now, these monster instances are only available in the us-east-1 zone.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbeyer.com/2012/01/21/go-big-or-go-home/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>PHP Direct Upload to S3</title>
		<link>http://blog.ianbeyer.com/2012/01/19/php-direct-upload-s3/</link>
		<comments>http://blog.ianbeyer.com/2012/01/19/php-direct-upload-s3/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 16:12:05 +0000</pubDate>
		<dc:creator>Ian Beyer</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[amazon]]></category>
		<category><![CDATA[AWS]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[S3]]></category>

		<guid isPermaLink="false">http://blog.ianbeyer.com/?p=1101</guid>
		<description><![CDATA[Here&#8217;s an easy way to upload directly to S3 from an HTML form. No Java, no Flash. Thanks to @RaamDev for his handy little bit of code for doing HMAC signatures. Based on the documentation from Amazon. Makes use of the AWS SDK for PHP to list the buckets.
Screen shots:


code:


success.php:


]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an easy way to upload directly to S3 from an HTML form. No Java, no Flash. Thanks to <a title="@RaamDev" href="http://twitter.com/raamdev" target="_blank">@RaamDev</a> for his handy little bit of <a title="S3 HMAC Signatures without PEAR" href="http://raamdev.com/2008/amazon-s3-hmac-signatures-without-pear-or-php5/" target="_blank">code for doing HMAC signatures</a>. Based on the <a title="Browser Uploads to S3 using HTML POST Forms" href="http://aws.amazon.com/articles/1434" target="_blank">documentation from Amazon</a>. Makes use of the <a title="Amazon Web Services SDK for PHP" href="http://aws.amazon.com/sdkforphp/" target="_blank">AWS SDK for PHP</a> to list the buckets.<br />
<P>Screen shots:<BR><br />
<div id="attachment_1107" class="wp-caption alignnone" style="width: 220px"><img src="http://blog.ianbeyer.com/files/2012/01/bucketselect.png" alt="" title="bucketselect" width="177" height="146" class="aligncenter size-full wp-image-1107" /><p class="wp-caption-text">Choosing a bucket</p></div><br />
<div id="attachment_1108" class="wp-caption alignnone" style="width: 220px"><img src="http://blog.ianbeyer.com/files/2012/01/file_select.png" alt="" title="file_select" width="230" height="137" class="alignnone size-full wp-image-1108" /><p class="wp-caption-text">File Selection</p></div><br />
<div id="attachment_1109" class="wp-caption alignnone" style="width: 220px"><img src="http://blog.ianbeyer.com/files/2012/01/File_selected.png" alt="" title="File_selected" width="210" height="133" class="size-full wp-image-1109" /><p class="wp-caption-text">After selecting the file</p></div><br />
<div id="attachment_1110" class="wp-caption alignnone" style="width: 578px"><img src="http://blog.ianbeyer.com/files/2012/01/uploadsuccess.png" alt="" title="uploadsuccess" width="568" height="99" class="size-full wp-image-1110" /><p class="wp-caption-text">Upload Confirmation</p></div>
</p>
<p><span id="more-1101"></span></p>
<p>code:</p>
<pre>
<pre class="brush: php; title: ; notranslate">

&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;Upload a file to S3&lt;/TITLE&gt;
&lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;H1&gt;S3 File Upload&lt;/H1&gt;

&lt;?php
error_reporting(0);
$accesskey='XXXXXXXXXXXXXXXX';
$secretkey='XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';

require_once 'AWSSDKforPHP/sdk.class.php';
if (!class_exists('CFRuntime')) die('No direct access allowed.');
CFCredentials::set(array(
        $name =&gt; array(
                'key' =&gt; $accesskey,
                'secret' =&gt; $secretkey,
                'certificate_authority' =&gt; false
        ),
        '@default' =&gt; $name
));

$s3 = new AmazonS3();

if(!isset($_GET['bucket'])) {
        echo &quot;&lt;P&gt;Please select a bucket:&lt;/P&gt;\n&quot;;
        $buckets=$s3-&gt;get_bucket_list();
        echo '&lt;FORM ACTION=&quot;#&quot;&gt;';
        foreach ($buckets as $b) { echo '&lt;INPUT TYPE=&quot;radio&quot; name=&quot;bucket&quot; value=&quot;'.$b.'&quot;&gt;'.$b.&quot;&lt;/INPUT&gt;&lt;BR&gt;\n&quot;; }
        echo '&lt;BR&gt;&lt;INPUT TYPE=&quot;submit&quot; VALUE=&quot;Use this bucket&quot;&gt;'.&quot;\n&quot;;

        } else {
        $bucket = $_GET['bucket'];

        $policy='
{&quot;expiration&quot;: &quot;2012-01-31T00:00:00Z&quot;,
  &quot;conditions&quot;: [
    {&quot;bucket&quot;: &quot;'.$bucket.'&quot;},
    [&quot;starts-with&quot;, &quot;$key&quot;, &quot;&quot;],
    {&quot;acl&quot;: &quot;public-read&quot;},
    {&quot;success_action_redirect&quot;: &quot;http://mt.cdnbuilder.com/s3uploader/success.php&quot;},
    [&quot;starts-with&quot;, &quot;$Content-Type&quot;, &quot;&quot;]
  ]
}';

/*
 * Calculate HMAC-SHA1 according to RFC2104
 * See http://www.faqs.org/rfcs/rfc2104.html
 */
function hmacsha1($key,$data) {
    $blocksize=64;
    $hashfunc='sha1';
    if (strlen($key)&gt;$blocksize)
        $key=pack('H*', $hashfunc($key));
    $key=str_pad($key,$blocksize,chr(0x00));
    $ipad=str_repeat(chr(0x36),$blocksize);
    $opad=str_repeat(chr(0x5c),$blocksize);
    $hmac = pack(
                'H*',$hashfunc(
                    ($key^$opad).pack(
                        'H*',$hashfunc(
                            ($key^$ipad).$data

                        )
                    )
                )
            );
    return bin2hex($hmac);
}

/*
 * Used to encode a field for Amazon Auth
 * (taken from the Amazon S3 PHP example library)
 */
function hex2b64($str)
{
    $raw = '';
    for ($i=0; $i &lt; strlen($str); $i+=2)
    {
        $raw .= chr(hexdec(substr($str, $i, 2)));
    }
    return base64_encode($raw);
}

/* Create the Amazon S3 Policy that needs to be signed */

/*
 * Base64 encode the Policy Document and then
 * create HMAC SHA-1 signature of the base64 encoded policy
 * using the secret key. Finally, encode it for Amazon Authentication.
 */
$base64_policy = base64_encode($policy);
$signature = hex2b64(hmacsha1($secretkey, $base64_policy));

?&gt;
    &lt;form action=&quot;https://&lt;?=$bucket?&gt;.s3.amazonaws.com/&quot; method=&quot;post&quot; enctype=&quot;multipart/form-data&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;key&quot; value=&quot;${filename}&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;AWSAccessKeyId&quot; value=&quot;&lt;?=$accesskey;?&gt;&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;acl&quot; value=&quot;public-read&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;success_action_redirect&quot; value=&quot;http://your.server.here/success.php&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;policy&quot; value=&quot;&lt;?=$base64_policy?&gt;&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;signature&quot; value=&quot;&lt;?=$signature?&gt;&quot;&gt;
      &lt;input type=&quot;hidden&quot; name=&quot;Content-Type&quot; value=&quot;image/jpeg&quot;&gt;
      &lt;!-- Include any additional input fields here --&gt;

      &lt;input name=&quot;file&quot; type=&quot;file&quot;&gt;
      &lt;br&gt;
      &lt;input type=&quot;submit&quot; value=&quot;Upload File to S3 bucket &lt;?=$bucket?&gt;&quot;&gt;
    &lt;/form&gt;
        &lt;P&gt;&lt;A HREF=&quot;.&quot;&gt;Use a different bucket&lt;/A&gt;&lt;/P&gt;
&lt;?php
}
?&gt;
  &lt;/body&gt;
&lt;/html&gt;
</pre>
</pre>
<p>success.php:</p>
<pre>
<pre class="brush: php; title: ; notranslate">
&lt;HTML&gt;
&lt;HEAD&gt;
&lt;TITLE&gt;Upload Success!&lt;/TITLE&gt;
&lt;link href=&quot;style.css&quot; rel=&quot;stylesheet&quot; type=&quot;text/css&quot; /&gt;
&lt;/HEAD&gt;
&lt;BODY&gt;
&lt;H1&gt;Upload Success!&lt;/H1&gt;

&lt;?php

echo &quot;&lt;P&gt;Successfully uploaded &quot;.$_GET['key'].&quot; to bucket &quot;.$_GET['bucket'].&quot;.&lt;/P&gt;\n&quot;;
$url = &quot;https://&quot;.$_GET['bucket'].&quot;.s3.amazonaws.com/&quot;.$_GET['key'];
echo '&lt;P&gt;Direct URL to the file is &lt;A HREF=&quot;'.$url.'&quot;&gt;'.$url.&quot;&lt;/A&gt;&lt;/P&gt;\n&quot;;

include '../footer.php';
?&gt;
&lt;/BODY&gt;
&lt;/HTML&gt;
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbeyer.com/2012/01/19/php-direct-upload-s3/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Wowza 3 Startup Packages</title>
		<link>http://blog.ianbeyer.com/2012/01/16/new-wowza-3-startup-packages/</link>
		<comments>http://blog.ianbeyer.com/2012/01/16/new-wowza-3-startup-packages/#comments</comments>
		<pubDate>Mon, 16 Jan 2012 17:43:49 +0000</pubDate>
		<dc:creator>Ian Beyer</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[Wowza]]></category>
		<category><![CDATA[ec2]]></category>

		<guid isPermaLink="false">http://blog.ianbeyer.com/?p=1099</guid>
		<description><![CDATA[Wowza has just updated its repository of startup packages to include pacakges specific to version 3. Get them here:
http://wowzamediasystems.s3.amazonaws.com/packagelist.html
]]></description>
			<content:encoded><![CDATA[<p>Wowza has just updated its repository of startup packages to include pacakges specific to version 3. Get them here:</p>
<p>http://wowzamediasystems.s3.amazonaws.com/packagelist.html</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbeyer.com/2012/01/16/new-wowza-3-startup-packages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wowza Stats &#8211; Single Server</title>
		<link>http://blog.ianbeyer.com/2012/01/13/wowza-stats-single-server/</link>
		<comments>http://blog.ianbeyer.com/2012/01/13/wowza-stats-single-server/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 19:24:53 +0000</pubDate>
		<dc:creator>Ian Beyer</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ianbeyer.com/?p=1095</guid>
		<description><![CDATA[Here&#8217;s the code for gathering Wowza Stats from a single server. This assumes that you&#8217;ve enabled the stats on Wowza (serverinfo, connectioncounts in VHost.xml HTTPProviders), with authentication turned off). You&#8217;ll also get better detailed stats if you use Andrew Kennedy&#8217;s CasterStats module for  [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the code for gathering Wowza Stats from a single server. This assumes that you&#8217;ve enabled the stats on Wowza (serverinfo, connectioncounts in VHost.xml HTTPProviders), with authentication turned off). You&#8217;ll also get better detailed stats if you use <a title="Andrew Kennedy CasterStats" href="http://www.shamrock.org.uk/WowzaModules/CasterStats/">Andrew Kennedy&#8217;s CasterStats module </a>for the serverinfo.</p>
<p><span id="more-1095"></span></p>
<pre>
<pre class="brush: xml; title: ; notranslate">
                                        &lt;HTTPProvider&gt;
                                                &lt;BaseClass&gt;com.wowza.wms.plugin.test.HTTPServerInfo&lt;/BaseClass&gt;
                                                &lt;RequestFilters&gt;serverinfo*&lt;/RequestFilters&gt;
                                                &lt;AuthenticationMethod&gt;none&lt;/AuthenticationMethod&gt;
                                        &lt;/HTTPProvider&gt;
                                        &lt;HTTPProvider&gt;
                                                &lt;BaseClass&gt;com.wowza.wms.http.HTTPConnectionInfo&lt;/BaseClass&gt;
                                                &lt;RequestFilters&gt;connectioninfo*&lt;/RequestFilters&gt;
                                                &lt;AuthenticationMethod&gt;none&lt;/AuthenticationMethod&gt;
                                        &lt;/HTTPProvider&gt;
                                        &lt;HTTPProvider&gt;
                                                &lt;BaseClass&gt;com.wowza.wms.http.HTTPConnectionCountsXML&lt;/BaseClass&gt;
                                                &lt;RequestFilters&gt;connectioncounts*&lt;/RequestFilters&gt;
                                                &lt;AuthenticationMethod&gt;none&lt;/AuthenticationMethod&gt;
                                        &lt;/HTTPProvider&gt;
  </pre>
</pre>
<p>PHP code:</p>
<pre>
<pre class="brush: php; title: ; notranslate">
&lt;?PHP
error_reporting(0);
header(&quot;Content-type: text/html; charset=utf-8&quot;);

$detailed = false;
$graph_load = false;
$simple_load = false;
$simple_count = false;
$stream_count = false;
$geo_count = false;
$count = false;
$load = false;
$form = true;

if (isset($_GET['server'])) { $repeater = $_GET['server']; $form = false;} 

if (isset($_GET['mode'])) {
	switch ($_GET['mode']) {
		case &quot;detailed&quot;:  $detailed = true; $count=true; break;
		case &quot;graph_load&quot; : $graph_load = true; $load = true; break;
		case &quot;simple_load&quot; : $simple_load = true; $load = true; break;
		case &quot;simple_count&quot; : $simple_count = true; $load = true; break;
		case &quot;geo_count&quot; : $geo_count = true; $count = true; break;
		case &quot;stream_count&quot; : $stream_count = true; $count = true; break;
	}
	$form = false;
} else { $form = true; }
if (isset($_GET['port'])) { $adminport = $_GET['port'];} else { $adminport='8086'; }

if ($form) {

?&gt;
&lt;HTML&gt;
 &lt;HEAD&gt;
  &lt;TITLE&gt;Single-Server Metrics&lt;/TITLE&gt;
 &lt;/HEAD&gt;
 &lt;BODY&gt;
  &lt;H3&gt;Single-Server Stats Gathering&lt;/H3&gt;
  &lt;FORM ACTION=&quot;#&quot; METHOD=&quot;GET&quot;&gt;
   &lt;P&gt;Server Address:&lt;BR&gt;
   &lt;INPUT TYPE=&quot;text&quot; size=&quot;15&quot; value=&quot;&lt;?=$repeater;?&gt;&quot; name=&quot;server&quot;&gt;&lt;/P&gt;
   &lt;P&gt;Admin Port&lt;BR&gt;
   &lt;INPUT TYPE=&quot;text&quot; size=&quot;15&quot; value=&quot;8086&quot; name=&quot;port&quot;&gt;&lt;/P&gt;
   &lt;P&gt;Data to display: &lt;BR&gt;
   &lt;INPUT TYPE=&quot;radio&quot; name=&quot;mode&quot; value=&quot;detailed&quot;&gt;Detailed Count&lt;/INPUT&gt;&lt;BR&gt;
   &lt;INPUT TYPE=&quot;radio&quot; name=&quot;mode&quot; value=&quot;graph_load&quot;&gt;Load Graph&lt;/INPUT&gt;&lt;BR&gt;
   &lt;INPUT TYPE=&quot;radio&quot; name=&quot;mode&quot; value=&quot;simple_load&quot;&gt;Load in Mbps&lt;/INPUT&gt;&lt;BR&gt;
   &lt;INPUT TYPE=&quot;radio&quot; name=&quot;mode&quot; value=&quot;simple_count&quot;&gt;Simple Count&lt;/INPUT&gt;&lt;BR&gt;
   &lt;INPUT TYPE=&quot;radio&quot; name=&quot;mode&quot; value=&quot;geo_count&quot;&gt;Geographical Count&lt;/INPUT&gt;&lt;BR&gt;
   &lt;INPUT TYPE=&quot;radio&quot; name=&quot;mode&quot; value=&quot;stream_count&quot;&gt;Stream Count&lt;/INPUT&gt;&lt;BR&gt;
   &lt;BR&gt;
   &lt;INPUT TYPE=&quot;submit&quot; Value=&quot;Show Me The Data&quot;&gt;
  &lt;/FORM&gt;
 &lt;/BODY&gt;
&lt;/HTML&gt;

&lt;?php 

} else {

// Iterate through IP address array
// initialize counters
$agent['iPhone']=0;
$agent['iPad']=0;
$agent['iPod']=0;
$agent['stagefright']=0;
$agent['Roku']=0;
$agent['Flash']=0;

$proto['RTMP']=0;
$proto['RTSP']=0;
$proto['HLS']=0;
$proto['2']=0;
$proto['3']=0;
$proto['4']=0;
$server_bwin = 0;
$server_bwout = 0;
$server_conns = 0;

if ($graph_load) { echo &quot;&lt;H3&gt;Server Load&lt;/H3&gt;&quot;; }

	$filter = array(
        	&quot;Name&quot; =&gt; 'ip-address',
        	&quot;Value&quot; =&gt; $repeater
        	);
	$opts = array (
        	&quot;Filter&quot; =&gt; $filter
        	);

	if($load) { // compute load per server

                $repeaterurl = &quot;http://$repeater:$adminport/connectioncounts&quot;;
                $repeaterxml = simplexml_load_file($repeaterurl);

                foreach ($repeaterxml-&gt;VHost as $vhost) {
                        foreach ($vhost-&gt;Application as $app) { // parse bandwidth usage by app in case we want it.
				$appname = (string)$app-&gt;Name;
				if ($app-&gt;Status == &quot;Loaded&quot;) {
					$inbytes = (string)$app-&gt;MessagesInBytesRate;
					$outbytes = (string)$app-&gt;MessagesOutBytesRate;
					$bwin[$appname] = $inbytes / 131072; // Convert Bps to Mbps
					$bwout[$appname] = $outbytes / 131027; // Convert Bps to Mbps
				}
			} // End App Loop
		} // End VHost Loop
		$server_bwin = (string)$repeaterxml-&gt;MessagesInBytesRate / 131072; // Convert Bps to Mbps
		$server_bwout = (string)$repeaterxml-&gt;MessagesOutBytesRate / 131072; // Convert Bps to Mbps
		$server_conns = $repeaterxml-&gt;ConnectionsCurrent;

		if ($graph_load) {
			$server_load = $server_bwout / 1024 * 100; // convert to percentage

			$load_string = sprintf(&quot;%.2f&quot;,$server_load);
			$bwout_string = sprintf(&quot;%.3f&quot;,$server_bwout);
			$load_round = round($server_load);

			switch ($server_load) {
				case ($server_load &gt; 99): $color = &quot;black&quot;; $heavy = true; break;
				case ($server_load &gt;= 85): $color = &quot;red&quot;; $heavy = true; break;
				case ($server_load &gt;= 75): $color = &quot;yellow&quot;; break;
				default: $color = &quot;green&quot;;
				}
				$info = '&lt;A HREF=&quot;http://'.$repeater.':$adminport/serverinfo.xml&quot; target=&quot;_blank&quot;&gt;'.$repeater.'&lt;/A&gt;: &lt;B&gt;'. $load_string .&quot;%&lt;/B&gt; with &quot;. $server_conns . &quot; connections (&quot;. $bwout_string .&quot; Mbps out)&quot;;
				print &quot;&lt;P&gt;&quot; . $info . &quot;&lt;/P&gt;&quot;; 

			?&gt;
			&lt;DIV style=&quot;height: 5px; background: none repeat scroll 0% 0% #ffffff; border: 2px solid;&quot;&gt;
				&lt;DIV style=&quot;height: 100%; background: &lt;?=$color?&gt;; color: black; width: &lt;?=$load_round?&gt;%;&quot;&gt;&lt;/div&gt;
			&lt;/div&gt;
			&lt;?php

		} // End Load Graph

	} // End Bandwidth Loop

	if($count) {
		$repeaterurl = &quot;http://$repeater:$adminport/serverinfo&quot;;
		$repeaterxml = simplexml_load_file($repeaterurl);

		foreach ($repeaterxml-&gt;VHost as $vhost) {
			foreach ($vhost-&gt;Application as $app) {
				foreach ($app-&gt;ApplicationInstance as $instance) {
					foreach ($instance-&gt;Client as $client) {
						// Skip repeaters and encoders - FMS is already filtered out by the HTTPProvider
						$skip = false; // Init variable
						if (preg_match('(Repeater)',$client-&gt;Referrer)) { $skip = true; }
						if (preg_match('(Kulabyte)',$client-&gt;Referrer)) { $skip = true; }

						if (!$skip) {
							$protocol = (string)$client-&gt;Protocol;
							$proto[$protocol]++;
							$streamnames = (string)$client-&gt;StreamNames;
							$streamarray=explode(&quot;/&quot;,$streamnames);
							$str_array_len=sizeof($streamarray);

							$str_end_index = $str_array_len -1;
							$strname = $streamarray[$str_end_index];

							if ($streamarray[0] == &quot;amazons3&quot;) {
								$vod[$strname]++;
								} else {
								$live[$strname]++;
								}
							$client_list[] = (string)$client-&gt;IpAddress;

							if ($detailed) {

								if ($client-&gt;UserAgent) // HTML clients will have a useragent defined
									{
										echo $client-&gt;IpAddress.&quot;: &quot;.$client-&gt;UserAgent .&quot;&lt;BR&gt;\n&quot;;
										if (preg_match('(Roku)',$client-&gt;UserAgent)) { $agent['Roku']++; }
										if (preg_match('(iPhone)',$client-&gt;UserAgent)) { $agent['iPhone']++; }
										if (preg_match('(iPad)',$client-&gt;UserAgent)) { $agent['iPad']++; }
										if (preg_match('(iPod)',$client-&gt;UserAgent)) { $agent['iPod']++; }
										if (preg_match('(stagefright)',$client-&gt;UserAgent)) { $agent['Android']++; }

									} 

								if ($client-&gt;FlashVersion) // Flash clients will have a different string.
									{
										echo $client-&gt;IpAddress.&quot;: Flash version &quot; . $client-&gt;FlashVersion .&quot;&lt;BR&gt;\n&quot;;
										$agent['Flash']++;
										}
								}	//Client Details
							} // Detailed Loop
					} //Client Loop
				} //Instance Loop
			} // App Loop
		} //VHost Loop

	} // Count Loop

if ($geo_count) {

	print &quot;&lt;H3&gt;Client Connections&lt;/H3&gt;\n&quot;;
	echo &quot;&lt;SMALL&gt;Last Refresh: &quot;;
	echo $date = date(&quot;Y-m-d H:i:s&quot;);
	echo &quot;&lt;/SMALL&gt;\n&quot;;

	foreach($client_list as $client_ip) {
		$geo_record = geoip_record_by_name($client_ip);
		$cn = $geo_record['country_name'];
		$cc = strtolower($geo_record['country_code']);
		if ($cc == &quot;us&quot;) {
			$sn = $geo_record['region'];
			$state_total[$sn]++;
			}

		$country_name[$cc]=$cn;
		$country_total[$cc]++;
	} //End Client iteration
	arsort($country_total);
	print '&lt;DIV class=&quot;countries&quot;&gt;'.&quot;\n&quot;;
	print '&lt;H4&gt;Countries&lt;/H4&gt;'.&quot;\n&quot;;
	foreach (array_keys($country_total) as $ccode) {
		print '&lt;IMG SRC=&quot;images/flags/'.$ccode.'.png&quot;&gt;&amp;nbsp;';
		print &quot;$country_name[$ccode] : &quot;.$country_total[$ccode].&quot;&lt;BR&gt;\n&quot;;
	} // End Country iteration
	print '&lt;/DIV&gt;';

	arsort($state_total);
	print '&lt;DIV class=&quot;states&quot;&gt;'.&quot;\n&quot;;
	print '&lt;H4&gt;States&lt;/H4&gt;'.&quot;\n&quot;;
	foreach (array_keys($state_total) as $state) {
		print &quot;$state : &quot;.$state_total[$state].&quot;&lt;BR&gt;\n&quot;;
	} // End State iteration
	print '&lt;/DIV&gt;';

} // End Geo Loop

if ($detailed) {
	$agent['iOS'] = $agent['iPhone'] + $agent ['iPad'] + $agent['iPod'];
	echo &quot;&lt;BR&gt;\n&quot;;
	echo &quot;Total HLS Clients: &quot;. $proto['HLS'].&quot;&lt;BR&gt;\n&quot;;
	echo &quot;Total Roku clients: &quot;. $agent['Roku'].&quot;&lt;BR&gt;\n&quot;;
	echo &quot;Total iOS clients: &quot;. $agent['iOS'] .&quot; (&quot;.$agent['iPhone'].&quot; iPhone,&quot;. $agent['iPad'].&quot; iPad,&quot;. $agent['iPod'].&quot; iPod)&lt;BR&gt;\n&quot;;
	echo &quot;Total RTMP clients: &quot;. $proto['RTMP'].&quot; (&quot;. $agent['Flash'] .&quot; Flash)&lt;BR&gt;\n&quot;;
} // Detailed Loop

if ($simple_load) { printf(&quot;%.3f&quot;, $server_bwout); }

if ($simple_count) { print $server_conns; }

if ($stream_count) {
	print &quot;&lt;h3&gt;Stream Connections&lt;/h3&gt;\n&quot;;
	arsort($live);
	arsort($vod);
	print &quot;&lt;DIV CLASS=\&quot;live\&quot;&gt;&lt;h4&gt;Live&lt;/h4&gt;\n&quot;;
        foreach (array_keys($live) as $lstr) { print strtoupper($lstr).&quot; : &quot;.$live[$lstr].&quot;&lt;BR&gt;\n&quot;; }
	print &quot;&lt;/DIV&gt;&lt;DIV CLASS=\&quot;vod\&quot;&gt;&lt;h4&gt;On-Demand&lt;/h4&gt;\n&quot;;
        foreach (array_keys($vod) as $vstr) { print strtoupper($vstr).&quot; : &quot;.$vod[$vstr].&quot;&lt;BR&gt;\n&quot;; }
	print &quot;&lt;/DIV&gt;&quot;;
}

}

?&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbeyer.com/2012/01/13/wowza-stats-single-server/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Switching Live Streams</title>
		<link>http://blog.ianbeyer.com/2012/01/10/switching-live-streams/</link>
		<comments>http://blog.ianbeyer.com/2012/01/10/switching-live-streams/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 04:00:21 +0000</pubDate>
		<dc:creator>Ian Beyer</dc:creator>
				<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[CSS]]></category>
		<category><![CDATA[javascript]]></category>

		<guid isPermaLink="false">http://blog.ianbeyer.com/?p=1083</guid>
		<description><![CDATA[Continuing on the rack theme mentioned yesterday, I got to wondering about a stream monitor that could be switched to any of a number of live streams, without reloading the page. Fortunately, JW Player makes this easy. I threw together a player embedded inside some CSS and then added a button  [...]]]></description>
			<content:encoded><![CDATA[<p>Continuing on the rack theme mentioned yesterday, I got to wondering about a stream monitor that could be switched to any of a number of live streams, without reloading the page. Fortunately, JW Player makes this easy. I threw together a player embedded inside some CSS and then added a button panel. Each button is a DIV with an <em>onclick()</em> action that calls <em>jwplayer().load()</em>. While it&#8217;s well known that you can use this to switch files simply by passing the filename to the <em>file</em> flashvar, we need to also pass the <em>streamer</em> value. Fortunately, the <em>load()</em> method has the ability to pass on not only files as a string value, but also objects, which are nothing more than an array of flashvars (it can also take playlist items, but that&#8217;s beyond the scope of this post). So, all you need to do in order to switch streams with JW Player is call the following JavaScript method:</p>
<pre>jwplayer().load({file: 'streamname', streamer: 'rtmp://w.streampunk.tv/live'})</pre>
<p><span style="color: #333333; font-style: normal; line-height: 24px;">The result I got was this:</span><img class="aligncenter size-full wp-image-1085" title="Rack Monitor" src="http://blog.ianbeyer.com/files/2012/01/rackmonitorscreencap.png" alt="" width="606" height="384" />Clicking on each of the buttons in the bar below the screen will switch the stream. A <a title="Stream Switch Example" href="http://v.streampunk.tv/jw/blog.html" target="_blank">live example can be found here</a>. If you want to see what else the JWPlayer API can do, head on over to the <a title="JW Player JavaScript API Documentation" href="http://www.longtailvideo.com/support/jw-player/jw-player-for-flash-v5/12540/javascript-api-reference" target="_blank">API docs</a>. FlowPlayer appears to have something similar in the <i>clip.update()</I> method (<A HREF="http://flowplayer.org/documentation/api/clip.html" target="_blank">flowplayer API documentation</A>), but I haven&#8217;t tested it. </p>
<p>Page code:</p>
<pre>
<pre class="brush: xml; title: ; notranslate">

&lt;!DOCTYPE HTML PUBLIC &quot;-//W3C//DTD HTML 4.01 Transitional//EN&quot;&gt;
&lt;html xmlns=&quot;http://www.w3.org/1999/xhtml&quot;&gt;
&lt;head&gt;

	&lt;title&gt;JW Player Switching&lt;/title&gt;

	&lt;style type=&quot;text/css&quot;&gt;
		body { background-color: #fff; padding: 0 20px; color:#000; font: 13px/18px Arial, sans-serif; }
		a { color: #360; }
		h3 { padding-top: 20px; }
		ol { margin:5px 0 15px 16px; padding:0; list-style-type:square; }
	&lt;/style&gt;

&lt;/head&gt;
&lt;body&gt;
	&lt;!-- START OF THE PLAYER EMBEDDING TO COPY-PASTE --&gt;
	&lt;div class=&quot;rack&quot; style=&quot;width: 600px;&quot;&gt;
	&lt;div class=&quot;rackmonitor&quot; style=&quot;width: 600px; height: 323px; background-image: url('rackmonitor.png'); position: relative&quot;&gt;
	&amp;nbsp;
	&lt;div class=&quot;screen&quot; style=&quot;width: 455px; height: 275px; position: absolute; left: 60px; top: 28px;&quot;&gt;
	&lt;div id=&quot;mediaplayer&quot;&gt;Player...&lt;/div&gt;
	&lt;script type=&quot;text/javascript&quot; src=&quot;/jwplayer/jwplayer.js&quot;&gt;&lt;/script&gt;
	&lt;script type=&quot;text/javascript&quot;&gt;
		jwplayer(&quot;mediaplayer&quot;).setup({
			flashplayer: &quot;/jwplayer/player.swf&quot;,
			height: &quot;275&quot;,
			width: &quot;455&quot;,
			file: &quot;commons.stream&quot;,
			streamer: &quot;rtmp://w.streampunk.tv/live&quot;,
			autostart: true,
			controlbar: 'none',
			mute: true
		});
	&lt;/script&gt;
	&lt;/div&gt;
	&lt;/div&gt;
	&lt;/div&gt;
	&lt;div class=&quot;panel&quot;
	style=&quot;width: 600px;
	height: 57px;
	background-image: url('blankPanel.png');
	position: relative
	&quot;&gt;
		&lt;div class=&quot;button1&quot;
		style=&quot;width: 75px;
		height: 20px;
		position: absolute;
		left: 50px;
		top: 20px;
		border-radius: 10px;
		background-color: #009900;
		color: #cccccc;
		border: 1px solid black;
		text-align: center;&quot;
		onclick=&quot;jwplayer().load({file: 'playlist-high', streamer: 'rtmp://wms.rezonline.org/redirect'})
		&quot;&gt;
		RezOnline
		&lt;/div&gt;
		&lt;div class=&quot;button2&quot;
		style=&quot;width: 75px;
		height: 20px;
		position: absolute;
		left: 150px;
		top: 20px; border-radius: 10px;
		background-color: #009900;
		color: #cccccc;
		border: 1px solid black;text-align: center;&quot;
		onclick=&quot;jwplayer().load({file: 'commons.stream', streamer: 'rtmp://w.streampunk.tv/live'})
		&quot;&gt;
		Commons
		&lt;/div&gt;
		&lt;div class=&quot;button3&quot;
		style=&quot;width: 75px;
		height: 20px;
		position: absolute;
		left: 250px;
		top: 20px; border-radius: 10px;
		background-color: #990000;
		color: #cccccc;
		border: 1px solid black;text-align: center;&quot;
		onclick=&quot;jwplayer().load({file: 'streamclass', streamer: 'rtmp://w.streampunk.tv/live'})
		&quot;&gt;
		StreamClass
		&lt;/div&gt;
		&lt;div class=&quot;button4&quot;
		style=&quot;width: 75px;
		height: 20px;
		position: absolute;
		left: 350px;
		top: 20px; border-radius: 10px;
		background-color: #990000;
		color: #cccccc;
		border: 1px solid black;text-align: center;&quot;
		onclick=&quot;jwplayer().load({file: 'aircam.stream', streamer: 'rtmp://w.streampunk.tv/live'})
		&quot;&gt;
		AirCam
		&lt;/div&gt;
	&lt;/div&gt;
&lt;/body&gt;
&lt;/html&gt;
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbeyer.com/2012/01/10/switching-live-streams/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Stupid CSS Tricks: Wowza Load Graphs</title>
		<link>http://blog.ianbeyer.com/2012/01/09/css-wowza-load-graphs/</link>
		<comments>http://blog.ianbeyer.com/2012/01/09/css-wowza-load-graphs/#comments</comments>
		<pubDate>Mon, 09 Jan 2012 03:48:58 +0000</pubDate>
		<dc:creator>Ian Beyer</dc:creator>
				<category><![CDATA[Web 2.0]]></category>
		<category><![CDATA[Wowza]]></category>
		<category><![CDATA[CSS]]></category>

		<guid isPermaLink="false">http://blog.ianbeyer.com/?p=1066</guid>
		<description><![CDATA[I&#8217;ve been experimenting with ways to generate load graphs for Wowza. The best way for doing bar graphs on a webpage is to go all crazy with CSS. It&#8217;s really well suited to doing this. Here&#8217;s a PHP script that will query a Wowza origin server for its repeaters, and then polls the repeaters for their  [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been experimenting with ways to generate load graphs for Wowza. The best way for doing bar graphs on a webpage is to go all crazy with CSS. It&#8217;s really well suited to doing this. Here&#8217;s a PHP script that will query a Wowza origin server for its repeaters, and then polls the repeaters for their load stats. This also provides buttons for launching/terminating repeaters, and visually representing them as a rack full of servers:</p>
<p><a href="http://blog.ianbeyer.com/files/2012/01/loadrack21.png"><img class="aligncenter size-full wp-image-1071" title="loadrack2" src="http://blog.ianbeyer.com/files/2012/01/loadrack21.png" alt="" width="609" height="145" /></a></p>
<p><span id="more-1066"></span></p>
<p>You can get really crazy with this. For example, here&#8217;s a farm of 14 servers:<img class="aligncenter size-full wp-image-1073" title="BigRack" src="http://blog.ianbeyer.com/files/2012/01/BigRack.png" alt="" width="620" height="926" /></p>
<p>How do I do this?</p>
<p>The basic structure of my virtual rack is not unlike that of a real rack: The Rack Unit. In this case, it&#8217;s a DIV 60 pixels high and 700 pixels wide. It then contains a rack space which is 600 pixels wide, leaving me some room on the end to put something if I want to. The rack space div then uses the server image as a background. Inside that I have the display, power button, Wowza button (all three of these are simple absolute position DIV elements &#8211; the Wowza button is simply an empty DIV with rounded corners set to make it an actual circle, and then a TITLE attribute containing the build info of that particular server), and graph, which is the larger container div (with opacity set to be slightly transparent) that then has the smaller graph div, with the width set to the calculated load percentage.</p>
<p>Now, the code. Note that this requires the <A HREF="http://aws.amazon.com/sdkforphp/">AWS SDK for PHP</A> to be installed on your box (and apparently a prerequisite for that is a bowl of alphabet soup) Bear in mind that querying each server is going to take 2-3 seconds, so this doesn&#8217;t scale well (the 14-server graph made use of a variant of this script that gets edge data via SQL, making it much faster). I&#8217;d love to know if it&#8217;s possible to fork each of those getLoad() processes off so they can run in parallel.</p>
<p>syntax is:</p>
<pre>loadrack.php?origin=1.2.3.4</pre>
<p>loadrack.php:</p>
<pre>
<pre class="brush: php; title: ; notranslate">
&lt;?PHP
error_reporting(0);
require 'includes/aws-init.php';
include 'includes/capacity_vars.php';
require_once 'includes/functions.php';
header(&quot;Content-type: text/html; charset=utf-8&quot;);

$bwin = array();
$bwout = array();
$conn = array();
$cap = array();
$iid = array();
$ver = array();

if (isset($_GET['origin'])) { $origin_ip = $_GET['origin'];} else { die('No Origin Server Specified'); }

// Gather Data
$ip = getRepeaters($origin_ip);
$origin_ver = getVersion($origin_ip);

foreach ($ip as $repeater) {
	list($in, $out, $count) = getLoad($repeater);
	$bwin[$repeater] = $in;
	$bwout[$repeater] = $out;
	$conn[$repeater] = $count;
	$ver[$repeater]= getVersion($repeater);
	$size = &quot;m1.small&quot;; // can also query DB or AWS for this.
	$sz[$repeater] = $size;
	$iid[$repeater] = (string)$sizerow['IID'];
	$cap[$repeater] = $mbps[$size];
	}

} //End Repeater Foreach

// Display Summary

$total_cap = array_sum($cap);
$total_load = array_sum($bwout) / $total_cap * 100; // convert to percentage

$load_string = sprintf(&quot;%.2f&quot;,$total_load);
$bwout_string = sprintf(&quot;%.3f&quot;,array_sum($bwout));
$total['repeaters'] = sizeof($ip);
$total['conns'] = array_sum($conn);
$load_round = round($total_load);
switch ($total_load) {
	case ($total_load &gt; 99): $color = &quot;#000000&quot;; break;
	case ($total_load &gt;= 85): $color = &quot;#FF0000&quot;; break;
	case ($total_load &gt;= 75): $color = &quot;#FFFF00&quot;; break;
	default: $color = &quot;#00FF00&quot;;
	}
		$label = 'Origin | &lt;A style=&quot;color: black;&quot; HREF=&quot;http://'.$origin_ip.':1935/loadbalancer?serverInfoXML&quot; target=&quot;_blank&quot;&gt;'. $origin_ip . &quot;&lt;/A&gt;&quot;;

	?&gt;
		&lt;DIV class=&quot;rackslot&quot;
			style=&quot;height: 60px;
				width: 660px;
				position: relative;
				border: none;
				background: none;
				&quot;&gt;
		&lt;DIV class=&quot;server&quot;
			style=&quot;height: 60px;
				float: left;
				width: 600px;
				position: relative;
				background-image: url('images/rackserver2.jpg');
				&quot;&gt;
			&lt;DIV class=&quot;loadbar&quot;
				style=&quot;height: 10px;
				border-radius: 3px;
				opacity: 0.6;
				position: absolute;
				left: 46px;
				top: 42px;
				width: 500px;
				background: none repeat scroll 0% 0% #ffffff;
				border: 1px solid;
			&quot;&gt;
				&lt;DIV class=&quot;load&quot;
					style=&quot;height: 100%;
					border-radius: 2px;
					position: absolute;
					left: 0px;
					top: 0px;
					background: &lt;?=$color?&gt;;
					color: black;
					width: &lt;?=$load_round;?&gt;%;
				&quot;&gt;&lt;/div&gt;
			&lt;/div&gt;
			&lt;DIV class=&quot;display&quot;
				style=&quot;height: 22px;
					position: absolute;
					left: 44px;
					top: 12px;
					width: 145px;
					background-color: #2222FF;
					color: #CCCCFF;
					font-size: 8px;
					border: 1px solid black;
					border-radius: 3px;
					margin: 2px;
					font-family: sans-serif;
					padding: 1px;
			&quot;&gt;
				&lt;?=$total['conns'];?&gt; Connections (&lt;?=$total['repeaters'];?&gt; Edges)&lt;BR&gt;
				&lt;?=$bwout_string;?&gt; Mbps  (&lt;?=$load_string;?&gt; %)
			&lt;/DIV&gt;
			&lt;DIV class=&quot;label&quot;
				style=&quot;height: 13px;
					position: absolute;
					left: 350px;
					top: 10px;
					background-color: #eeeeee;
					color: black;
					text-align: center;
					font-size: 12px;
					font-family: sans-serif;
					padding: 2px;
			&quot;&gt;&lt;?=$label;?&gt;&lt;/DIV&gt;
			&lt;div class=&quot;powerbutton&quot;
				style=&quot;padding: 5px;
					position: absolute;
					left: 530px;
					top:8px;
					width: 30px;
					float: right;
			&quot;&gt;
&lt;form action=&quot;startup.php&quot; method=&quot;POST&quot; target=&quot;_blank&quot;&gt;
&lt;input type=&quot;hidden&quot; name=&quot;config&quot; value=&quot;repeater&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;version&quot; value=&quot;2&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;license&quot; value=&quot;devpay&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;zone&quot; value=&quot;us-east-1&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;elasticIP&quot; value=&quot;Dynamic&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;keypair&quot; value=&quot;Wowza-Keypair&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;security&quot; value=&quot;Wowza-SecGrp&quot; /&gt;
&lt;input type=&quot;hidden&quot; name=&quot;type&quot; value=&quot;m1.small&quot; /&gt;
&lt;input title=&quot;Start a default repeater&quot; type=&quot;image&quot; width=&quot;20&quot; height=&quot;20&quot; src=&quot;/images/power-green.png&quot; alt=&quot;Start Repeater&quot; /&gt;
&lt;/form&gt;

			&lt;/div&gt;
			&lt;div class=&quot;version&quot;
				title=&quot;&lt;?=$origin_ver;?&gt;&quot;
				style=&quot;position: absolute;
					left: 23px;
					top: 24px;
					width: 20px;
					height: 20px;
					border-radius: 10px;
					border: none;
			&quot;&gt;&lt;/DIV&gt;

		&lt;/div&gt;
	&lt;/div&gt;
&lt;?php

// Iterate through IP address array and display individual servers

foreach ($ip as $repeater) {
		$server_load = $bwout[$repeater] / $cap[$addr] * 100; // convert to percentage

		$load_string = sprintf(&quot;%.2f&quot;,$server_load);
		$bwout_string = sprintf(&quot;%.3f&quot;,$bwout[$repeater]);
		$load_round = round($server_load);

		switch ($server_load) {
			case ($server_load &gt; 99): $color = &quot;#000000&quot;; $heavy = true; break;
			case ($server_load &gt;= 85): $color = &quot;#FF0000&quot;; $heavy = true; break;
			case ($server_load &gt;= 75): $color = &quot;#FFFF00&quot;; break;
			default: $color = &quot;#00FF00&quot;;
			}
		$label = 'Edge | &lt;A style=&quot;color: black;&quot; HREF=&quot;http://'.$repeater.':8086/serverinfo.xml&quot; target=&quot;_blank&quot;&gt;'. $repeater . &quot;&lt;/A&gt;&quot;;
		$lcd = $conn[$repeater].&quot; Connections &lt;BR&gt;$bwout_string Mbps ($load_string%)&quot;;
		?&gt;
		&lt;DIV class=&quot;rackslot&quot;
			style=&quot;height: 60px;
				width: 660px;
				position: relative;
				border: none;
				background: none;
		&quot;&gt;
		&lt;DIV class=&quot;server&quot;
			style=&quot;height: 60px;
				width: 600px;
				float: left;
				position: relative;
				border: none;
				background-image: url('images/rackserver2.jpg');
		&quot;&gt;
			&lt;DIV class=&quot;loadbar&quot;
				style=&quot;height: 10px;
					border-radius: 3px;
					opacity: 0.6;
					position: absolute;
					left: 46px;
					top: 42px;
					width: 500px;
					background: none repeat scroll 0% 0% #ffffff;
					border: 1px solid;
			&quot;&gt;
				&lt;DIV class=&quot;load&quot;
					style=&quot;height: 100%;
						border-radius: 2px;
						position: absolute;
						left: 0px;
						top: 0px;
						background: &lt;?=$color?&gt;;
						width: &lt;?=$load_round;?&gt;%;
				&quot;&gt;
				&lt;/div&gt;
			&lt;/div&gt;
			&lt;DIV class=&quot;display&quot;
				style=&quot;height: 22px;
				border-radius: 3px;
				position: absolute;
				left: 46px;
				top: 14px;
				width: 145px;
				background-color: #2222FF;
				color: #CCCCFF;
				font-size: 8px;
				border: 1px solid black;
				font-family: sans-serif;
				padding: 1px;
			&quot;&gt;&lt;?=$lcd;?&gt;&lt;/DIV&gt;
			&lt;DIV class=&quot;label&quot;
				style=&quot;height: 13px;
					position: absolute;
					left: 350px;
					top: 10px;
					background-color: #eeeeee;
					color: black;
					text-align: center;
					font-size: 12px;
					font-family: sans-serif;
					padding: 2px;
			&quot;&gt;&lt;?=$label;?&gt;&lt;/DIV&gt;
			&lt;div class=&quot;powerbutton&quot;
				style=&quot;padding: 5px;
				 	position: absolute;
					left: 530px;
					top:8px;
					width: 30px;
					float: right;
			&quot;&gt;
				&lt;?php
					if ($repeater != $origin_ip) {
        				echo '&lt;FORM action=&quot;terminate.php&quot; method=&quot;POST&quot; target=&quot;_blank&quot;&gt;';
					echo '&lt;INPUT type=&quot;hidden&quot; name=&quot;instances[]&quot; value=&quot;'.$iid[$repeater].'&quot;&gt;';
					echo '&lt;INPUT type=&quot;image&quot; height=&quot;20&quot; width =&quot;20&quot; src=&quot;images/power-red.png&quot; TITLE=&quot;Terminate this server&quot;&gt;';
					echo '&lt;/FORM&gt;';
					}
					else
					{
					echo '&lt;FORM action=&quot;&quot;&gt;';
					echo '&lt;IMG SRC=&quot;images/power-gray.png&quot; height=&quot;20&quot; TITLE=&quot;Power control disabled on origin&quot;&gt;';
					echo '&lt;/FORM&gt;';
					}
				?&gt;
			&lt;/div&gt;

			&lt;div class=&quot;version&quot;
				title=&quot;&lt;?php echo $ver[$repeater].&quot; &quot;.$sz[$repeater].&quot; &quot;.$iid[$repeater];?&gt;&quot;
				style=&quot;position: absolute;
					left: 23px;
					top: 24px;
					width: 20px;
					height: 20px;
					border-radius: 10px;
					border: none;
			&quot;&gt;&lt;/DIV&gt;
		&lt;/div&gt;
	&lt;/DIV&gt;
&lt;?php

} // Repeater Loop
			echo &quot;&lt;SMALL&gt;Last Refresh: &quot;;
			echo $date = date(&quot;Y-m-d H:i:s&quot;);
			echo &quot;&lt;/SMALL&gt;\n&quot;;

?&gt;
</pre>
</pre>
<p>aws-init.php:</p>
<pre>
<pre class="brush: php; title: ; notranslate">
&lt;?php
require_once '/usr/share/php/AWSSDKforPHP/sdk.class.php';

define('AWS_KEY', $_SESSION['AWS_KEY']);
define('AWS_SECRET_KEY', $_SESSION['AWS_SECRET_KEY']);

        $startup_region = $_SESSION['DEFAULT_REGION'];

$ec2 = new AmazonEC2();

?&gt;
</pre>
</pre>
<p>functions.php:</p>
<pre>
<pre class="brush: php; title: ; notranslate">
function getRepeaters($origin_ip) {

	$addr = array();
	$lb = &quot;http://$origin_ip:1935/loadbalancer?serverInfoXML&quot;;
	$xml = simplexml_load_file($lb);

	if ($xml === FALSE) {
		return(&quot;&quot;);
	}

	$server = $xml-&gt;LoadBalancerServer;

	// Get IP addresses of active repeaters and put them in an array.
	foreach ($server as $rep) {
		$ip = (string)$rep-&gt;redirect;
		if ($rep-&gt;status == &quot;RUNNING&quot; or $rep-&gt;status ==&quot;PAUSED&quot;) {
			$addr[]=$ip;
		} // End Running If
	} // end Server foreach
	return($addr);
} // End Function

function getLoad($repeater) {

        $repurl = &quot;http://$repeater:1935/connectioncounts.xml&quot;;
        $repxml = simplexml_load_file($repurl);
        $bwin = (string)$repxml-&gt;MessagesInBytesRate / 131072; // Convert Bps to Mbps
        $bwout = (string)$repxml-&gt;MessagesOutBytesRate / 131072; // Convert Bps to Mbps
        $conns = (string)$repxml-&gt;ConnectionsCurrent+0;

	$data = array ($bwin, $bwout, $conns);

	return($data);

} // End Function

function getVersion($server) {
        $repurl = &quot;http://$server:1935/&quot;;
        $repxml = simplexml_load_file($repurl);
	$ver = (string)$repxml-&gt;body;

	return($ver);

} // End GetVersion Function
?&gt;
</pre>
</pre>
<p>capacity_vars.php:</p>
<pre>
<pre class="brush: php; title: ; notranslate">
&lt;?PHP
$mbps['m1.small']=150;
$mbps['m1.large']=250;
$mbps['m1.xlarge']=350;
?&gt;
</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbeyer.com/2012/01/09/css-wowza-load-graphs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Wowza Architecture Diagrams</title>
		<link>http://blog.ianbeyer.com/2012/01/02/wowza-architecture-diagrams/</link>
		<comments>http://blog.ianbeyer.com/2012/01/02/wowza-architecture-diagrams/#comments</comments>
		<pubDate>Mon, 02 Jan 2012 01:35:20 +0000</pubDate>
		<dc:creator>Ian Beyer</dc:creator>
				<category><![CDATA[Wowza]]></category>

		<guid isPermaLink="false">http://blog.ianbeyer.com/?p=1063</guid>
		<description><![CDATA[I&#8217;ve posted a couple of diagrams of Wowza&#8217;s architecture relating to repeaters and load balancing.
There&#8217;s also some additional information in the Wowza Media Server 3 Overview.
&#160;
]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve <a title="Wowza Architecture" href="http://blog.ianbeyer.com/arch/wowza/" target="_blank">posted a couple of diagrams</a> of Wowza&#8217;s architecture relating to repeaters and load balancing.</p>
<p>There&#8217;s also some additional information in the <a title="Wowza Media Server 3 Overview" href="http://www.wowza.com/resources/WowzaMediaServer3_Overview.pdf" target="_blank">Wowza Media Server 3 Overview</a>.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbeyer.com/2012/01/02/wowza-architecture-diagrams/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Site Migration Complete</title>
		<link>http://blog.ianbeyer.com/2011/12/29/site-migration-complete/</link>
		<comments>http://blog.ianbeyer.com/2011/12/29/site-migration-complete/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 18:55:05 +0000</pubDate>
		<dc:creator>Site Administrator</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ianbeyer.com/?p=893</guid>
		<description><![CDATA[Got all the pages moved over and the images all fixed, and took care of a number of broken links. If you see any problems, let me know.
]]></description>
			<content:encoded><![CDATA[<p>Got all the pages moved over and the images all fixed, and took care of a number of broken links. If you see any problems, let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbeyer.com/2011/12/29/site-migration-complete/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Site Migration</title>
		<link>http://blog.ianbeyer.com/2011/12/29/site-migration/</link>
		<comments>http://blog.ianbeyer.com/2011/12/29/site-migration/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 05:35:10 +0000</pubDate>
		<dc:creator>Site Administrator</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://blog.ianbeyer.com/?p=758</guid>
		<description><![CDATA[In the process of moving the site to a new hosting provider &#8211; bear with me. Still working on moving the images, they&#8217;ll start cropping up over the next few days.
&#160;
]]></description>
			<content:encoded><![CDATA[<p>In the process of moving the site to a new hosting provider &#8211; bear with me. Still working on moving the images, they&#8217;ll start cropping up over the next few days.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbeyer.com/2011/12/29/site-migration/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Wowza Media Server V3 for Amazon EC2</title>
		<link>http://blog.ianbeyer.com/2011/11/06/wowza-v3-for-ec2/</link>
		<comments>http://blog.ianbeyer.com/2011/11/06/wowza-v3-for-ec2/#comments</comments>
		<pubDate>Sun, 06 Nov 2011 23:56:14 +0000</pubDate>
		<dc:creator>Ian Beyer</dc:creator>
				<category><![CDATA[Cloud Computing]]></category>
		<category><![CDATA[streaming]]></category>
		<category><![CDATA[Wowza]]></category>

		<guid isPermaLink="false">http://blog.ianbeyer.com/?p=745</guid>
		<description><![CDATA[Wowza V3 pre-built AMIs are now available &#8211; The devpay licensing remains, as does the pricing. The new AMI listing can be found at the Wowza V3 for EC2 page. Wowza has also added pre-built AMIs for subscription licenses, which are priced at standard instance rates. The caveat is that on devpay, the  [...]]]></description>
			<content:encoded><![CDATA[<p>Wowza V3 pre-built AMIs are now available &#8211; The devpay licensing remains, as does the pricing. The new AMI listing can be found at the <a title="Wowza Media Server for EC2" href="http://www.wowza.com/forums/content.php?203" target="_blank">Wowza V3 for EC2 page</a>. Wowza has also added pre-built AMIs for subscription licenses, which are priced at standard instance rates. The caveat is that on devpay, the premium add-on modules won&#8217;t be available &#8211; if all you&#8217;re doing is what you were doing on V2, that won&#8217;t change anything for you.</p>
<p>The license key instances can also be used as a basis for your own custom images. License key can either be manually changed or included in your startup packages.</p>
]]></content:encoded>
			<wfw:commentRss>http://blog.ianbeyer.com/2011/11/06/wowza-v3-for-ec2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

