Exit code problem with check_mk
Posted: Mon Jun 29, 2015 4:18 am
Hi,
I'm using check_mk to send check result back to nagios, the powershell script I use is something like this :
try{
$ie = New-Object -com internetexplorer.application
$ie.navigate($url)
while($ie.ReadyState -ne 4) {start-sleep -m 100}
$ie.visible = $false
$isError = $ie.LocationName.CompareTo("Index")
$ie.Quit()
Remove-Variable ie
}
catch [Exception] {
return $_.Exception.Message
}
if ( $isError )
{
Write-Host CRITICAL - page KO
[Environment]::Exit(“2”)
}
else
{
Write-Host OK - page OK
[Environment]::Exit(“0”)
}
I tested in local machine , everything works just fine. However, in Nagios it always shows "CRITICAL" no matter what the exit code is.
Anyone has similar problem?
I'm using check_mk to send check result back to nagios, the powershell script I use is something like this :
try{
$ie = New-Object -com internetexplorer.application
$ie.navigate($url)
while($ie.ReadyState -ne 4) {start-sleep -m 100}
$ie.visible = $false
$isError = $ie.LocationName.CompareTo("Index")
$ie.Quit()
Remove-Variable ie
}
catch [Exception] {
return $_.Exception.Message
}
if ( $isError )
{
Write-Host CRITICAL - page KO
[Environment]::Exit(“2”)
}
else
{
Write-Host OK - page OK
[Environment]::Exit(“0”)
}
I tested in local machine , everything works just fine. However, in Nagios it always shows "CRITICAL" no matter what the exit code is.
Anyone has similar problem?