1
0
mirror of https://github.com/opinkerfi/nagios-plugins.git synced 2024-11-22 18:33:45 +01:00

Perfdata added to check_squid.pl

This commit is contained in:
Tómas Edwardsson 2010-03-18 12:00:58 +00:00
parent 773cfede2b
commit d0fccf6649

View File

@ -22,6 +22,7 @@ use utils qw($TIMEOUT %ERRORS &print_revision &support &usage);
use LWP::UserAgent; use LWP::UserAgent;
use HTTP::Request::Common qw(POST GET); use HTTP::Request::Common qw(POST GET);
use HTTP::Headers; use HTTP::Headers;
use Time::HiRes;
my ($url, $urluser, $urlpass, $proxy, $proxyport, my ($url, $urluser, $urlpass, $proxy, $proxyport,
$proxyuser, $proxypass, $expectstatus, $res, $req); $proxyuser, $proxypass, $expectstatus, $res, $req);
@ -88,13 +89,17 @@ if ($urluser)
$h->authorization_basic($urluser, $urlpass); $h->authorization_basic($urluser, $urlpass);
} }
$t0 = [gettimeofday];
$req = HTTP::Request->new('GET', $url, $h); $req = HTTP::Request->new('GET', $url, $h);
$res = $ua->request($req); $res = $ua->request($req);
$elapsed = tv_interval ( $t0 );
if ($res->status_line =~ /^$expectstatus/) if ($res->status_line =~ /^$expectstatus/)
{ {
print "OK - Status: ".$res->status_line."\n"; print "OK - Status: ".$res->status_line. " | 'response'=$elapsed\n";
exit $ERRORS{"OK"}; exit $ERRORS{"OK"};
} }
else else