NSClient++ Help (#1) - Howto use the vbscript (#140) - Message List
I noticed that NRPE can use the external vbscript to return the status. When I write the below script, the status of the service is always shown "OK". But the messages return is correct. Could you let me know what is wrong? Thanks.
Dim fs, f, f1, fc, count
Set fs = CreateObject?("Scripting.FileSystemObject?")
Set f = fs.GetFolder?("c:
") Set fc = f.Files count=fc.Count if count>6 and count<8 then wscript.echo "WARNING: " & "WARNING, Filecount is " & count elseif count>=8 then wscript.echo "CRITICAL: " & "CRITICAL, Filecount is " & count else wscript.echo "OK: " & "OK, Filecount is " & count end if *
The NSClient reads the VBScript exit code, not the text output.
Use WScript.Quit(0) to return an OK to Nagios. WScript.Quit(1) is for critical. 2 and 3 seem to work for warning/unknown respectively but that may not be correct.anonymous05/05/08 05:38:21 (5 years ago)
You are close.
0 for okay 1 for Warning 2 for critical 3 for Unknown
See this link for details: http://nagiosplug.sourceforge.net/developer-guidelines.html#AEN78Roger Glass05/06/08 16:12:04 (5 years ago)