persistent class Ens.Alerting.ManagedAlert
extends %Persistent, %XML.Adaptor, Ens.Util.BitmapPurge
Class to provide the basic infrastructure for managing and tracking Alerts that occur in productions.
parameter VALIDATEACTION = 1;
Parameter to control whether the pAction parameter passed to the Update()
is explicitly validated against the Ens.DataType.ManagedAlertAction datatype.
Users should override this setting if they extend this class and need to add their own actions.
Note that InterSystems IRIS reserves all action values up to and including 512 (i.e. 2^9), so any user-defined actions
should start with bit 10 (i.e. 1024).
as list of Ens.Alerting.Action(STORAGEDEFAULT="array");
The history of all previous actions that have been performed on this ManagedAlert.
The AlertGroups which should be used to determine where notifications should be sent.
The text of the original Alert.
as Ens.DataType.UTC [ Required ];
The time the original Alert was triggered.
The name of the Business Partner associated with the source of the alert.
The user currently responsible for the ManagedAlert.
as %Integer [ InitialExpression = 0 ];
The escalation level of the ManagedAlert. This can be increased manually or be raised after no activity takes
place within a user-defined period of time.
as %Boolean [ InitialExpression = 1,Required ];
Flag to indicate whether the ManagedAlert is open or closed.
as Ens.DataType.UTC [ Calculated ];
Calculated property to dynamically determine the last time an action occurred for this ManagedAlert.
The time before which an action should occur for this ManagedAlert.
as Ens.DataType.UTC [ ReadOnly ];
The next time the Alert Monitor should check the status of this ManagedAlert.
This is calculated automatically using the following logic:
- If a user is updating an alert, and doesn't change the NextActionTime,
no change will be made. (This ensures the monitor schedule is regular.)
- If NextActionTime is in the future, then that time will be used.
- If NextActionTime is in the past (i.e. an action is overdue), then
the production's Alert Action Window setting will be used to calculate the time the
Alert Monitor should check the ManagedAlert.
The name of the production in which the original Alert was triggered.
The session in which the Alert occurred.
The config item that triggered the original Alert.
classmethod AlertGroupsBuildValueArray(pAlertGroups As %String = "", Output pValueArray As %String)
Helper method to allow the individual values in AlertGroups to be indexed.
classmethod BulkClose(Output pClosedCount As %Integer, ByRef pErrors As %Integer = 0, pDaysToKeep As %Integer = 30, pReason As %String = "", pConfigName As %String = "", pCurrentOwner As %String = -1, pText As %String = "")
API to make it easier to mark some large set of managed alerts as closed.
The arguments that control which specific alerts are closed are as follows:
classmethod ComputeNextMonitorTime(pNextActionTime As Ens.DataType.UTC)
- pErrors - flag to control whether the IDs that aren't removed are
reported in subscripts of the pErrors variable on output. By default only
the count is reported in pErrors.
- pDaysToKeep - flag to control the time window that should be closed
using the same logic as purges. All managed alerts that occurred more than pDaysToKeep
days in the past will be closed. The flag supports a value of -1 to ensure that ALL matching
managed alerts are closed, including any that were created in the past day.
- pReason - A required string to indicate why the managed alerts are being closed.
- pConfigName - An optional string to specify that managed alerts from
a specific SourceConfigName should be closed.
- pCurrentOwner - An optional string to specify that managed alerts assigned to
the specified user should be closed. The default of -1 indicates no filter should be applied,
as the empty string ("") is used to indicate that the managed alert is unassigned.
- pText - An optional string to filter the results by specific text. By default,
the filter checks whether the AlertText property contains pText ignoring case.
To use an equality filter, the first character of pText should be specified as "=",
and the remainder of pText will be matched against the AlertText property.
NOTE: searches matching on AlertText may be very slow if no other filters are supplied.
Helper method to return a valid NextMonitorTime value.
If pNextActionTime is in the future, then pNextActionTime is returned.
Otherwise, the production's Alert Action Window setting is used to calculate the next time.
classmethod Create(pAlertRequest As Ens.AlertRequest = "", pProduction As %String = "", pOwner As %String = "", Output pStatus As %Status)
Helper method to create a ManagedAlert based on the contents of an Ens.AlertRequest instance.
classmethod GetLastActionTime(pID As %Integer)
Accessor method for LastActionTime that can be invoked from SQL.
The method uses the same approach as LastActionTimeGet(), just in SQL.
method GetNextActionTime(Output pStatus As %Status)
Calculate the next action time for the Managed Alert.
classmethod GetProperties(Output pProperties As %List, Output pCollectionProperties As %List)
Helper method to populate which values are available for display in the UI.
The tree structure for pProperties should be as follows:
pProperties = $listbuild([names of properties])
pProperties([propName]) = $listbuild([Property Title],[Editable],[Action Value],[Datatype],[Empty Value],[Use Display Value])
The tree structure for pCollectionProperties is as follows:
pCollectionProperties = $listbuild([names of collection properties])
pCollectionProperties([collectionName]) = $listbuild([Collection Title],[Editable],[Action Value],[Instance Title],$listbuild([list of sub-properties to display]))
pCollectionProperties([collectionName],[propName]) = $listbuild([Property Title],[Editable],[Action Value],[Datatype],[Empty Value],[Use Display Value])
Accessor method for LastActionTime.
It simply gets the ActionTime from the most recent action in Actions,
and the value of AlertTime if no actions have been logged.
method OnUpdateAlert(pActionValue As Ens.DataType.ManagedAlertAction, ByRef pNewValues As %String, pActionObject As Ens.Alerting.Action)
User callback invoked from UpdateAlert() to allow users to specify
extended action types and extra values.
classmethod Purge(Output pDeletedCount As %Integer, pDaysToKeep As %Integer = 7, pKeepIntegrity As %Boolean = 1, pBitmapChunkLimit As %Integer = 500)
method UpdateAlert(pAction As Ens.DataType.ManagedAlertAction, ByRef pNewValues As %String, pReason As %String = "")
Method to update a Managed Alert. The arguments are as follows:
classmethod UpdateManagedAlert(pID As %Integer = "", pAction As Ens.DataType.ManagedAlertAction, ByRef pNewValues As %String, pReason As %String = "")
- pAction - The bits indicating what actions should take place.
- pNewValues - An array of the new values to set subscripted by property name.
- pReason - A required string to indicate why the action is being taken.
Helper method to invoke UpdateAlert() when the ManagedAlert
instance is not already open.
method UpdateNextMonitorTime(pSave As %Boolean = 0)
Helper method to update the value of NextMonitorTime.
The code is in ComputeNextMonitorTime(), but the logic
describing when UpdateNextMonitorTime() should be called
and what value it should compute is in the documentation for the
index (AlertGroups on AlertGroups(ELEMENTS):Exact) [Type = bitmap];
index (AlertTime on AlertTime);
index (CurrentOwner on CurrentOwner) [Type = bitmap];
index (EscLevel on EscalationLevel) [Type = bitmap];
index (NextAction on IsOpen,NextActionTime);
NextAction is on both NextActionTime and IsOpen as the UI needs to identify both of these fields as cheaply as possible.index (NextMonitor on IsOpen,NextMonitorTime);
NextMonitor is on both NextActionTime and IsOpen as the AlertMonitor component needs to identify these fields as cheaply as possible.index (Open on IsOpen) [Type = bitmap];
index (Source on SourceConfigName) [Type = bitmap];