Ping Latency - Active Monitor script

To the Ipswitch web site

Ipswitch Forums
Home      Members   Calendar   Who's On
Welcome Guest ( Login | Register )
      



Ping Latency - Active Monitor scriptExpand / Collapse
Author
Message
Posted 12/28/2008 9:23:34 PM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 7/1/2009 11:14:26 PM
Posts: 16, Visits: 45
Hi Guys,

Merry Christmas and Happy New year.

With the help from this forum, I have created the script to monitor the ping latency. I have added this script to active monitor. I get a mail alert when ever the ping latency is breached. All works fine.

I have created a network map which shows all my devices in the region. The problem is from my higher management (as usual :) ), they do not want to see red color on the network icon for the ping latency alert. For them 'Red' means the device is down and they get alarmed.

Is there a way, to customise the script, so that it can send only the mail alerts for ping latency and still show the active monitor as up (meaning green color).

Thanks
Taj

This is the script I used:
// Get the Open DB connection from the Context NameSpace
var oDb = Context.GetDB;
if (null == oDb)
{
Context.SetResult( 1, " Problem creating the PRO DB object");
}
else
{
// Get the device ID
var nDeviceID = Context.GetProperty("DeviceID");

// Definition of max ping value in millisec
var nMaxRoundTripTime_Avg = 70;

// Retrieve the nPivotStatisticalMonitorTypeToDeviceID

var sSql = "SELECT nPivotStatisticalMonitorTypeToDeviceID from PivotStatisticalMonitorTypeToDevice WHERE nDeviceID = " + nDeviceID;
var oRs = oDb.Execute(sSql);
var nPivotStatisticalMonitorTypeToDeviceID = oRs("nPivotStatisticalMonitorTypeToDeviceID");

// Function getDataRs() file rdcpingreport

var sSql2 ="SELECT nRoundTripTime_Avg FROM StatisticalPing WHERE nPivotStatisticalMonitorTypeToDeviceID = " + nPivotStatisticalMonitorTypeToDeviceID;
var oRs2 = oDb.Execute(sSql2);
var nRoundTripTime_Avg = oRs2("nRoundTripTime_Avg");

if ( !oRs.EOF )
{
// Display various columns in the debug log (Event Viewer).
var sDisplay;
sDisplay = "" + nPivotStatisticalMonitorTypeToDeviceID;
Context.LogMessage("nPivotStatisticalMonitorTypeToDeviceID=" + sDisplay);
sDisplay = "" +nRoundTripTime_Avg;
Context.LogMessage("nRoundTripTime_Avg=" + sDisplay);
}

if ( nRoundTripTime_Avg > nMaxRoundTripTime_Avg)
{ Context.SetResult( 1, " Failure : ping delay of this device is higher than the specified value");
}
else {
Context.SetResult( 0, " Ok");
}
}
Post #49797
Posted 1/5/2009 4:41:15 AM
Junior Member

Junior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior MemberJunior Member

Group: Forum Members
Last Login: 7/1/2009 11:14:26 PM
Posts: 16, Visits: 45
Hello Guys,

Is there no reply on this. Common guys, I happen to see the solution for similar issue earlier. But I am not able to search that particular post now. Please help me on this.

Post #49866
Posted 1/5/2009 5:31:14 AM


Time Traveler

Time TravelerTime TravelerTime TravelerTime TravelerTime TravelerTime TravelerTime TravelerTime Traveler

Group: WhatsUp Gold Expert
Last Login: Yesterday @ 10:09:57 AM
Posts: 1,593, Visits: 7,686
The problem is that your script sets the monitor state to OK or fail depending on your latency.
You could modify your script so that it always sets the monitor state to OK. But in that case, since alerts trigger with a state change, you won't get an email.
So if you choose to do so, you will have to include in your script some code to send the email.

This is the best solution I can think of right now!

Reading, writing and arithmetic - If you need to choose, please take option 1.

Post #49867
« Prev Topic | Next Topic »


Reading This TopicExpand / Collapse
Active Users: 0 (0 guests, 0 members, 0 anonymous members)
No members currently viewing this topic.
Forum Moderators: Dave, Mark Singh, kevin r gillis, Jason Benton, Christian Lawson, Brandon Felger, Tripp Allen, Will Sansbury, Jason Williams, Hush, FTPplanet.com, Hugh Garber, WUP-PM, mmulryan@ipswitch.com, mswimm

PermissionsExpand / Collapse

All times are GMT -5:00, Time now is 7:12pm

Powered By InstantForum.NET v4.1.4 © 2009
Execution: 0.109. 9 queries. Compression Enabled.