Sunday, October 2, 2011

A Perl URL checker

URL::Check : yet another URL check system
You want to get notified is something goes weird on a web site you develop and that should be running 24/7?
Given a list of url, you want to check if they exist and send receive an email in case of trouble.
The problem is so common and hundreds of solutions exists on the web, from simple crontab shell to more complex system (hyperic & co).
We propose here one more system. The constraints were:

  • check availability of url, response time or contents,
  • get email to be notified in case of failure,
  • a simple configuration system.
Perl is perfect for that task. Install URL::Check from CPAN
 sudo perl -MCPAN -e 'install URL::Check'
A script is installed in the default script directory.
To get mail sent, your server must be able to sendmail with basic sendmail...
Run it --config=my-config.txt
Or add in crontab, to get it run every hour:
0 * * * * --config=my-config.txt
Well, everything resides here. Here is an example from the CPAN package
#report errors on console
#report errors via mail
#just check if the page can be loaded
#check is this page can be loaded in less than 30s
#we check for the google page in 5ms, so that should produce an error...
#check that a text is contained in a url. Those should produce error
check.contains=microsoft is the best
check.contains=ipad is only for dummies
#this should work


  1. Hi Alexandre,
    Any chance this module can check SSL and other ports (not 80)


  2. I tried on a port 8083 without any trouble (should be the same on https (it is using LWP::Simple to get the url, nothing fancy).