Open Source Conference Videos

Tired of having to do all the reading about new stuff? Care to lay down on the couch and let someone do some open source talking for you?

Here are some links: (Yes some are oldies, but goldies!)
http://video.fosdem.org (FOSDEM, free open source software conference)
http://linuxcom.blip.tv/rss (Linux.com’s RSS for Videos)
http://podcast.utos.org (Utah Open Source Podcast. Just audio, close your eyes!)
http://events.ccc.de/congress/2008/wiki/Conference_Recordings (f0r 411 j00 h4xx0rz)
http://oscon.blip.tv (OSCon 08)
http://river-valley.tv/conferences (Some multimedia/graphics software)

The more the merrier!

Tags: , ,

Monitoring videostreams with Nagios

Recently I wanted to monitor a streamingservice via Nagios and started thinking about how it could be done on the commandline so it could easily be monitored without doing silly gui stuff. Came to think of mplayer and its ability to play streams ..and so I started playing with it for a bit.

Running the command : mplayer -noframedrop -quiet -dumpstream "http://someurl" -dumpfile "some_local_dumpfile" does everything i need. It streams the video and dumps it in a local file. This means you can assume that the stream is working if your dumped file is the right size. To find the size, just simply dump the video one time, check its size and use the size as a parameter to the nagios plugin.

Here’s the plugin. Feel free to copy & paste it and use it for your own monitoring.
You will ofcourse have to have mplayer installed.

#!/usr/bin/perl -w
# This check uses mplayer to dump a videostream, check the size of it
# and determine if the streaming service is working or not.
# ...uh ...yeah :-)
#morten bekkelund 2008

use Getopt::Long;
use File::stat;

my %ERRORS=('OK'=>0,'WARNING'=>1,'CRITICAL'=>2,'UNKNOWN'=>3,'DEPENDENT'=>4);

sub print_usage {
print "Usage: check_xstream -u <url> -d <dumped stream filename> -s <expected size of dumped file> \n";
print "Example: ./check_xstream -u mms://streamserver/stream -d /tmp/dump -s 4533646 \n";
}

sub help {
print_usage();
}

Getopt::Long::Configure ("bundling");
GetOptions(
'u:s' => \$url, 'url' => \$url,
'd:s' => \$dump, 'dump' => \$dump,
's:i' => \$expected_size, 'size' => \$expected_size
);

if(!$url or !$expected_size or !$dump) {
print_usage();
exit $ERRORS{"UNKNOWN"};
}

unlink($dump);
my $check_stream=`/usr/bin/mplayer -noframedrop -quiet -dumpstream "$url" -dumpfile "$dump" 2>&1`;
my $file_size=stat("$dump")->size;

if(!$file_size) {
print "UNKNOWN: Cannot find dumped stream.\n";
exit $ERRORS{"UNKNOWN"};
}

if($file_size != $expected_size) {
print "CRITICAL: The size of the stream diffs from the expected size. Streaming doesnt appear to work correctly.\n";
exit $ERRORS{"CRITICAL"};
}

if($file_size == $expected_size) {
print "OK: The size of the stream is correct. Streaming appears to work correctly.\n";
exit $ERRORS{"OK"};
}

print "UNKNOWN: Something really fishy is going on here....\n";
exit $ERRORS{"UNKNOWN"};
# end

You can call the script check_stream or whatever you prefer and put it in your nagios plugins directory.

Configure commands.cfg for the new plugin :
define command{
command_name check_stream
command_line $USER1$/check_stream -u "$ARG1$" -s "$ARG2$" -d "$ARG3$"
}

and finally configure your services file to something like this :

define service{
use generic-service
host_name yourhost
service_description CHECK_STREAM
is_volatile 0
max_check_attempts 3
normal_check_interval 5
retry_check_interval 1
contact_groups yourcontacts
notification_period 24x7
notification_options c,w,r
process_perf_data 1
check_command check_stream!"mms://someurl"!expected_dump_size!"/tmp/streamdump"
}

Tags: , , , ,