my powershell script is:
Code: Select all
param($warn, $crit)
$LastExitCode = 3
$Output1 = ""
$output = ""
$myW3WP = Get-Process w3wp | Sort -Descending WS| select -first 1 | Measure-Object WS -Sum
$myW3WP = $myW3WP.sum / 1mb
if ($myW3WP -gt $crit)
{
$LastExitCode = 2
$output1 = "CRITICAL: Memory for W3WP has passed 1 gig $myW3WP"
$output = $output1
}
elseif ($myW3WP -gt $warn)
{
$LastExitCode = 1
$output1 = "WARN: Memory for W3WP is getting close to 1 gig $myW3WP"
$output = $output1
}
else
{
$LastExitCode = 0
}
$output = $output1
Write-Host $output $LastExitCode
$myW3WP = ""
Code: Select all
./check_nrpe -H g1vpfms02 -c check_w3wp -a 200 1000Code: Select all
WARN: Memory for W3WP is getting close to 1 gig 217.83203125 1
Code: Select all
Ok
Cannot convert value "$" to type "System.Double". Error: "Input string was not
in a correct format."
At C:\\scripts\\checkW3WP.ps1:9 char:5
+ if ($myW3WP -gt $crit)
+ ~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [], RuntimeException
+ FullyQualifiedErrorId : InvalidCastFromStringToDoubleOrSingle
3Also, what do I need to change so Nagios with also display warning or critical? even with this, it still shows Green