Written by James McDonald

August 18, 2009

Squid outage fail-over
If you run wccp through a Cisco router and your Squid Cache falls over the router will fail over to serving pages directly.

Seamless fail-over is good but
So you may never notice that your Squid proxy has stopped responding. So you lose the benefit of the Squid cache and increased your demand on your Internet Link.

How do you check if Squid is responding?
Run squidclient against the Squid Server and check for a correct return value!

What to do
Assuming you are running Windows XP Pro as the monitoring workstation and you have admin access. Do the following:

  1. Install Cygwin and the Cygwin squid package.
  2. Then create a batch file and call it from Windows Scheduler several times a day (e.g. 9AM 12PM 3PM 6PM )
  3. The batch file will email a warning when it doesn’t get a correct response.

Here is a sample batch file. Obviously you would edit to your taste.

@echo off

rem Tell the batch file where to find your squidclient software
set PATH=c:\cygwin\bin;%PATH%

rem Cygwin squidclient
set SQUIDCLIENT=squidclient.exe

rem SMTP Server IP Address
set SMTPSERVER=10.20.30.1

rem This is any URL that is likely to be up most of the time
set URL=http://www.google.com.au

rem This is the squid proxy's ip address
set HOST=10.20.30.250 

rem The TO and FROM email addresses
set [email protected]
set [email protected]

%SQUIDCLIENT% -h %HOST% %URL%

if not %ERRORLEVEL%. == 0. (
        rem -h is generate headers
        rem -b is the body, -a is the subject
	bmail -h -s %SMTPSERVER% -t %TOADDR% -f %FROMADDR% -b "%DATE% %TIME% The squid proxy server %HOST% failed to respond" -a "%DATE% %TIME% %SQUIDCLIENT% returned an error" 
)

bmail is available here

A better way
If you can afford a monitoring server. You would be better off running Nagios. But the above solution provides a heads up without having to configure a full blown Nagios install.

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

The reCAPTCHA verification period has expired. Please reload the page.

You May Also Like…

Squarespace Image Export

To gain continued access to your Squarespace website images after cancelling your subscription you have several...

MySQL 8.x GRANT ALL STATEMENT

-- CREATE CREATE USER 'tgnrestoreuser'@'localhost' IDENTIFIED BY 'AppleSauceLoveBird2024'; GRANT ALL PRIVILEGES ON...

Exetel Opt-Out of CGNAT

If your port forwards and inbound and/or outbound site-to-site VPN's have failed when switching to Exetel due to their...