Install perl’s libwww
wget http://www.cpan.org/modules/by-module/LWP/libwww-perl-5.837.tar.gz
tar -zxvf libwww-perl-5.837.tar.gz
cd libwww-perl-5.837
perl Makefile.PL
make
make install
OR
perl -MCPAN -e 'install Bundle::LWP'
OR, on FreeBSD, install it from ports
# portmaster www/p5-libwww
Usage
Check from command line:
# ./check_squid.pl --url=http://www.facebook.com --proxy=proxy.neant.ro --proxyport 3128 --proxyuser=user --proxypass=pass --status=200
OK – Status: 200 OK
Nagios config, command definition:
# ‘check_squid’ – tries to access an URL through proxy
define command {
command_name check_squid
command_line $USER1$/check_squid.pl –proxy=$HOSTADDRESS$ –proxyport=$ARG1$ –proxyuser=$ARG2$ –proxypass=$ARG3$ –url=$ARG4$ –status=$ARG5$
}
Example service check definition:
define service {
service_description squid
use generic-service
host_name proxy
check_command check_squid!3128!squid!squid!http://www.facebook.com!200
contact_groups admins_sms
}