轮询多个参考变量

<注意> 此范例仅供说明之用,本公司不提供技术支持。Ipswitch 为内容对象、SNMP API 和脚本环璄提供技术支持服务,但不对 JScript、VBScript,或活动脚本监控工具或操作的开发及侦错提供支持服务。如需此范例或自行编写脚本方面的协助,请造访 WhatsUp Gold 用户社群论坛

此性能监控工具会使用 RVtcpOytSegs 与 RVtcpRetransSegs 两个参考变量,以绘制重新传输 TCP 数据段百分比的时间关系图。

// This script is a JScript that will allow you to graph the percentage of restransmitted TCP
//' segments over time on a device.
// For this script, we use two SNMP reference variables:
//' The first Reference variable RVtcpOutSegs is defined with OID 1.3.6.1.2.1.6.11 and instance 0. It polls the
//' SNMP object tcpOutSegs.0, the total number of tcp segments sent out on the network.
var RVtcpOutSegs = parseInt(Context.GetReferenceVariable("RVtcpOutSegs"));

// The second reference variable RVtcpRetransSegs is defined with OID 1.3.6.1.2.1.6.12 and instance 0. It polls
// the SNMP object tcpRetransSegs.0, the total number of TCP segments that were retransmitted on the system.
var RVtcpRetransSegs = parseInt(Context.GetReferenceVariable("RVtcpRetransSegs"));

if (isNaN(RVtcpRetransSegs) || isNaN(RVtcpOutSegs)) {
Context.SetResult(1, "Failed to poll the reference variables.");
}
else {
// Compute the percentage:
var TCPRetransmittedPercent = 100 * RVtcpRetransSegs / RVtcpOutSegs;
// Set the performance monitor value to graph
Context.SetValue(TCPRetransmittedPercent);
}

另请参阅

活动脚本性能监控工具范例

以图形表示打印机墨水存量利用率

轮询参考变量并计算

以图形表示温度监控工具

使用 SNMP GetNext