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 />

Send a standard Get and log the polled value<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 />

var oSnmpResponse = oSnmpRqst.Get("1.3.6.1.2.1.2.1.0");<br />

if (oSnmpResponse.Failed)<br />

{<br />

Context.LogMessage("Failure. Error=" + oSnmpResponse.GetErrorMsg);<br />

}<br />

else<br />

{<br />

Context.LogMessage("Success. Polled " + oSnmpResponse.GetOid + ", got " +<br />

oSnmpResponse.GetValue);<br />

}<br />

Send a Get using non-standard port and timeout<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 />

oComResult = oSnmpRqst.SetPort(1234);<br />

oComResult = oSnmpRqst.SetTimeoutMs(5000); // 5 second timeout<br />

var oSnmpResponse = oSnmpRqst.Get("1.3.6.1.2.1.2.1.0");<br />

if (oSnmpResponse.Failed)<br />

{<br />

Context.LogMessage("Failure. Error=" + oSnmpResponse.GetErrorMsg);<br />

}<br />

else<br />

{<br />

Context.LogMessage("Success. Polled " + oSnmpResponse.GetOid + ", got " +<br />

oSnmpResponse.GetValue);<br />

}<br />

947

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

Saved successfully!

Ooh no, something went wrong!