Perl Proactive Watchdog

This is a complete rewrite of the watchdog. The base functionality is still the same. I added individual response time limits for the watched urls and a grace time for the monitored server to recover.
For instance if you have a comlicated application server to monitor and the watchdog runs every minute. Maybe the applicationserver can't restart within one minute in case of recovery the watchdog would raise the the state of this monitored server and starts the next round of actions. This might be not helpful an slowly starting java servers like INTERSHOP enfinity. So you can configure a gracetime in wich the URL is not watched after a recover script was startet. So you can give the server time to come up.
This is still a little bit bumpy... but feel free to offer improvements. The Mail-Module is now requiered.

This is an proactive watchdog script written in PERL. It's goal is to monitor given URLs and perform some actions if the URLs check fails.
The Script consist of an Watchdog wich monitors the URLs and some arbitrary recover scripts wich should have the "intelligence" to recover a broken down webserver. The main script keeps the current state of the monitored URL in a state file. One file per monitored URL. If the check fails the state is increased.
On one failure nothing is done except from increasing the state in the statefile to "1". If this URL fails again on the next run the state is increased and the recover script is called. The should try to restart the webserver by sending a SIGHUP to the processes. In the next stages an Stop/Start and finally an Kill/Start should be performed by the recover script. After the Kill/Start also failed the state of 5 should be reached.
Now no further action is done on this specific webserver. Because we have to assume that this error isn't recoverable by simply restarting the server. Only a mail is furthermore send to the admin.

This script use either perl IO sockets to fetch the URL or Lynx. Furthermore the Perl-Module Mail::Sendmail is used for mailing to the admin. These Modules are required.
This script has only be testet on Linux and Solaris. But it should work on all Perl-Supported Platforms which provide forking. Maybe some modifications have to be done to bring it up on windows machines. But honestly - who is running a webserver on windows? ;-)  


This software is free software in the terms of the GNU GPL

Project Homepage at Sourceforge

Please send any comments an suggestions to falko(at)zurell.de
© (2002) falko(at)zurell.de

Support This Project

Of course hosted at: SourceForge Logo