Wowza Community

How to automatically check if the Wowza service is up and running and streaming?

I’m wondering if there is anything that has been created or works with Wowza that can allow me to automatically let me know when the Wowza service isn’t working as expected. Mainly I would like to be able to check to see if a stream can be streamed or not as there has been history of the service being up but the streaming part has failed to work correctly. Any thoughts would be great and most appreciated. The only way I can think now to do that is to do it manually, but that’s not an option as I certainly can’t keep track of it in the middle of the night like that…

What exactly is the problem? What do you mean by “failed to work”? Do you mean Wowza was still running, but certain streams stopped sending data, or accepting new connections, while other streams continued to work? Can we figure out why this is happening? Or, is that what you’re trying to do here?

Is this possibly not a Wowza issue? Are your server resources CPU/Network/RAM being maxed out in the middle of the night?

We can brainstorm the requirements and the possible things to watchdog/monitor.

  1. You could write a “heartbeat” Wowza module and a separate “Watchdog” program. That would let you know that Wowza crashed.

  2. Maybe a Java RTMP implementation? You could programatically try to play the stream periodically and check for errors.

The issue was that Wowza was running but it stopped either allowing connections or wouldn’t stream. We never figured it out beyond that before upgrading to the latest. It hasn’t happened again but we’d like to be able to setup something that can “test” the server. Essentially the end result needs to be that we can make a connection and play a stream. All automatically like a ping system.

Are you saying you’re trying to resolve the situation where “service WowzaMediaServer status” reports Wowza is running, but in reality it is not? This can happen if Wowza crashes and doesn’t delete the lock file mentioned in the init.d WowzaMediaServer startup script.

For that scenario you could have a cron job poll the output of “ps” and if Wowza is not running, delete the lock file and start the service. But, Wowza shouldn’t be crashing, so that’s something that needs to be figured out.

“the end result needs to be that we can make a connection and play a stream. All automatically like a ping system.”

Here:

 { ffmpeg -i rtsp://localhost:1935/vod/sample.mp4 2>&1 |grep "Stream #0:1"; } || echo "Error" | mail -s "Stream Down" your@email.com

Works for me. You may have to “dpkg-reconfigure exim4-config” first. (also check your spam folder for the email)

Analysis:

The command redirects ffmpeg stderr to stdout. Checks that the Video stream 0:1 exists. If not, sends an email. You can put that as a cron job.