Creating an alert

You can create an alert as part of the action of a Scheduler task or sensor.

Before you begin

You must be connected to the sysadmin database as user informix or another authorized user.

About this task

To create an alert:

Procedure

Use an INSERT statement to add a row to the ph_alert table. Include values for the following columns:
  • ID: System generated; use 0 for the value.
  • alert_task_id: Must reference the job ID from the ph_task table.
  • alert_task_seq: Must reference the job sequence number from the ph_task table.
  • alert_type: Choose INFO, WARNING, or ERROR.
  • alert_color: Choose GREEN, YELLOW, or RED.
  • alert_state: Choose NEW, IGNORED, ACKNOWLEDGED, ADDRESSED.
  • alert_object_type: The type of object the alert describes, for example, SERVER.
  • alert_object_name: The name of the object.
  • alert_message: The message describing the alert.
  • alert_action: An SQL statement or function that performs a corrective action, or NULL.

Example

The following example adds an alert to warn that a backup has not been taken. This code snippet is part of a stored procedure that takes task_id and task_seq as its arguments.
INSERT INTO ph_alert
(
ID,
alert_task_id,
alert_task_seq,
alert_type,
alert_color,
alert_state,
alert_object_type,
alert_object_name,
alert_message,
alert_action
)
VALUES
(
0,
task_id,
task_seq,
"WARNING",
"RED",
"NEW",
"SERVER",
"dbspace_name",
"Dbspace ["||trim(dbspace_name)|| "] has never had a level-0 backup. 
    Recommend taking a level-0 backup immediately.",
NULL
);