<注意> 此范例仅供说明之用,本公司不提供技术支持。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);
}