– nagios plugin

Check correct operation of a Squid Web Proxy server

This check command runs a HTTP request through your proxy. You can use it to check the basic proxy operation, authentication and even authentication on a certain web site. You may check for any HTTP error/result code. So this plugin can be useful for checking that certain server do not allow access without authentication, too.

Get the plugin from Nagios Exchange or this site.

Errors and solutions

Error Solution
Can’t locate in @INC (…) at line 21.
BEGIN failed–compilation aborted at line 21.
Move the script to nagios plugins folder and run it from there
Can’t locate LWP/ in @INC (…) at ./ line 22.
BEGIN failed–compilation aborted at ./ line 22.
Install perl’s libwww

tar -zxvf libwww-perl-5.837.tar.gz
cd libwww-perl-5.837
perl Makefile.PL
make install


perl -MCPAN -e 'install Bundle::LWP'

OR, on FreeBSD, install it from ports

# portmaster www/p5-libwww


Check from command line:

# ./ --url= --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$/ --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!!200
        contact_groups                  admins_sms