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

Context.LogMessage("difference: " + (nTotalOctets -<br />

nInOutOctetsMonitorPreviousPolledValue) + " bytes");<br />

Context.LogMessage("Interface Speed: " + nIfSpeed + "bps");<br />

Context.LogMessage("time elapsed since last poll: " + nIntervalSec + "s");<br />

Context.LogMessage("Current Bandwidth utilization: " + nCurrentBps + "bps");<br />

if (nCurrentBps / nIfSpeed > nMaxInterfaceUtilizationRatio) {<br />

Context.SetResult(1, "Failure: bandwidth used on this interface " +<br />

nCurrentBps + "bps / total available: " + nIfSpeed + "bps is above the specified ratio: "<br />

+ nMaxInterfaceUtilizationRatio);<br />

}<br />

else {<br />

Context.SetResult(0, "Success");<br />

}<br />

}<br />

// Save this poll information in the context variables:<br />

Context.PutProperty("nInOutOctetsMonitorPreviousPolledValue", nTotalOctets);<br />

Context.PutProperty("nInOutOctetsMonitorPreviousPollDate", nPollDate);<br />

}<br />

Monitor an SNMP agent running on a non standard port<br />

Note: This example is provided as an illustration only and is not supported. Technical support<br />

is available for the Context object, SNMP API, and scripting environment, but <strong>Ipswitch</strong> does<br />

not provide support for JScript, VBScript, or developing and debugging Active Script<br />

monitors or actions. For assistance with this example or with writing your own scripts, visit<br />

the <strong>WhatsUp</strong> <strong>Gold</strong> user community (http://www.whatsupgold.com/wugspace).<br />

This active monitor watches an SNMP agent running on a non-standard port (the standard<br />

SNMP port is 161).<br />

var nSNMPPort = 1234; // change this value to the port your agent is running on<br />

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

// Get the device ID<br />

var nDeviceID = Context.GetProperty("DeviceID");<br />

// Initialize the SNMP request object<br />

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

if(oResult.Failed)<br />

{<br />

Context.SetResult(1, oResult.GetPayload);<br />

}<br />

else<br />

{<br />

// Set the request destination port.<br />

var oResult = oSnmpRqst.SetPort(nSNMPPort);<br />

// Get sysDescr.<br />

var oResult = oSnmpRqst.Get("1.3.6.1.2.1.1.1.0");<br />

if (oResult.Failed)<br />

923

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

Saved successfully!

Ooh no, something went wrong!