Acknowledge all devices

Note: This example is provided as an illustration only and is not supported. Technical support is available for the Context object, SNMP API, and scripting environment, but Ipswitch does not provide support for JScript, VBScript, or developing and debugging Active Script monitors or actions. For assistance with this example or with writing your own scripts, visit the WhatsUp Gold user community.

This action resets the acknowledge flag on all devices. When a device is unacknowledged, the label on its icon renders as white text on black. If you don't use the acknowledge feature, this action can be used to make sure that icons always show as acknowledged.

// This JScript action sets the acknowledge flag to true for all devices.
// Written by Tim Schreyack of Dynamics Research Corporation

// Get the database info
var oDb = Context.GetDB;

if (null == oDb) {
Context.SetResult( 1, "Problem creating the DB object");
}
else {
var sSql = "UPDATE ActiveMonitorStateChangeLog SET bAcknowledged = 1 WHERE bAcknowledged = 0";
var oRs = oDb.Execute(sSql);
var sSql = "UPDATE Device SET nUnAcknowledgedActiveMonitors = 0 WHERE nUnAcknowledgedActiveMonitors = 1";
var oRs = oDb.Execute(sSql);
var sSql = "UPDATE Device SET nUnAcknowledgedPassiveMonitors = 0 WHERE nUnAcknowledgedPassiveMonitors = 1";
var oRs = oDb.Execute(sSql);
}

See Also

Example Active Script Actions

Post device status to Twitter