Working with alert rules

The platform comes with a set of predefined alert rules which determine how the alert is handled. If necessary, you can change the rules using the ap config command. If you want to send email notifications for a given alert, you must configure SMTP.

Before you begin

Ensure you read Alert rules to learn about different attributes of alert rules that you can set.

You can list all the rules that are defined in your system using the following command:
ap config --list alerts_rules
Sample output:
Action rules
+----------------------+----------------+----------+
| Scope                | Value          | Built-in |
+----------------------+----------------+----------+
| default              | 1 (send email) |      YES |
| ACTION_FAILED        | 0 (do nothing) |      YES |
| APPLIANCE_EVENT      | 0 (do nothing) |      YES |
| HW_SERVICE_REQUESTED | 1 (send email) |       NO |
| STARTUP_FAILED       | 0 (do nothing) |      YES |
+----------------------+----------------+----------+

Email rules
+---------+------+-------------------+
| Scope   | Mode | Value             |
+---------+------+-------------------+
| default | set  | admin@pl.ibm.com  |
+---------+------+-------------------+

You can also check the existing SMTP configuration using the command ap config --list smtp

Procedure

  • To add a new alert rule or modify an existing one, use the following command. You must specify at least the type of alert and a value for it. If you do not set the scope, the rule is global.
    ap config --set alerts_rules --type (action|to|add_to) [--scope alert_type|alert_reason_code]
    --value (action_int|email_list)
  • To delete an existing rule, use the following command:
    ap config --del alerts_rules --type (action|to|add_to) [--scope alert_type|alert_reason_code] 
  • To test which action is taken for a given reason code, use the following command:
    ap config --test alerts_rules --reason_code reason_code
  • If you need to configure SMTP, use the following command. Provide the external SMTP server address, port, sender name (to be used as sender signature), and sender email address.
    ap config --set smtp --mail_server_name server_name --mail_server_port port
    --sender_name sender_name --sender_adress sender_address