iCalendar for an On Call Rota
A few weeks ago I wrote a blog about server and network monitoring systems. I noted at the time that there seemed to be no simple rota management systems. I just wanted something that provides a simple web interface to a calendar that can be used with smstools to control who gets paged. Since then I have been playing with iCalendar files as a way to do this. iCalendar is defined in a series of RFC’s 2445, 2446, 2447 and 3283.
Building an iCalendar server is easy using apache and mod_dav. There are many discussions on how to do it the one I looked at can be found here.
There are lots of iCalendar compatable clients including iCal on the Mac and Sunbird from Mozilla. Sunbird seems to be more feature rich, in particular, it allows you to upload changes to calendars you are subscribed to. iCal only lets you change calendars you have published.
In order for the network monitoring system to use the calendar and page the correct person you need a bit of perl. There are several perl modules that claim to be able to parse iCalendar files. A quick web/CPAN search find lots of references to Net::iCal and Date::iCal however both of these seem to have had no work done on them recently. There are a few more on CPAN and the one with the most recent updates is iCal::Parser. This is an example script showing how easy it is to use iCal::Parser to read an iCalendar file and find out who is on call on the 30th Aug 2005.
#!/usr/bin/perl -w
use iCal::Parser;
my $file = "OnCall.ics";
my $parser=iCal::Parser->new();
my $hash=$parser->parse($file);
my $day = $hash->{events}{2005}{8}{30};
while ( my ($uids, $event) = each (%$day) ) {
print $event->{SUMMARY} . "n";
}
This script is only an example don’t use it in production :)
If you wanted a web interface I guess you could play with PHP iCalendar but I am happy using Sunbird as a client. We are going to try this out for our oncall system and see how well it works…

(1 votes, average: 4 out of 5)