Note: 此範例僅供說明之用,本公司不提供技術支援。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);
}