Nagios Exchange
  • Home
  • Directory
  • About

Advanced Search

Build precise queries to find exactly what you need

Search Logic

Select compatible versions

Press ESC to close

Sign In Sign Up
Plugins4387Themes and Skins11Add-ons732Documentation283Graphics and Logos36View All Categories
LinuxSecuritySNMPFile SystemCloud
New Listings Recently Updated Listings Most Favored Listings Most Popular Listings Most Rated Listings Most Reviewed Listings
Random Project
Nagios XI Documentation Nagios XI – Restarting Linux Services With NCPA
0.0 (0)
5.7K
RSS Feed
Newest Listings Updated Listings
Top Contributors
LAMY (7)Julien DESMAREST (6)deskwork_itunes142 (4)Davide Lemma (4)Joerg Hoerter (3)
See More
Newest Contributors
Guillaume8723 (1)Salvo (1)SOHA-IT (1)Tsvetomir Tsvetanov (1)Igor Ru (1)
See More
Home > Rodolfo Martinez
RM

Rodolfo Martinez

@rmtzcx

User Stats

Favorites0

Views

Projects0

No Projects Found
check_squid_ng

Fix "uninitialized value" and other issue

First, thanks for sharing. The script works fine when squid is running fine, however when squid is not running or you send invalid data (-d) the script doesn't return an error. # Works fine as long as squid is up and running: ~]$ ./check_squid -H myproxy.server.tld -p 3128 SQUID OK - Squid have 12 clients and 0 ICP requests queued | 'HTTP requests'=4735c;; 'sent ICP requests'=0c;; 'received ICP requests'=0c;; # No errors or messages when you send invalid data (-d): ~]$ ./check_squid -H myproxy.server.tld -p 3128 -d blah ~]$ # Warnings, but no errors if squid is not running: ~]$ sudo systemctl stop squid ~]$ ./check_squid -H myproxy.server.tld -p 3128 ERROR: Cannot connect to 192.168.x.x:3128 ERROR: Cannot connect to 192.168.x.x:3128 Use of uninitialized value in sprintf at /usr/share/perl5/vendor_perl/Nagios/Plugin/Performance.pm line 68. Use of uninitialized value in sprintf at /usr/share/perl5/vendor_perl/Nagios/Plugin/Performance.pm line 68. Use of uninitialized value in sprintf at /usr/share/perl5/vendor_perl/Nagios/Plugin/Performance.pm line 68. Use of uninitialized value in sprintf at /usr/share/perl5/vendor_perl/Nagios/Plugin/Performance.pm line 68. Use of uninitialized value in sprintf at /usr/share/perl5/vendor_perl/Nagios/Plugin/Performance.pm line 68. Use of uninitialized value in sprintf at /usr/share/perl5/vendor_perl/Nagios/Plugin/Performance.pm line 68. SQUID OK - Squid have clients and ICP requests queued | 'HTTP requests'=c;; 'sent ICP requests'=c;; 'received ICP requests'=c;; Apply the patch below to fix both issues above: 1. Download check_squid file 1. Save the patch below as check_squid.patch 2. Apply the patch to check_squid with: patch -i check_squid.patch check_squid --- check_squid.a 2019-01-22 08:48:59.104963842 -0600 +++ check_squid.b 2019-01-22 08:45:39.348819397 -0600 @@ -122,8 +122,11 @@ @exec = ("-h", "Q$host", "-p", "Q$port", "-U", "Q$user", "-W", "Q$password", "mgr:info"); -@result = `$squidclient @exec`; +@result = `$squidclient @exec 2>&1`; +if ($? != 0) { + $np->nagios_exit('CRITICAL', @result); +} my $fd_available; my $fd_used; @@ -286,6 +289,8 @@ } +$np->nagios_exit('WARNING', "Invalid data (-d)"); + # $np->nagios_exit('OK', $output); # $np->nagios_exit('WARNING', $output);

Reviewed 7 years ago

No Favorites Found

Copyright © 2009-2025 Nagios Enterprises, LLC. All rights reserved.

Privacy PolicyTerms of UseTrademarks