NSClient++ Help (#1) - Howto use the vbscript (#140) - Message List

Howto use the vbscript

Hi All,

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.

filename: filecount.vbs * 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 *

  • Message #371

    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.

    • Message #373

      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#AEN78

      • Message #399

        Thanks Roger. Time to go through those scripts and correct the exit codes.

Subscriptions