﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>Ipswitch Forums / Ipswitch Products / WhatsUp Gold  / Active script alert on Interface Utilization / Latest Posts</title><generator>InstantForum.NET v4.1.4</generator><description>Ipswitch Forums</description><link>http://forums.ipswitch.com/</link><webMaster>forums@ipswitch.com</webMaster><lastBuildDate>Tue, 07 Oct 2008 01:48:34 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Active script alert on Interface Utilization</title><link>http://forums.ipswitch.com/Topic43603-14-1.aspx</link><description>wrong Thread ^^</description><pubDate>Fri, 16 May 2008 07:39:55 GMT</pubDate><dc:creator>Balrokk</dc:creator></item><item><title>RE: Active script alert on Interface Utilization</title><link>http://forums.ipswitch.com/Topic43603-14-1.aspx</link><description>Here is the script that IPswitch sent me for WUGv12&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;' Definition  of Maximum allowable interface utilization percentage&lt;br&gt;' Change this value to what you want to alarm at.  We use 80%.&lt;br&gt;&lt;br&gt;nMaxUtilizationPercentage = 80&lt;br&gt;&lt;br&gt;' Get the Open DB connection from the Context NameSpace&lt;br&gt;Set oDb = Context.GetDB&lt;br&gt;&lt;br&gt;If oDb Is Nothing Then&lt;br&gt; Context.SetResult 1, "  Problem creating the DB object"&lt;br&gt;End If&lt;br&gt;&lt;br&gt;' Get the device ID&lt;br&gt;nDeviceID = Context.GetProperty("DeviceID")&lt;br&gt; &lt;br&gt;sSql = "Select sDisplayName from Device where nDeviceID = ' " &amp; nDeviceID &amp; " ' "&lt;br&gt;set oRsName = oDb.Execute(sSql)&lt;br&gt;Context.LogMessage "Checking Device " &amp; oRsName("sDisplayName")&lt;br&gt;&lt;br&gt;' Retrieve the nPivotStatisticalMonitorTypeToDeviceID&lt;br&gt;sSql = "SELECT nPivotStatisticalMonitorTypeToDeviceID from PivotStatisticalMonitorTypeToDevice WHERE nDeviceID = " &amp; nDeviceID&lt;br&gt;set oRs = oDb.Execute(sSql)&lt;br&gt;nPivotStatisticalMonitorTypeToDeviceID = oRs("nPivotStatisticalMonitorTypeToDeviceID")&lt;br&gt;&lt;br&gt;' Retrieve all interfaces for the device for the last 10 minutes&lt;br&gt;sSql3="SELECT " &amp; _&lt;br&gt; "SI.dPollTime," &amp; _&lt;br&gt;    "SI.nIfInOctets_Max AS nInOctetsMax, " &amp; _&lt;br&gt;    "SI.nIfOutOctets_Max AS nOutOctetsMax, " &amp; _&lt;br&gt;    "SI.nIfSpeedIn AS nIfSpeedBps, " &amp; _&lt;br&gt;    "SII.sIfDescr AS sIfDescription " &amp; _&lt;br&gt;"FROM StatisticalInterface as SI " &amp; _&lt;br&gt; "Inner Join " &amp; _&lt;br&gt;"StatisticalInterfaceIdentification as SII " &amp; _&lt;br&gt; "ON (SII.nStatisticalInterfaceIdentificationID=SI.nStatisticalInterfaceIdentificationID) " &amp; _&lt;br&gt;"where SI.dPollTime &gt; dateadd(mi,-10,getdate()) " &amp; _&lt;br&gt;"AND SII.nPivotStatisticalMonitorTypeToDeviceID=' " &amp; nPivotStatisticalMonitorTypeToDeviceID &amp; " ' " &amp; _&lt;br&gt;"Order By sIfDescription, SI.dPollTime "&lt;br&gt;&lt;br&gt;set oRs2 = oDb.Execute(sSql3)&lt;br&gt;oRs2.MoveFirst()&lt;br&gt;&lt;br&gt;' Run the recordset&lt;br&gt;&lt;br&gt;Do While Not oRs2.EOF&lt;br&gt;    nIfSpeed = oRs2("nIfSpeedBps")&lt;br&gt;    nIfIn_Avg = oRs2("nInOctetsMax")&lt;br&gt;    nIfOut_Avg = oRs2("nOutOctetsMax")&lt;br&gt;    nIfDescr = oRs2("sIfDescription")&lt;br&gt;&lt;br&gt;   Context.LogMessage "Checking Interface " &amp;  nIfDescr&lt;br&gt; &lt;br&gt;    If nIfSpeed &gt; 0 Then&lt;br&gt;      nInPercentage = Round((nIfIn_Avg / nIfSpeed * 100), 2)&lt;br&gt;      nOutPercentage = Round((nIfOut_Avg / nIfSpeed * 100), 2)&lt;br&gt;    Else&lt;br&gt;      nInPercentage = 0&lt;br&gt;      nOutPercentage = 0&lt;br&gt;    End If &lt;br&gt;    oRs2.moveNext()&lt;br&gt;&lt;br&gt;    Context.LogMessage "Utilization Out: " &amp; nOutPercentage &amp; "%"&lt;br&gt;    Context.LogMessage "Utilization In: " &amp; nInPercentage &amp; "%"&lt;br&gt;&lt;br&gt;    If nInPercentage &gt; nMaxUtilizationPercentage Or nOutPercentage &gt; nMaxUtilizationPercentage Then&lt;br&gt;      oDisplay = " Failure: Interface " &amp; nIfDescr&lt;br&gt;      oDisplay = oDisplay &amp; " is running at "&lt;br&gt;      oDisplay = oDisplay &amp; nInPercentage&lt;br&gt;      oDisplay = oDisplay &amp; "%/" &amp; nOutPercentage&lt;br&gt;      oDisplay = oDisplay &amp; "% utilization inbound/outbound (threshold is "&lt;br&gt;      oDisplay = oDisplay &amp; nMaxUtilizationPercentage &amp; "%)."&lt;br&gt;      Context.SetResult 1, oDisplay&lt;br&gt;    Else&lt;br&gt;      Context.SetResult 0, "     Ok"&lt;br&gt;    End If &lt;br&gt;Loop</description><pubDate>Wed, 14 May 2008 10:44:06 GMT</pubDate><dc:creator>ken21401</dc:creator></item><item><title>RE: Active script alert on Interface Utilization</title><link>http://forums.ipswitch.com/Topic43603-14-1.aspx</link><description>this specific script won't fail, because it doesn't poll the device itself : it retrieve from the WUG DB values that were already polled from the device.&lt;br&gt;&lt;br&gt;But yes, if you have other monitors that *does* poll the device, if the device gets completely down, each of these monitors will go down.&lt;br&gt;If you set action at the device level you will get only one alert, if you set actions at the monitor-level you will get multiple ones.</description><pubDate>Tue, 13 May 2008 05:05:07 GMT</pubDate><dc:creator>MB - NS</dc:creator></item><item><title>RE: Active script alert on Interface Utilization</title><link>http://forums.ipswitch.com/Topic43603-14-1.aspx</link><description>So I added the script to one of my Cisco 2811's, but when applying an "Email Alert" I have to chose a state of condition. From what others have told me, is that the script is suppose to put the device in a Non responding condition (yellow DOWN 0 minutes) when it Utilizes more than 80%. Thats when you specify the Email Action to send as soon as it goes in a state condition of "DOWN". But what happens when it looses connection and goes in a state of "DOWN"? will I receive emails saying that it is currently "Utilizing more than 80%" when in fact, it's just loosing the connection.</description><pubDate>Mon, 12 May 2008 11:25:08 GMT</pubDate><dc:creator>ken21401</dc:creator></item><item><title>RE: Active script alert on Interface Utilization</title><link>http://forums.ipswitch.com/Topic43603-14-1.aspx</link><description>Firstly, the script was written for WUG11, it might not work for WUG12&lt;br&gt;Assuming it does :&lt;br&gt;&lt;br&gt;1- change the following line to suit your need :&lt;br&gt;&lt;br&gt;// Definition of Maximum allowable interface utilization percentage&lt;br&gt;// Change this value to what you want to alarm at. We use 80%.&lt;br&gt;var nMaxUtilizationPercentage = 80;&lt;br&gt;&lt;br&gt;2- apply it to a device&lt;br&gt;3- set an action&lt;br&gt;&lt;br&gt;Nothing out of ordinary, actually.</description><pubDate>Mon, 12 May 2008 07:50:43 GMT</pubDate><dc:creator>MB - NS</dc:creator></item><item><title>Active script alert on Interface Utilization</title><link>http://forums.ipswitch.com/Topic43603-14-1.aspx</link><description>Hello, I am trying to monitor the S0/0/0 interface sitting on my Cisco 2811. I would prefer to have an email sent out to my entire IT department as soon as this interface reaches more than 80%. I came across this script but I just don't know how to implement it correctly. &lt;br&gt;&lt;br&gt;I hopped into WUG12 click on [b]Configure [/b]and chose [b]Action Library[/b], clicked on [b]New[/b] and selected [b]Active Script Action[/b] Paste the text below into the script section then did the [b]TEST[/b], which came back successful. So where do I go from here?&lt;br&gt;&lt;br&gt;// Get the Open DB connection from the Context NameSpace&lt;br&gt;var oDb = Context.GetDB;&lt;br&gt;if (null == oDb)&lt;br&gt;{&lt;br&gt;   Context.SetResult( 1, "  Problem creating the DB object");&lt;br&gt;} &lt;br&gt;else&lt;br&gt;{&lt;br&gt;&lt;br&gt;var oRs = new ActiveXObject("ADODB.Recordset");&lt;br&gt;&lt;br&gt;// Get the device ID&lt;br&gt;  var nDeviceID=0;&lt;br&gt;  nDeviceID = Context.GetProperty("DeviceID");&lt;br&gt;  &lt;br&gt;// Definition  of Maximum allowable interface utilization percentage&lt;br&gt;//   Change this value to what you want to alarm at.  We use 80%.&lt;br&gt;  var nMaxUtilizationPercentage = 80;&lt;br&gt;&lt;br&gt;// Retrieve the nPivotStatisticalMonitorTypeToDeviceID&lt;br&gt;  var sSql = "SELECT nPivotStatisticalMonitorTypeToDeviceID from PivotStatisticalMonitorTypeToDevice WHERE bEnabled=1 AND nStatisticalMonitorTypeID = 1 AND nDeviceID = " + nDeviceID;&lt;br&gt;  var oRs = oDb.Execute(sSql);&lt;br&gt;  var nPivotStatisticalMonitorTypeToDeviceID = oRs("nPivotStatisticalMonitorTypeToDeviceID");&lt;br&gt;&lt;br&gt;// Retrieve the nStatisticalInterfaceIdentificationID&lt;br&gt;  var sSql = "SELECT nStatisticalInterfaceIdentificationID from StatisticalInterfaceIdentification WHERE nIfInSpeedCustom &gt; 0 AND nPivotStatisticalMonitorTypeToDeviceID = " + nPivotStatisticalMonitorTypeToDeviceID;&lt;br&gt;  var oRs = oDb.Execute(sSql);&lt;br&gt;  var nStatisticalInterfaceIdentificationID = oRs("nStatisticalInterfaceIdentificationID");&lt;br&gt;&lt;br&gt;// Retrieve the data for the device&lt;br&gt;  var sSql3 = "SELECT nIfInOctets_AVG AS nInOctetsMax, nIfOutOctets_AVG AS nOutOctetsMax, nIfSpeedIn AS nIfSpeedInBps, nIfSpeedOut AS nIfSpeedOutBps FROM StatisticalInterfaceCache WHERE nStatisticalInterfaceIdentificationID = " + nStatisticalInterfaceIdentificationID;&lt;br&gt;  oRs = oDb.Execute(sSql3);&lt;br&gt;  oRs.moveFirst();&lt;br&gt;&lt;br&gt;  var nInPercentage = 0;&lt;br&gt;  var nOutPercentage = 0;&lt;br&gt;&lt;br&gt;  while ( !oRs.EOF )&lt;br&gt;  {&lt;br&gt;    var nIfSpeedIn = oRs("nIfSpeedInBps");&lt;br&gt;    var nIfSpeedOut = oRs("nIfSpeedOutBps");&lt;br&gt;    var nIfIn_Avg = oRs("nInOctetsMax");&lt;br&gt;    var nIfOut_Avg = oRs("nOutOctetsMax");&lt;br&gt;    if ( nIfSpeedIn &gt; 0 )&lt;br&gt;    {&lt;br&gt;      var nInPercentage = Math.round((nIfIn_Avg/(nIfSpeedIn / 10))*100);&lt;br&gt;      var nOutPercentage = Math.round((nIfOut_Avg/(nIfSpeedOut / 10))*100);&lt;br&gt;    }&lt;br&gt;    else&lt;br&gt;    {&lt;br&gt;      nInPercentage = 0;&lt;br&gt;      nOutPercentage = 0;&lt;br&gt;    }&lt;br&gt;    oRs.moveNext();&lt;br&gt;&lt;br&gt;    if ( nInPercentage &gt; nMaxUtilizationPercentage || nOutPercentage &gt; nMaxUtilizationPercentage)&lt;br&gt;    {&lt;br&gt;      var oDisplay;&lt;br&gt;      oDisplay = nDeviceID+" Failure: Interface ";&lt;br&gt;      oDisplay += " is running at ";&lt;br&gt;      oDisplay += nInPercentage;&lt;br&gt;      oDisplay +=  "%/" + nOutPercentage;&lt;br&gt;      oDisplay += "% utilization inbound/outbound (threshold is ";&lt;br&gt;      oDisplay += nMaxUtilizationPercentage + "%).";&lt;br&gt;      Context.SetResult( 1, oDisplay);&lt;br&gt;    }&lt;br&gt;    else&lt;br&gt;    {&lt;br&gt;      Context.SetResult(0, nDeviceID+"     Ok - Utilization Speed Normal"  + nOutPercentage +"% / " + nInPercentage+"%");&lt;br&gt;    }&lt;br&gt;  }&lt;br&gt;  oRs.Close();&lt;br&gt;}</description><pubDate>Thu, 08 May 2008 14:36:48 GMT</pubDate><dc:creator>ken21401</dc:creator></item></channel></rss>