Wrong Values from Windows Agent

Hi Daniel,

We have tested your script and in fact the response time will increase due to other scripts and their execution time.

Maybe you could try this and check if the results are more similiar.

$URL='Inser URL here'
$Request = New-Object System.Net.WebClient
$Start = Get-Date
$PageRequest = $Request.DownloadString($URL)
$TimeTaken = ((Get-Date) - $Start).TotalMilliseconds
$Request.Dispose()
$status = 2 #critical
$crit = 200
$warn = 120
if ($TimeTaken -gt $crit) {
$status = 2 #critical
}
elseif ($TimeTaken -gt $warn) {
$status = 1 #warning
}
else {
$status = 0 #ok
}
“$status HTTPResponseTime-Exchange response_time=$TimeTaken;$warn;$crit;; HTTP response time $TimeTaken ms”

First print is your script running with another that takes long time to execute. The second is the new code with the same script that takes long time.!

Invoke-WebRequest|638x45

DownloadString

Ficas a dever duas cervejas, para mim e para o Ricardo :grin:
Cheers

1 Like