| | | Junior 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");
}
} |
| | | | Junior 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.
|
| | | | 
Time 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. |
| |
|
|