Perl script to monitor resources on the internet.

check_links is quit powerful, as it can monitor

Requirements

The Perl script requires

USAGE

perl -w check_links.pl [OPTIONS] -u URL

Here, OPTIONS may be:

The script’s return code and message is to be interpreted by your monitoring infrastructure.

EXAMPLES

Check a URL is accessible

perl -w check_links.pl -u https://binfalse.de

Check a URL-shortener does the proper redirection

perl -w check_links.pl -u http://goo.gl/33e3Lb -s 301 --header location=https://binfalse.de/

Check that your webserver properly redirects HTTP to HTTPS

perl -w check_links.pl -u http://binfalse.de/ -s 301 --header location=https://binfalse.de/

Check that a web resource has a specific size and that the webserver is NGINX

perl -w check_links.pl -h content-length=191406 -h "server=nginx.*" -u https://binfalse.de/assets/media/pics/2016/drm-inchains.png

Here, the image needs to be exactly of size 191406 Bytes and the regex nginx.* matches to NGINX in any version.

perl -w check_links.pl -c userid=karl -c secret=passwd123456 -u https://secret.site

Test content negotiation

Check that you get XML when asking for XML:

check_links.pl -u http://purl.uni-rostock.de/comodi/comodi#Attribution -f -a text/xml --header content-type=xml

Check that you get HTML when asking for HTML:

check_links.pl -u http://purl.uni-rostock.de/comodi/comodi#Attribution -f -a text/html --header content-type=text/html

TESTS

There is a python tool in src/test.py that performs some basic test to verify that check_links.pl is working correctly. I’d like to encourage you to add further test when extending check_links.pl!

Download and install

Download the tool at check_links.pl (or see the project on GitHub)

Please consider to take a look at my general monitoring setup notes.