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

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= 

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


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.


Submit a Comment

Your email address will not be published.

You May Also Like…

MacOS USB Creator

Just toasted my Windows 10 Pro install with a Windows 11 upgrade. Think it will be unrecoverable (because of Bitlocker...