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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

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

<br />

<br />

You can use the Microsoft XML DOM object to access this information. For more<br />

information, see the Read multiple objects in one request example.<br />

Note: All the members of the ComSnmpResponse object are methods. They have no<br />

arguments and should be called without using parenthesis.<br />

Example scripts using the SNMP API<br />

These example scripts demonstrate the SNMP API in use. All of these examples are written in<br />

JScript.<br />

Initialize an SNMP object with error check from a device ID<br />

The SnmpRqst.Initialize method returns a ComResult object that tells if the initialization<br />

succeeded or failed.<br />

This script uses the Failed method to detect an error and logs an error message using<br />

GetErrorMsg if the initialization failed:<br />

var oSnmpRqst = new ActiveXObject("CoreAsp.SnmpRqst");<br />

var nDeviceID = 150;<br />

var oComResult = oSnmpRqst.Initialize(nDeviceID);<br />

if (oComResult.Failed)<br />

{<br />

Context.LogMessage(oComResult.GetErrorMsg);<br />

}<br />

Alternatively, initialization using a device address and an SNMP credential ID:<br />

var oSnmpRqst = new ActiveXObject("CoreAsp.SnmpRqst");<br />

var sAddress = "192.168.3.1";<br />

var nCredentialID = 1;<br />

var oComResult = oSnmpRqst.Initialize2(sAddress, nCredentialID);<br />

if (oComResult.Failed)<br />

{<br />

Context.LogMessage(oComResult.GetErrorMsg);<br />

}<br />

946

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

Saved successfully!

Ooh no, something went wrong!