From d0fccf66497127d711b81e8d5ad92a6bf156115d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?T=C3=B3mas=20Edwardsson?= Date: Thu, 18 Mar 2010 12:00:58 +0000 Subject: [PATCH] Perfdata added to check_squid.pl --- check_squid/trunk/check_squid.pl | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/check_squid/trunk/check_squid.pl b/check_squid/trunk/check_squid.pl index ecb1334..8058cc3 100644 --- a/check_squid/trunk/check_squid.pl +++ b/check_squid/trunk/check_squid.pl @@ -22,6 +22,7 @@ use utils qw($TIMEOUT %ERRORS &print_revision &support &usage); use LWP::UserAgent; use HTTP::Request::Common qw(POST GET); use HTTP::Headers; +use Time::HiRes; my ($url, $urluser, $urlpass, $proxy, $proxyport, $proxyuser, $proxypass, $expectstatus, $res, $req); @@ -88,13 +89,17 @@ if ($urluser) $h->authorization_basic($urluser, $urlpass); } +$t0 = [gettimeofday]; + $req = HTTP::Request->new('GET', $url, $h); $res = $ua->request($req); +$elapsed = tv_interval ( $t0 ); + if ($res->status_line =~ /^$expectstatus/) { - print "OK - Status: ".$res->status_line."\n"; + print "OK - Status: ".$res->status_line. " | 'response'=$elapsed\n"; exit $ERRORS{"OK"}; } else