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

Context.LogMessage("Found disk indexes: " + arrIndexes.toString());<br />

if (arrIndexes.length == 0) Context.SetResult(1, "No disk found");<br />

// now that we have the indexes of the disks. Poll their utilization and units<br />

var nTotalDiskSize = 0;<br />

for (var i = 0; i < arrIndexes.length; i++) {<br />

oSnmpResponse = oSnmpRqst.Get("1.3.6.1.2.1.25.2.3.1.5." + arrIndexes[i])<br />

if (oSnmpResponse.Failed) Context.SetResult(1, oSnmpResponse.GetPayload);<br />

nSize = oSnmpResponse.GetPayload;<br />

oSnmpResponse = oSnmpRqst.Get("1.3.6.1.2.1.25.2.3.1.4." + arrIndexes[i])<br />

if (oSnmpResponse.Failed) Context.SetResult(1, oSnmpResponse.GetPayload);<br />

nUnits = oSnmpResponse.GetPayload;<br />

nTotalDiskSize += (nSize * nUnits);<br />

}<br />

// return the total size in gigabytes.<br />

Context.SetValue(nTotalDiskSize / 1024 / 1024 / 1024); // output in Gigabytes<br />

Poll multiple reference variables<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 performance monitor graphs the percentage of retransmitted TCP segments over time<br />

using two reference variables: RVtcpOytSegs and RVtcpRetransSegs.<br />

// This script is a JScript that will allow you to graph the percentage of restransmitted<br />

TCP<br />

//' segments over time on a device.<br />

// For this script, we use two SNMP reference variables:<br />

//' The first Reference variable RVtcpOutSegs is defined with OID 1.3.6.1.2.1.6.11 and<br />

instance 0. It polls the<br />

//' SNMP object tcpOutSegs.0, the total number of tcp segments sent out on the network.<br />

var RVtcpOutSegs = parseInt(Context.GetReferenceVariable("RVtcpOutSegs"));<br />

// The second reference variable RVtcpRetransSegs is defined with OID 1.3.6.1.2.1.6.12<br />

and instance 0. It polls<br />

// the SNMP object tcpRetransSegs.0, the total number of TCP segments that were<br />

retransmitted on the system.<br />

var RVtcpRetransSegs = parseInt(Context.GetReferenceVariable("RVtcpRetransSegs"));<br />

if (isNaN(RVtcpRetransSegs) || isNaN(RVtcpOutSegs)) {<br />

Context.SetResult(1, "Failed to poll the reference variables.");<br />

}<br />

else {<br />

// Compute the percentage:<br />

935

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

Saved successfully!

Ooh no, something went wrong!