alibabacloud-sls-alerting is an Agent Skill that lets you manage Simple Log Service (SLS) alert monitoring rules, configure alert notifications, and analyze alert events through natural language in an AI agent. After installation, the agent generates a configuration based on your request, runs the operation through Alibaba Cloud CLI, and returns a verification result or a diagnosis conclusion.
Scenarios
alibabacloud-sls-alerting supports the following scenarios:
| Scenario | Description | Example prompt | Walkthrough |
| Create an alert monitoring rule | Create an alert monitoring rule and configure its evaluation and trigger conditions based on business metrics and monitoring requirements. | Create an SLS alert monitoring rule for prod-web/nginx-access. Check the access logs of the last 5 minutes every minute, and fire an alert when the number of requests with status code 500 reaches 100. Send the notification to the "Web Ops" DingTalk group. | Scenario 1 |
| Manage existing alert monitoring rules | Query and update existing alert monitoring rules, temporarily silence alert notifications, and disable, re-enable, or delete alert monitoring rules. | Silence the alert notifications of web-500-alert in prod-web for the next 30 minutes. | Scenario 2 and Scenario 5 |
| Configure alert notifications | Configure the Notification Recipient, policy, and content for notification channels such as email, SMS, phone call, and DingTalk. | Add an SLS alert notification recipient with the email address xxx@example.com, the name xxx, and the mobile number xxx. Then add this recipient to the xxx alert monitoring rule. | Scenario 3 |
| Reduce alert noise | Adjust the alert trigger and notification policies to reduce duplicate alerts and ineffective notifications. | web-500-alert in prod-web fires on brief fluctuations and sends too many notifications. Change it so that an alert fires only after 3 consecutive checks meet the condition, and send a reminder every 30 minutes while the same problem persists. | — |
| Diagnose alert events | Run root cause analysis on the alert history and related logs to help locate the cause of a failure. | web-500-alert in prod-web has been firing all morning. Check the related logs to find the root cause, tell me what exactly went wrong, and what to do next. | Scenario 4 |
Prerequisites
An AI agent that supports Agent Skills and can run local commands.
Before you create a log-based alert monitoring rule in the alerting and monitoring system, make sure that a project and a standard LogStore exist, logs are collected, and the field configuration includes an index for the fields used in the query. Fields used in SQL analysis must also meet the corresponding analysis configuration requirements. For more information, see Create an alert monitoring rule for logs.
Configure Alibaba Cloud credentials that can access the target resources, and grant the permissions on alert monitoring rules, notification resources, or LogSearch as required by the operation.
Cloud operations require Alibaba Cloud CLI 3.3.22 or later and the SLS plugin. The local configuration validation script that ships with the skill requires Python 3.7 or later. Installing the skill with npx requires Node.js. On first use, the agent can check the environment and provide installation guidance.
To configure alert notifications, have recipient information or an available webhook integration ready. To diagnose historical alert events, make sure that the alert history or archived data is accessible.
Viewing alert monitoring rules, managing notification resources, or explaining a configuration does not require new business log data in advance.
Do not paste an AccessKey ID, AccessKey secret, Security Token Service token (STS token), webhook signing key, or a complete URL that contains a token into an agent conversation. Manage this information through the credential configuration methods supported by Alibaba Cloud CLI and the secure configuration channels of your environment.
Install the skill
alibabacloud-sls-alerting is included in the official Alibaba Cloud skills repository. Install it in either of the following ways:
If Node.js and npx are available locally, use Method 1 (recommended).
If Node.js is not available, use Method 2, which does not require Node.js.
Method 1 (recommended): Install with npx
Before installation, run the following commands to confirm that Node.js and npx are available locally:
node -v
npx -vIf either command is not found, install Node.js first.
Run the following command to install the skill:
npx skills add aliyun/alibabacloud-aiops-skills --skill alibabacloud-sls-alerting --full-depthSelect the target agent and the installation scope as prompted by the installer. After installation, confirm that alibabacloud-sls-alerting exists in the corresponding skills directory, and then reload the skills or restart the agent.
Method 2: Download and install manually
Download the alibabacloud-sls-alerting package from GitHub Release, extract it, and copy the files to the skills installation directory of the agent.
After copying, make sure that the alibabacloud-sls-alerting directory exists in the skills directory, and then restart the agent to load the skill.
The skills installation directories of common agents are as follows:
| Agent | Project-level installation directory | User-level installation directory |
| Claude Code | .claude/skills | ~/.claude/skills |
| Codex | .agents/skills | ~/.agents/skills |
| Qoder | .qoder/skills | ~/.qoder/skills |
| QwenCode | .qwen/skills | ~/.qwen/skills |
| OpenClaw | <workspace>/skills | ~/.openclaw/skills |
Here, ~ indicates the home directory of the user. The workspace and user-level directories of OpenClaw can be adjusted through configuration. For more information, see the OpenClaw Skills documentation.
(Recommended) Install alibabacloud-sls-query together with the alerting skill. The query skill helps generate and optimize alert query statements, and assists alert event diagnosis by querying and analyzing the related logs.
Manage and diagnose alerts
After you install alibabacloud-sls-alerting, describe your alerting requirement in the agent. The agent selects a workflow based on the task:
| Task type | Main workflow |
| Create or modify an alert monitoring rule | Check the environment and permissions → identify the resources and fields → read the existing configuration or notification resources → validate the query and the configuration → submit the change → read the result and verify it. |
| Manage notification resources | Identify the recipients, channels, and policies → check the existing resources and their references → create or update the required resources → verify the configuration. |
| Diagnose an alert event | Identify the alert monitoring rule and the event time → query the alert history → compare the trigger condition with the actual query window → query the source logs and the related logs → output the conclusion and the evidence. |
On first execution, the agent checks Alibaba Cloud CLI and the SLS plugin. If a component is missing or the version does not meet the requirements, the agent provides installation or upgrade guidance. Configure credentials in your local terminal. For instructions, see Configure and manage credentials.
Prompt best practices
When you create or modify an alert monitoring rule, provide the following information:
| Information | Example |
| Target resources | The alert monitoring rule belongs to the project prod-web in the cn-hangzhou region, and the data source LogStore is prod-web. |
| Alert monitoring rule identity | The alert monitoring rule ID is web-500-alert, and the display name is "Web Service 500 Error Alert". |
| Alert trigger condition | The number of requests with status 500 reaches 100. |
| Field units | The unit of request_time is seconds. |
| Time settings | Check every minute, and query the last 5 minutes each time. |
| Alert notification | Notify the specified recipients by email and SMS. |
| Execution intent | Create an alert monitoring rule; update an existing alert monitoring rule; generate a configuration draft only; query and diagnose only. |
When you diagnose an alert event, provide the project that the alert monitoring rule belongs to, the alert monitoring rule ID, the event time range, and the time zone. If the logs are archived in another location, also provide the archive project, LogStore, and time field.
The check frequency and the query time window control different behaviors. Specify both explicitly in the prompt:
| Parameter | Purpose | Example |
| Check frequency | How often an alert check runs. | Run once every 1 minute. |
| Query time window | Which data range each check uses. | Query the last 5 minutes. |
For example, "check the data of the last 5 minutes every minute" means that a check runs once every 1 minute, and each check uses the logs of the last 5 minutes.
Scenario 1: Create an alert monitoring rule
Prompt
Create an SLS alert monitoring rule with the ID web-500-alert in prod-web in the cn-hangzhou region.
Check the access logs of the last 5 minutes in nginx-access every minute, and fire an alert when the number of requests with status 500 reaches 100.
Send the alert notification by email to the existing recipient web-ops@example.com.Agent output example
Query statement:
status : 500 | SELECT count(*) AS errorCount FROM log
Alert monitoring rule configuration:
- Alert monitoring rule ID: web-500-alert
- Data source: prod-web/nginx-access
- Check frequency: 1 minute
- Query window: the last 5 minutes
- Trigger condition: errorCount >= 100
- Alert notification: email, web-ops@example.com
Configuration result: the alert monitoring rule is created. The trigger condition and the email notification configuration are verified.Scenario 2: Change the trigger condition of an existing alert monitoring rule
Prompt
Modify the SLS alert monitoring rule web-500-alert in prod-web in the cn-hangzhou region.
Change the alert threshold for the number of requests with status code 500 from 100 to 200, and keep the other settings unchanged.Agent output example
| Configuration item | Before | After |
| Alert trigger condition | errorCount >= 100 | errorCount >= 200 |
| Check frequency | 1 minute | 1 minute |
| Query window | The last 5 minutes | The last 5 minutes |
Update result: the alert monitoring rule is updated. The alert threshold is verified as 200, and the other settings remain unchanged.Scenario 3: Configure email and SMS notifications
Prompt
Add an SLS alert notification recipient with the name xxx, the email address xxx@example.com, and the mobile number xxx.
Then add email and SMS notifications for the alert monitoring rule web-500-alert in prod-web in the cn-hangzhou region,
and send both to this recipient.Agent output example
Alert notification recipient added:
- Name: xxx
- Email: xxx@example.com
- Mobile number: xxx
Alert notification configuration:
- Alert monitoring rule: prod-web/web-500-alert
- Recipient: xxx
- Notification channels: email, SMS
Configuration result: email and SMS notifications for this recipient are added to the alert monitoring rule. The recipient information and the channel configuration are verified.Scenario 4: Analyze why an alert fired and how long it lasted
Prompt
The SLS alert monitoring rule web-500-alert in prod-web fired several times this morning. Investigate the cause.Agent output example
Event range: 2026-09-10 09:00-10:00, Beijing time (UTC+8).
Alert monitoring rule: prod-web/web-500-alert.
Trigger cause:
- The history shows that the trigger condition at that time was errorCount >= 100.
- The execution record at 09:10 used the source log window 09:05-09:10, and errorCount was 186.
- The source logs of that window were queried again. The statistics match the record and meet the trigger condition at that time.
Frequency and duration:
- After deduplication by execution ID, 6 executions between 09:10 and 09:15 were in the firing state.
- These executions belong to 1 continuous alert.
- A recovery record exists at 09:16. The time from the first firing to recovery was about 6 minutes.
- The number of firing executions is not equal to the number of notifications. The actual delivery is subject to the notification records.
Source log evidence:
- Executed query: status : 500 | SELECT count(*) AS errorCount FROM log
- Query window: 09:05-09:10, returned errorCount=186.
- After drill-down by request_uri, /api/order/create accounts for 142 hits, about 76.3%.
- The error logs of this API contain upstream connect timeout.
Conclusion: the alert fired because the number of requests with status code 500 reached the threshold. The errors are concentrated on /api/order/create.
Next steps: check the upstream connection status and the service logs. The current evidence is not enough to confirm the underlying cause of the timeout.In this example, the source logs are part of the evidence used in the diagnosis.
Scenario 5: Temporarily silence alert notifications
Prompt
Temporarily silence the SLS alert notifications of web-500-alert in prod-web for 30 minutes.Agent output example
Temporary silence is set:
- Alert monitoring rule: prod-web/web-500-alert
- Duration: 30 minutes from now
- Scope: the alert notifications generated by this alert monitoring rule
The alert monitoring rule continues to run checks, and alert notifications are paused during the silence period.
The silence ends automatically after 30 minutes, and subsequent notifications follow the original configuration.Limits
| Limit | Description |
| Index configuration | Before you create an alert monitoring rule based on a log query, an index must be configured for the target LogStore, and the field types and the SQL analysis configuration must meet the query requirements. |
| Query timeout | A query may time out when the agent validates an alert query or analyzes historical logs. Narrow the query time range or simplify the query statement, and then retry. |
| Runtime environment | Alert operations and local configuration validation require specific tool versions. For the complete environment requirements, see Prerequisites. |
| Alert history | Diagnosing an alert event requires alert history that is enabled and accessible. The analyzable time range is limited by the retention period of the alert history and the source logs. |
FAQ
Do I need to install Alibaba Cloud CLI and the SLS plugin manually?
The agent checks the environment before it runs an operation and provides installation or upgrade guidance when a component is missing or the version does not meet the requirements. To check or update the environment manually, see Alibaba Cloud CLI or SLS plugin is missing or outdated.
How do I specify an Alibaba Cloud account or a region?
The profile currently configured in Alibaba Cloud CLI is used by default. To use another profile, specify its name explicitly in the prompt, for example, "Use Profile=prod to manage the alert monitoring rules of prod-web in cn-hangzhou."
The project that the alert monitoring rule belongs to, the query data source, and the alert history may be in different regions. Provide or verify each of them separately. To access through an internal network, explicitly require the internal same-region endpoint of the corresponding region, for example, cn-hangzhou-intranet.log.aliyuncs.com.
Can I query data across projects, regions, or accounts?
The project that the alert monitoring rule belongs to and the query data source can be different. Specify the project, LogStore, and region of the data source, and make sure that the corresponding permissions are granted.
Cross-account queries also require a RAM role that SLS can assume, its trust relationship, and access permissions on the source data. The configurator may also need the ram:PassRole permission. A successful manual CLI query does not mean that the runtime identity of the alert monitoring rule already has access permissions.
Troubleshooting
The agent does not recognize the skill after installation
Confirm that the skill is installed in the directory that the current agent actually loads, and that the directory contains SKILL.md, references, and scripts. Check whether the project-level installation corresponds to the current working directory, and then reload the skills or restart the agent. You can also specify alibabacloud-sls-alerting explicitly in the prompt.
Alibaba Cloud CLI or SLS plugin is missing or outdated
Check Alibaba Cloud CLI and the SLS plugin in your terminal:
aliyun version
aliyun sls versionIf the SLS plugin is missing, run the following command:
aliyun plugin install --names slsIf the plugin is installed but the required command or parameter is unavailable, run the following command:
aliyun plugin update --name slsThe ProjectNotExist error
Check the project name, its region, and the endpoint. The project that the alert monitoring rule belongs to and the query data source project can be different, so confirm which request failed. Do not treat a "not found" result in the wrong region as evidence that the resource does not exist.
The IndexConfigNotExist error or fields that cannot be analyzed
Confirm that an index is configured for the target LogStore, and that the field types and the SQL analysis settings used by the query are correct. For example, average latency calculations must use a numeric field, and the unit must be verified. After you adjust the index, re-validate the query within the effective scope of the index.
An alert monitoring rule is created but no notification arrives
Troubleshoot in the following order:
Check whether the alert monitoring rule is enabled and whether normal execution records are generated.
Check the actual query window, the returned result, the trigger condition, and the threshold of continuous triggers to confirm whether an alert event was generated.
Check whether SLS notification output is enabled, and whether the alert policy and the action policy associated with the alert monitoring rule are correct.
Check whether the repeat interval, silence, suppression, conditional branching, or the sending period has an effect.
Check the recipient status, the channel switches, the template content, and the webhook settings, and then review the notification error records.
A successful configuration and an actual notification delivery must be verified separately.
Alert event diagnosis cannot find the alert history
First confirm the time range, the time zone, the alert monitoring rule ID, the region where the history is stored, and the access permissions.
Alert Center history is usually stored in internal-alert-center-log under sls-alert-<account ID>-<region>. The project execution history is stored in internal-alert-history under the project that the alert monitoring rule belongs to. The two have different fields and purposes. For more information, see Use custom query statements to analyze alert logs.
On first use of Alert Center, complete the Region selection in the SLS console. The project execution history is enabled by accessing the details page of the corresponding alert monitoring rule in the console for the first time. For information about how to view alert monitoring rule details and historical statistical reports, see Manage an alert monitoring rule.