web blazonry web development scripts and tutorials Get best price on Prepaid Samsung Galaxy A10e
   PHP       Name Generators       Perl       CSS       Javascript       Java       MySql       How Tos       Resources   

Perl Home

Perl Scripts
  Count Links
  Mail to MySQL
  ProcLog Files
  Search and Replace
  Site Monitor
  UnTabify

Perl Articles
  csv2htm Converter
  OLE Automation
  Regular Expressions
  SubDir Recursion

Perl Resources
  Regular Expressions Quick Reference
  Regular Expressions Examples
  Recommended Sites
  Bestselling Perl Books
  Free Perl Books (new)
  Free Python Books(new)

Bookmark and Share




Perl: Site Monitor

monitor.pl is a straightforward script that uses the LWP module and sendmail to routinely check if a site is running and to alert someone by email if it is not. This works great if you have an alpha-numeric cellphone or pager that receives messages via email.

The script was written to monitor an internal NT site at work, and was scheduled to run every five minutes via a cron job on my Linux box.

Requirements: The LWP module needs to be installed. This module comes with the libwww-perl package and can be downloaded at any CPAN site.  Sendmail on a UNIX-type server is also required.

Here is an example cron command you could use to schedule the script to run every five minutes during working hours:
Use crontab -e to edit cron jobs:

# min(0-59) hour(0-23) day(1-31) month(1-12) weekday(0-6) <command>

# run every minutes between 7am and 8pm Monday thru Friday
*/5 7-20 * * Mon-Fri perl /home/username/bin/monitor.pl


Note: Once the site is not available, this script will keep alerting you until the site is available, which is why it is not scheduled to run on weekends or off hours.


View and Download Script: monitor_pl.txt


Related Links:
CPAN LWP Module
CPAN Home (CPAN is the Comprehensive Perl Archive Network)

 

Newest Pages
Test Google Ads Ver. 2
Free Linux Admin Books
Free Linux Books for Programmers
Free Books for Linux on the Desktop
Free PHP Books
Free JavaScript Books
Free Java Books - Advanced
Free Java Books - Basic
Free Perl Books
Free Python Books
Quote of the Day (PHP)
Debugging Part 2
How to Test Google Ads
Most Popular Pages
Baby Name Generator
U.S. Name Generator
Wu Name Generator
Popup Windows (JavaScript)
Upload and Resize an Image (PHP)
How To Install Apache + PHP + MySQL
Intro to Web Databases (PHP, MySQL)

Least Popular Pages
iNews Applet (Java)
Java Resources
Site Monitor (Perl)
PHP Resources
 
 

  privacy policy     ||     © 1997-2016. astonishinc.com   All Rights Reserved.