Nagios plugin for checking Squid

I once needed a way to make sure our Squid proxy cluster operates correctly. So I wrote a rather simple Squid check plugin for the Nagios monitoring software. André Moura has pimped it further. Feel free to use it. It's also available from monitoringexchange.org.

AttachmentSize
check_squid.pl.txt3.45 KB

12 comments

Status: 400 URL must be absolute

Submitted by Anonymous on Wed, 12/09/2009 - 12:40.

 

Hi,

As you can see I tried many known and unknown URLs, but never received the correct responce. Very odd.

root@ABC-1234:/usr/local/nagios/libexec# ./check_squid.pl -u http://www.klunky.co.uk -p fredprox -l 8080 -e200
CRITICAL - Status: 406 Not Acceptable (but expected 200...)
root@ABC-1234:/usr/local/nagios/libexec# ./check_squid.pl -u http://www.klunky.co.uk/ -p fredprox -l 8080 -e200
CRITICAL - Status: 406 Not Acceptable (but expected 200...)
root@ABC-1234:/usr/local/nagios/libexec# ./check_squid.pl -url=http://www.klunky.co.uk/ -p fredprox -l 8080 -e200
CRITICAL - Status: 400 URL must be absolute (but expected 200...)
root@ABC-1234:/usr/local/nagios/libexec# ./check_squid.pl -url=http://www.google.com -p fredprox -l 8080 -e200
CRITICAL - Status: 400 URL must be absolute (but expected 200...)
root@ABC-1234:/usr/local/nagios/libexec# ./check_squid.pl -url=http://www.google.com/ -p fredprox -l 8080 -e200
CRITICAL - Status: 400 URL must be absolute (but expected 200...)
root@ABC-1234:/usr/local/nagios/libexec# ./check_squid.pl -url=http://www.google.com/index.html -p fredprox -l 8080 -e200
CRITICAL - Status: 400 URL must be absolute (but expected 200...)
  root@ABC-1234:/usr/local/nagios/libexec#./check_squid.pl -url=http://www.simonloewen.com/ -p fredprox-l 8080 -e200
CRITICAL - Status: 400 URL must be absolute (but expected 200...)

root@ABC-1234:/usr/local/nagios/libexec#./check_squid.pl -u http://www.simonloewen.com/ -p fredprox-l 8080 -e200
 CRITICAL - Status: 406 Not Acceptable (but expected 200...)

 

Best regards, me

 

Power of example

Submitted by Anonymous on Thu, 12/24/2009 - 09:14.

Your problem is that you give the last parameter wrong. It is "-e 200" not "-e200" (although -h says so).

Example:

check_squid.pl -u http://yahoo.com -p proxy.server.com -l 3128 -e 200

Good luck!

returning (null)

Submitted by Anonymous on Tue, 04/20/2010 - 11:30.

Hey there,

thanks for the nice plugin, its definitely helpful.

My Problem is, that if i let Nagios execute the check it always returns (null).

I run it as user nagios manualy and had success:

./check_squid.pl -u http://www.google.com -p srvproxy -l 3128 -o USER -m PASS -e 200

OK - Status: 200 OK

 

But when i created a service and the command ( i hardcoded everything to eleminate the cause of defect) i just get (null) as result.

 

define service{
        use                             generic-service                  ; Name of service template to use
        host_name                       srvproxy
        service_description             Squid Service
        check_command                   check_squid
        }

 

# 'check_squid' command definition
define command{
        command_name    check_squid
        command_line    $USER1$/check_squid.pl -u http://www.google.com -p srvproxy -l 3128 -o USER -m PASS -e 200
}

Is there any known issues ?

hello, i got the same

Submitted by Anonymous on Mon, 04/26/2010 - 11:23.

hello,

i got the same error.

check the path of line 21.where is your utils.pm?

Heyyy

Submitted by Anonymous on Sat, 06/05/2010 - 15:34.

Hello all..

 

I have the problem too..

Its OK now?

its ok now

Submitted by Anonymous on Sat, 06/05/2010 - 19:27.

I founded the problem..

in the line use lib, the path is another for me..

its OK now..

thankss

Can you tell me the path?

Submitted by Anonymous on Fri, 06/03/2011 - 09:40.

Can you tell me the path?

Caused I am also get the

Submitted by Anonymous on Fri, 06/03/2011 - 09:41.

Caused I am also get the return code as "null"

squid authentification problem

Submitted by Anonymous on Thu, 06/24/2010 - 14:51.

Hi,

 

I'm trying to use this script to check if squid authentification it's working fine. My SQUID is using ntlm authentification.

# /usr/lib/nagios/plugins/check_squid.pl -u http://www.google.com -p 10.0.0.20 -l 3128 -e 200 -o test1 -m dunhill
CRITICAL - Status: 407 Proxy Authentication Required (but expected 200...)

check_squid.pl against https sites

Submitted by Anonymous on Tue, 09/06/2011 - 02:34.

Does this work against https:// targets?

Seems so   use output from

Submitted by Anonymous on Mon, 11/28/2011 - 11:04.

Seems so

 

use output from the --version option of the plugin itself).
root@SV:/usr/local/nagios/libexec# ./check_squid.pl  -u http://www.google.de -p 10.0.0.13 -l 3128 -e 200
OK - Status: 200 OK
root@SV:/usr/local/nagios/libexec# ./check_squid.pl  -u https://www.google.de -p 10.0.0.13 -l 3128 -e 200
OK - Status: 200 OK
 

It shows CRITICAL - Status:

Submitted by Anonymous on Tue, 12/06/2011 - 07:36.

It shows

CRITICAL - Status: 403 Forbidden (but expected 200...)

The contents of this web site is Copyright © 2000-2011 Christoph Haas - Impressum/Imprints -  Donations welcome

Drupal theme by Kiwi Themes.