16.01.2013 Views

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

Ipswitch WhatsUp Gold User Guide - Ipswitch Documentation Server

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Ipswitch</strong> <strong>WhatsUp</strong> <strong>Gold</strong> <strong>User</strong> <strong>Guide</strong><br />

Using the Context object with Active Monitors<br />

The context object provides an interface for your script to interact with <strong>WhatsUp</strong> <strong>Gold</strong>.<br />

All methods and properties are retrieved using the Context namespace.<br />

Methods Method description<br />

LogMessage(sText); This method allows for a message to be written to the <strong>WhatsUp</strong><br />

<strong>Gold</strong> debug log.<br />

Example<br />

JScript<br />

Context.LogMessage( "Checking Monitor name using<br />

Context.GetProperty()");<br />

VBScript<br />

Context.LogMessage "Checking Address using Context.GetProperty()"<br />

PutProperty(sPropertyName); This method allows you to store a value in the INMSerialize object.<br />

This value is retained across polls.<br />

Example<br />

JScript<br />

var nCount = parselnt(nNum) +1;<br />

Context.PutProperty("MyNumeric",nCount);<br />

SetResult(nCode, sText); This method allows for a result code and result message to be set.<br />

This is how you can tell the <strong>WhatsUp</strong> <strong>Gold</strong> system if the monitor<br />

succeeded or not.<br />

Every script should call SetResult. If SetResult is not called, the<br />

script is always assumed to have succeeded.<br />

Example<br />

JScript<br />

Context.SetResult(0, "Script completed successfully.");<br />

//Success<br />

Context.SetResult(1, "An error occurred."); //Failure<br />

VBScript<br />

Context.SetResult 1, "An error occurred."<br />

911

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!