monit For Wowza on Ubuntu 12.04 LTS

So Wowza is a cool media streaming server, but sometimes it crashes..for no apparent reason – or perhaps sometimes you’ve just got the memory limit set too high for the machine and the process gets reaped.

Either way it’s pretty important to keep it running, my favourite tool for this kind of job (process monitoring, restarting etc) is monit:

Monit is a free open source utility for managing and monitoring, processes, programs, files, directories and filesystems on a UNIX system. Monit conducts automatic maintenance and repair and can execute meaningful causal actions in error situations.

So how to get it up and running? Assuming you’re using the regular Wowza package, it already comes with an init.d script located at /etc/init.d/WowzaMediaServer, assuming that’s the case, this config will work fine for you.

sudo aptitude update; sudo aptitude install monit

That installs monit, then all you need to do is create & edit:

sudo nano /etc/monit/conf.d/wowza.conf

In that file put:

# /etc/monit/conf.d/wowza.conf
check process wowza with pidfile /var/run/WowzaMediaServer.pid
start program = "/etc/init.d/WowzaMediaServer start" with timeout 60 seconds
stop program = "/etc/init.d/WowzaMediaServer stop"
if 2 restarts within 3 cycles then timeout
if children > 255 for 5 cycles then stop
if totalcpu usage > 95% for 3 cycles then restart
if failed port 1935 protocol http then restart

Then (just for good measure):

sudo service monit restart

If you are using a different Linux flavour, or install style, your PID and stop/start script might be in different locations so you’ll have to edit accordingly.

This will monitor the Wowza process and makes sure it’s running, the default check period is 2 minutes, so with this set up the most the Wowza service can be down for is 2 minutes. It will also restart the service if it’s using more than 95% of the total CPU available for more than 6 minutes.

Enjoy 🙂

Comments

comments

Subscribe

You can subscribe via e-mail to get my posts in your Inbox, or stalk me on numerous other platforms.

, , , , , , ,


Comments are closed.
 
Keep up with me on Social Media by following me below - Thanks so much!