HELLO AND WELCOME! Before you can post your question, you'll have to register -- it's completely free and registered users see less advertising! If you just want to browse through the existing questions, just select the forum that you want to visit from the selection below. Otherwise, click here to register!. We highly recommend that you print a copy of our Guide for New Members. Enjoy!

Simple Website Monitoring Script in Perl

Canela inspired me to contribute a little perl script I wrote to monitor my webserver.

Here is how you use it:

Code:

# monitor-website.pl -e my@email-address.com http://www.website.com

The "-e" is the email address that should receive notifications.

You can also use the "-s" option to look for a specific string on the web page. The string should be in quotes, but will work without them if there ar no spaces or special characters.

I purposely didn't use any perl modules so that it would work on any system.

It works first by using "curl -I" to see if the site returns a "200 OK" message in the page header, and if it does, it will use curl to get the entire page searching for </html> at the end unless "-s" specifies some other string.

monitor_email is the email address the warning email appears to come from in the envelope.

I've tried it on several ubuntu machines and get the following errors:

Code:

./checksite.pl: line 3: use: command not found
./checksite.pl: line 7: =: command not found
./checksite.pl: line 10: =: command not found
./checksite.pl: line 11: =: command not found
./checksite.pl: line 12: =: command not found
./checksite.pl: line 15: syntax error near unexpected token `&'
./checksite.pl: line 15: ` &main();'