Configuring Alarm Rules
You can create SQL alarm rules to configure the content to be monitored. You can create up to 200 rules. Each alarm rule can be associated with one to three charts. Each chart contains an SQL statement for querying a log stream.
Prerequisites
- You have structured logs using the new version of log structuring.
- You have created charts for log streams.
Creating an Alarm Rule
- Log in to the LTS console, and choose Alarms in the navigation pane.
- Click the Alarm Rules tab.
- Click Create. The Create Alarm Rule right panel is displayed.
- Configure an alarm rule.
Table 1 Alarm rule parameters Parameter
Description
Verification Rule
Example Value
Rule Name
Name of the alarm rule.
The name can contain 1 to 64 characters. Only letters, numbers, hyphens (-), underscores (_), and periods (.) are allowed.
LTS-Alarm
Description
Rule description.
Enter up to 64 characters.
N/A
Trigger Type
The value is Conditional expression by default.
N/A
Conditional expression
Charts
Click Add Chart or
. On the right panel displayed, select a chart of a log stream in a log group, and click OK.If there are no charts available or the charts do not fit your needs, click Create Chart. Configure the chart parameters, click OK, and click Save and Back in the upper right corner to return to the Create Alarm Rule right panel. You can see that the chart you just created has been selected, and the query statement has been filled in.
Specify the query time range (1 to 60 minutes or 1 to 24 hours).
You can continue to add more charts by clicking
.The chart and the SQL query statement are required.
N/A
Query Frequency
You can set the query frequency to:
- Hourly: The query is run on the hour.
- Daily: The query is run at a specific time every day.
- Weekly: The query is run at a specific time on a specific day of the week every week.
- Custom interval: Set it to 5 to 60 minutes or 1 to 24 hours.
- CRON: CRON expressions support schedules down to the minute and use 24-hour format. Examples:
- 0/10 * * * *: The query is run every 10 minutes starting at the top of the hour.
- 0 0/5 * * *: The query is run every 5 hours starting at 00:00.
- 0 14 * * *: The query is run at 14:00 every day.
- 0 0 10 * *: The query is run at 00:00 on the 10th day of every month.
N/A
Daily 01:00
Conditional Expression
Enter a specific conditional expression. When the expression execution result is true, an alarm is generated.
Basic syntax and syntax across multiple charts are supported.
- Basic syntax
- Basic arithmetic operators: addition (+), subtraction (–), multiplication (*), division (/), and modulo (%). Example: x * 10 + y > 100
- Comparison operators: greater than (>), greater than or equal to (>=), less than (<), less than or equal to (<=), equal to (==), and not equal to (!=). Example: x >= 100.
- Logical operators: && (and) and || (or). Example: x > 0 && y < 200
- Logical negation (!). Example: !(x < 1 && x > 100)
- Numeric constants: They are processed as 64-bit floating point numbers. Example: x > 10
- String constants. Example: str =="string"
- Boolean constants: true and false. Example: (x < 100)!=true
- Parentheses: Parentheses are used to change the order of operations. Example: x *(y + 10) < 200
- contains function: It is used to check whether a string contains a substring. For example, if you run contains(str, "hello") and true is returned, the string contains the hello substring.
- Syntax across multiple charts
- Basic arithmetic operators: addition (+), subtraction (–), multiplication (*), division (/), and modulo (%).
- Comparison operators: greater than (>), greater than or equal to (>=), less than (<), less than or equal to (<=), equal to (==), and not equal to (!=).
- Logical operators: && (and) and || (or).
- Logical negation (!)
- contains function
- Parentheses
N/A
$0.count + $1.total > 100
Alarm Severity
Possible values are critical (default), major, minor, and info.
N/A
info
Send Notifications
Possible values are No (default) and Yes.
N/A
No
SMN Topic
If you select Yes for Send Notifications, you need to select a topic from the drop-down list box. You can select multiple topics.
If there are no topics that you desire, click Create Topic to create a new topic on the Simple Message Notification (SMN) console.
- Create a topic by referring to Creating a Topic.
- Configure the topic policy by referring to Configuring Topic Policies.
Select APM for Services that can publish messages to this topic. Otherwise, notifications will fail to be sent.
- Add subscribers, which are the notification (email or SMS message) recipients, for the topic by referring to Adding a Subscription. SMN will notify subscribers of alarm information in real time.
For example, you can enter the email addresses of O&M personnel.
This parameter is required when Send Notifications is set to Yes.
N/A
- Click OK.
Deleting an Alarm Rule
- Log in to the LTS console, and choose Alarms in the navigation pane.
- Click the Alarm Rules tab.
- Click Delete in the Operation column of the row that contains the target alarm rule, and click OK.
Modifying an Alarm Rule
- Log in to the LTS console, and choose Alarms in the navigation pane.
- Click the Alarm Rules tab.
- Click Modify in the Operation column of the row that contains the target alarm rule, and modify the parameters based on Table 1. Rule Name and Trigger Type cannot be modified.
- Click OK.
Last Article: Log Alarms
Next Article: Viewing Alarms
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.