System Alerts
This facility provides various ways of informing operators of events that might need attention. Three ways of doing this are provided: by text messaging, by email and by appending the alert message to a web page; different operators can be notified by the same or different methods. Operators can be notified of daemon log messages at or above a specified level of seriousness, and of user-generated events.
You configure system alerts using the realevent host command. This allows you to specify the destinations of messages sent by the different notification methods and to set up any other parameters (such as the email server address). It is also possible to create user-defined alerts, to enable and disable the available alerts, and to specify particular days and times of the day when alert messages should be sent, and the recipients to whom they should be sent.
Reality service and system alerts are generated automatically by the system. However, you can also use realevent to define your own alerts for use within your applications. Once defined, a user-defined alert can be generated with realevent, or with the ALERT TCL command; this can be used in DataBasic programs and Procs, and can also be run from TCL for testing purposes. By embedding user-defined alerts in your applications, you can provide an operator with, for example, timely feedback on the progress of processes that take a long time to complete, and also with details of any errors that occur.
Note
Alerts sent by text message must be emailed to an SMTP to SMS gateway, which will extract the text message and forward it to the recipient. To use text messaging, therefore, you will require a subscription to a suitable gateway.
Configuring System Alerts
The realevent host command allows you to configure system alerts. It allows you to:
-
Initialise system alerts - this must be done before using alerts for the first time:
realevent -z
-
Set general configuration parameters:
-
The return address for the SMTP and SMS notification methods.
-
The name of the email server.
-
The location of an SMS template that will be used to create emails.
For example, the following commands set the return address for the SMTP and SMS notification methods, and the name of the email server:
realevent -ap myemail -v reality@deepspace.phi
realevent -ap smtpserver -v mail.deepspace.phi -
-
Set up, enable and disable the various notification methods. For example, the following command sets up and enables the SMTP notification method, specifying two recipients:
realevent -aen smtp -r fred.bloggs@deepspace.phi;bert.smith@deepspace.phi
-
Configure and enable Reality service events. For example, the following command enables Reality service event 1002 and configures it to report daemon log events up to level 4; recipients will be sent the default message:
realevent -aei 1002 -b 4
-
Create, configure, enables and disable user-defined events. For example, the following command creates and enables user-defined event 4001 and configures it to send recipients the message
Application alert
.realevent -aei 4001 -t "Application alert"
-
Create filters to allow events to send messages only at particular times. For example, the following commands create filters 1 to 6 to allow events to send messages only between 6 pm and 9 am on Monday to Friday, and at weekends (from 6 pm on Friday to 9 am on Monday). On weekdays, alert messages are sent to one SMTP recipient and at weekends, to the other.
realevent -af 1 -I * -r fred.bloggs@deepspace.phi -D mon -T 18:00-23:59
realevent -af 2 -I * -r fred.bloggs@deepspace.phi -D tue-thu -T 18:00-09:00
realevent -af 3 -I * -r fred.bloggs@deepspace.phi -D fri -T 00:00-09:00
realevent -af 4 -I * -r bert.smith@deepspace.phi -D fri -T 18:00-23:59
realevent -af 5 -I * -r bert.smith@deepspace.phi -D sat-sun -T *
realevent -af 6 -I * -r bert.smith@deepspace.phi -D mon -T 00:00-09:00
Refer to the description of the realevent command for full details of these configuration options.
Raising System Alerts
Reality service and system alerts are generated automatically by the system. There are also two ways in which you can raise a system alert.
-
Run realevent with the -s option. You must specify the event id and a message that will be sent in addition to that defined for the event. For example, the following command raises alert event 1001, with the additional text "Sending test event 1001"; the message is sent to all enabled recipients:
realevent -s -i 1001 -m "Sending test event 1001"
-
Run the ALERT TCL command. You can use this in your DataBasic programs and Procs, and can also run it from TCL for testing purposes. For example, the following DataBasic program opens the file INVENTORY, which is defined on account PRODUCTION. If the file cannot be opened, an error message is printed on the terminal and system alert 4010 (previously set up using realevent) is generated, with additional text formed by concatenating the error code, an error message and the file name.
PARAM = '/PRODUCTION/INVENTORY' OPEN PARAM TO PI95 SETTING ECODE ELSE EMSG = ECODE:": Cannot open file ":PARAM PRINT EMSG PERFORM "ALERT 4010 ":EMSG END