Hi,
I have specific IIS pool which I monitor with Nagios.
I ran a simple script which browse locally the API pages and checks if they are up or down. I'm doing it with the CURL tool.
For some reason, Nagios sometimes receives an OK reply with the status UNKNOWN. How can I get rid of it? There is something deffinately wrong here, it happens only
with the CURL checks on that pool.
Does someone know why does it happen?
Thanks in advance.
Get rid of Unknow alerts
Re: Get rid of Unknow alerts
You may not be receiving a properly formatted return string from your script. If the script is not too large, could you post it in code wraps?
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Get rid of Unknow alerts
Sure, its a VBScript:
Dim line, args, objShell, temp, Link
Const ForReading = 1
Link = WScript.Arguments.item(0)
Set objShell = WScript.CreateObject ("WScript.shell")
line=""
Set objExec = objShell.Exec ("c:\curl -k curl -k " & Link)
Do
temp = objExec.StdOut.ReadLine()
if len(temp)>10 then line=temp
Loop While Not objExec.Stdout.atEndOfStream
if len(temp) >= 1 then
wscript.echo ("OK - The page is loading.")
wscript.quit(0)
ElseIf len(temp) < 1 then
wscript.echo ("Critical - Page is not loading")
wscript.quit(2)
End if
Dim line, args, objShell, temp, Link
Const ForReading = 1
Link = WScript.Arguments.item(0)
Set objShell = WScript.CreateObject ("WScript.shell")
line=""
Set objExec = objShell.Exec ("c:\curl -k curl -k " & Link)
Do
temp = objExec.StdOut.ReadLine()
if len(temp)>10 then line=temp
Loop While Not objExec.Stdout.atEndOfStream
if len(temp) >= 1 then
wscript.echo ("OK - The page is loading.")
wscript.quit(0)
ElseIf len(temp) < 1 then
wscript.echo ("Critical - Page is not loading")
wscript.quit(2)
End if
Re: Get rid of Unknow alerts
Just to clarify, you are receiving the string "OK - The page is loading.", but the object state in unknown, correct?
If so, then the status string is being returned, and it is the exit code that is not.
If so, then the status string is being returned, and it is the exit code that is not.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Re: Get rid of Unknow alerts
Yes, correct.abrist wrote:Just to clarify, you are receiving the string "OK - The page is loading.", but the object state in unknown, correct?
If so, then the status string is being returned, and it is the exit code that is not.
I didn't understand the part regarding the exit code?! Can you please explain.
Thanks.
Re: Get rid of Unknow alerts
Exit codes are how plugins tell nagios what the reported state of the object is. In your script, that would be the "wscript.quit(n)" lines, where n=0 (OK) and n=2 (Critical). It seems like the exit code is not handled correctly and is not getting returned to nagios. Maybe we can get someone in here who knows vbs better than I, as to me, your script looks fine.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.