Alert Monitoring

One of the actions a rulebase can take is to generate an alert, which is usually done to signal that a problem condition has been detected. Alerts contain a state, to indicate the problem severity, and text, which provides the problem description. If the alert condition, as defined by the rulebase, ceases to exist, the rulebase will generate a clear against that alert.

Every alert is associated with a particular rulebase and every rulebase is associated with a particular agent. (Technically, rulebases are said to be associated with the RuleBaseEngine microagent instance registered with that agent, therefore the association with the agent is indirect.) The alert state of a rulebase will always be highest alert state of all the active (non-cleared) alerts associated with it. The alert state of an agent (or its RuleBaseEngine microagent) is the highest alert state of any of its currently loaded rulebases. Therefore, alerts and clears can potentially change the state of the rulebase and agent that generated them.

Alert monitoring is performed by registering an AlertMonitorListener with the AgentMonitor. Alerts and clears generated by an agent are detected by the console and delivered as AlertMonitorEvent objects to the listener. Since AlertMonitorEvent is an abstract class, one of its concrete subclasses is delivered: PostAlertEvent for alerts and ClearAlertEvent for clears.

Every AlertMonitorEvent contains flags that indicate whether it caused a change in the state of the RuleBaseEngine or the rulebase it is associated with. It also holds the current states of those objects after taking into account the current event. Other attributes include an alert ID, which uniquely identifies an alert, and the time the event was generated.

Because AlertMonitorEvent extends AgentMonitorEvent, it also has an AgentInstance attribute to identify the agent that generated the event.

The PostAlertEvent class extends AlertMonitorEvent and adds the state of the alert and the alert text. The ClearAlertEvent class extends AlertMonitorEvent and adds the reason-cleared text. This string identifies the reason the alert was cleared.

All alert states are represented as integer values that are mapped using the AlertState interface. A PostAlertEvent with a state of AlertState.NO_ALERT is also called a notification.