Adding Trigger Rules to an Alarm
Define one or more trigger rules, or predicates, for an alarm. A trigger rule is a condition (defined by the query) that must be satisfied for the alarm to be in the firing state, and also includes severity, trigger delay (pendingDuration
), and the alarm body to include in notifications. A condition in a trigger rule can specify a threshold, such as 90% for CPU utilization, or an absence.
Add up to two trigger rules, or predicates, to an alarm. For example, add a critical trigger rule for 95 percent and a warning trigger rule for 90 percent.
To understand how notifications are sent when an alarm has multiple trigger rules, see Grouping Notifications for an Alarm and Splitting Notifications for an Alarm.
- Example trigger rules in an alarm
-
{ "body": "95% CPU utilization", "pendingDuration": "PT5M" "query": "CPUUtilization[1m].mean()>95", "ruleName": "95", "severity": "CRITICAL", }, { "body": "90% CPU utilization", "pendingDuration": "PT5M" "query": "CPUUtilization[1m].mean()>90", "ruleName": "90", "severity": "WARNING", }
For valid predicate operators in MQL expressions, see Predicate Operators.
For alarm troubleshooting, see Troubleshooting Alarms. See also Creating a Basic Alarm.
Use the oci monitoring alarm update command and required parameters to update trigger rules in an alarm. A trigger rule is part of the MQL expression, or query.
For an alarm with one rule, use the
--query-text
parameter. Example updating trigger rule to greater than 90 percent (>90
):oci monitoring alarm update --query-text "CPUUtilization[1m].mean()>90" [...]
For an alarm with multiple rules, use the
--overrides
parameter. Example:oci monitoring alarm update --overrides <json_file_path> [...]
Example JSON file for request (alarm with multiple trigger rules){ "body": "95% CPU utilization", "pendingDuration": "PT5M" "query": "CPUUtilization[1m].mean()>95", "ruleName": "95", "severity": "CRITICAL", }, { "body": "90% CPU utilization", "pendingDuration": "PT5M" "query": "CPUUtilization[1m].mean()>90", "ruleName": "90", "severity": "WARNING", }
For a complete list of parameters and values for CLI commands, see the Command Line Reference for Monitoring.
Run the UpdateAlarm operation to update an alarm. A trigger rule is part of the MQL expression in a
query
attribute.Provide the trigger rules using UpdateAlarmDetails. For an alarm with one rule (no
overrides
value), use thequery
attribute. For an alarm with multiple rules, use theoverrides
attribute.