Sunday, January 27, 2008

Using Google Calendar to Monitor Software, part 4

Here's the last piece of the code I use for monitoring cron jobs with Google calendar. If you want to use it, this is the only piece you should need to customize.

You can use it for any number of calendars you want, but you need to put them all into the hash. This requires being geeky enough to know Perl. If you're geeky enough to want to monitor cron jobs with Google calendar, that's probably not a stretch.

---
#!/usr/bin/perl -w
# $Id: cal_event_proprietary.pm 5853 2007-04-02 16:46:01Z jhaemer $

# hash of calendar names and urls
our %url = (
frog =>
'http://www.google.com/calendar/feeds/some_random_stuff/basic',
);

# put your gCal login and password here
our $login = 'your_name_here@gmail.com';
our $passwd = "your_password_here";

# or, you could call this
sub getpw {
use Term::ReadKey;
print "password: ";
ReadMode('noecho');
my $password = ReadLine(0);
chomp $password;
ReadMode('restore');
$password;
}

1;

No comments: