Difference between revisions of "Wowza Media Server"
m (8 revisions) |
|||
(6 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
+ | == Intro == | ||
+ | We use [http://www.wowzamedia.com/ Wowza Media Server] for the [[Collegedale Community Church Webcast]]. Specifically we use [http://www.wowzamedia.com/ec2.html Wowza Media Server for EC2] which works with [[Amazon EC2]]. | ||
+ | |||
== Graph Wowza Connection Statistics == | == Graph Wowza Connection Statistics == | ||
Problem: I wanted a way to trend connections to an Amazon EC2 Wowza streaming server instance even though we stop the server following each broadcast.<br> | Problem: I wanted a way to trend connections to an Amazon EC2 Wowza streaming server instance even though we stop the server following each broadcast.<br> | ||
Line 4: | Line 7: | ||
Solution: Create a script to retrieve and record the current connection count using http://ec2servername.com:1935 which is enabled by default on Wowza and use [http://www.melhuish.info/simon/projects/index.html#csv2png csv2png] to graph the recorded data.<br> | Solution: Create a script to retrieve and record the current connection count using http://ec2servername.com:1935 which is enabled by default on Wowza and use [http://www.melhuish.info/simon/projects/index.html#csv2png csv2png] to graph the recorded data.<br> | ||
<br> | <br> | ||
− | Alternative Solution: I recently came across | + | Alternative Solution #1: I recently came across this post about how to use rrdtool to graph connection statistics:<br> |
+ | http://blog.ianbeyer.com/archives/256<br> | ||
+ | <br> | ||
+ | Alternative Solution #2: The latest version of Wowza includes Cacti in the build. With a little scripting it should be possible to enable Cacti and copy off the resulting data files before stopping the instance in order to maintain more persistent statistical history. | ||
=== Get Statistics === | === Get Statistics === | ||
This script creates a log file with the date/time and the number of connections to the Wowza server. It then generates a graph from the log file. | This script creates a log file with the date/time and the number of connections to the Wowza server. It then generates a graph from the log file. |
Latest revision as of 21:03, 15 November 2010
Contents
Intro
We use Wowza Media Server for the Collegedale Community Church Webcast. Specifically we use Wowza Media Server for EC2 which works with Amazon EC2.
Graph Wowza Connection Statistics
Problem: I wanted a way to trend connections to an Amazon EC2 Wowza streaming server instance even though we stop the server following each broadcast.
Solution: Create a script to retrieve and record the current connection count using http://ec2servername.com:1935 which is enabled by default on Wowza and use csv2png to graph the recorded data.
Alternative Solution #1: I recently came across this post about how to use rrdtool to graph connection statistics:
http://blog.ianbeyer.com/archives/256
Alternative Solution #2: The latest version of Wowza includes Cacti in the build. With a little scripting it should be possible to enable Cacti and copy off the resulting data files before stopping the instance in order to maintain more persistent statistical history.
Get Statistics
This script creates a log file with the date/time and the number of connections to the Wowza server. It then generates a graph from the log file.
/bin/date +%F\ %T | tr -d '\n' >> [fullpath]/stats/`/bin/date +%F`_connections.log wget -t 1 -T 9 -O - http://ec2servername.com:1935 | sed 's/server=/,/' >> [fullpath]/stats/`/bin/date +%F`_connections.log echo >> [fullpath]/stats/`/bin/date +%F`_connections.log [fullpath]/stats/csv2png [fullpath]/stats/`/bin/date +%F`_connections.log [fullpath]/stats/`/bin/date +%F`_connections.png 250 250 YmdHMS
Generate HTML
This script will generate HTML snippets for each month, then combine them into an overview page. Uncomment and specify the date at the top and comment the next line if running this for something other than the current month.
#date="2009-03" date=`/bin/date +%Y-%m` cd [fullpath]/stats/ list=`ls $date*.png` echo "<br><br><table><tr>" > $date-month.html for file in $list do echo "<td>$file</td>" | sed 's/_connections.png/:/' >> $date-month.html done echo "</tr><tr>" >> $date-month.html for file in $list do echo "<td><img src=$file alt=$file></td>" >> $date-month.html done echo "</tr></table>" >> $date-month.html list2=`ls -r 2*month.html` echo "<html><title>Webcast Stats</title><h2>Webcast Stats</h2>" > index.html echo "Summary of max connections from each week:<br>" >> index.html echo "<img src=summary.png alt=summary.png>" >> index.html for file in $list2 do cat $file >> index.html done echo "</html>" >> index.html
Generate Summary
This script will generate HTML snippets for each month, then combine them into an overview page. Uncomment and specify the date at the top and comment the next line if running this for something other than the current month
cd [fullpath]/stats/ list=`ls *connections.log` #echo "2009/02/28 12:52:00,0" > summary.log echo > summary.log for file in $list do sort -n -k 2 -t , $file | tail -1 >> summary.log done [fullpath]/stats/csv2png [fullpath]/stats/summary.log [fullpath]/stats/summary.png 800 250 YmdHMS
Configure cronjobs
On linux use the following command to edit your cronjobs:
crontab -e
- In this example we gather statistics every minute on Saturdays between 10:00am and 12:59pm.
- At the start of the window we generate the HTML to include the current day.
- At the end of the window we update the summary graph to include the highest connection count from today.
* 10-12 * * 6 [fullpath]/stats/getstats.sh 5 10 * * 6 [fullpath]/stats/genhtml.sh 5 13 * * 6 [fullpath]/stats/gensummary.sh
Results
With the above configuration files will be created like this (note the auto scaling with the highpoint noted at the top left corner of each graph):
2009-10-month.html 2009-10-31_connections.png 2009-10-31_connections.log 2009-11-07_connections.png 2009-11-07_connections.log 2009-11-14_connections.png 2009-11-14_connections.log index.html 2009-11-month.html 2009-11-21_connections.png 2009-11-21_connections.log summary.png summary.log
The resulting web page shown by browsing to index.html will look something like this: