Skip to main content

%SYSTEM.Monitor

Class %SYSTEM.Monitor Extends Help [ Abstract, System = 4 ]

The %SYSTEM.Monitor class provides an interface for accessing the System Monitor. You can Get/Set/Clear the system 'State' and 'Alerts' counter.

You can use it via the special $SYSTEM object.

You can call help to get a list of all entrypoints:

Do $SYSTEM.Monitor.Help()

Methods

State

ClassMethod State() As %Integer

Returns the system state as an integer.

-1: System is hung
0: System state is OK
1: System state is Warning
2: System state is Alert

SetState

ClassMethod SetState(State As %Integer) As %Integer

Set the system state. See State() for allowed integer values.

Alerts

ClassMethod Alerts() As %Integer

Returns the number of alerts posted to messages.log.

ClearAlerts

ClassMethod ClearAlerts() As %Integer

Clears the alerts counter.

Clear

ClassMethod Clear() As %Integer

Clears the alerts counter and sets the system state = 0 (OK).

GetAlerts

ClassMethod GetAlerts(Alerts As %Integer, Messages As %String, LastAlert As %String = "") As %Status

Read messages from the alerts.log file. Returns the number of messages in 'Alerts' and an array of those messages in 'Messages'. 'LastAlert' contains the last message added to the alerts.log file.

This may be called periodically to get only recently added alerts. The first time GetAlerts is called, the caller should set LastAlert="". The caller may then retain the returned value and pass that LastAlert back in subsequent calls, to only retrieve messages added since then.