Skip to main content
skill CX Codex

tencentcloud-cls-alarm — Claude Code skill

This skill manages Tencent Cloud CLS alarms, notification groups, mute shields, and firing history. Use it to configure alerts or inspect what fired.

Apache-2.0 216 installs ★ 17 updated 2026-10-25

Install into Claude Code · Skills CLI (Vercel) All methods and platforms ↓
npx skills add AceDataCloud/Skills --skill tencentcloud-cls-alarm -a claude-code
Open on GitHub

What tencentcloud-cls-alarm does

The skill can list CLS alarm policies, show their details, create or modify them, and remove them. It also switches alarms on or off, changes query conditions and thresholds, and connects policies to notification groups. Recipients may include SMS, email, and webhooks.

Its bundled scripts/cls_alarm.py script exposes subcommands for alarms, notices, shields, and execution logs. A shield can mute notifications for a defined deployment window, while the alarm log shows which policies fired and when. Less common schema fields can be handled with the Tencent Cloud SDK examples.

You need Tencent Cloud credentials, TENCENTCLOUD_REGION, and tencentcloud-sdk-python; CLS alarms are regional. Use the companion tencentcloud-cls skill to search log content. Alarm deletion has no undo, so the alarm-delete action requires confirmation first.

What it helps with

  • inspect CLS alarm policies and their state
  • create an alert from a log query and condition
  • change a threshold, period, or notice group
  • mute notifications during a deployment
  • review the history of fired alarms

Example prompts for the agent

  • List the Tencent Cloud CLS alarm policies and show their current state.
  • Create an alarm for status_code >= 500 and attach an existing notice group.
  • Mute notifications during the deployment and show firing history for 6h.

How to install tencentcloud-cls-alarm

1Skills CLI (Vercel)

npx skills add AceDataCloud/Skills --skill tencentcloud-cls-alarm -a claude-code

2Manually: put the files in place

~/.claude/skills/tencentcloud-cls-alarm/SKILL.md

Copy the whole skill folder; for one project use .claude/skills/tencentcloud-cls-alarm/

Step by step, with commands for each platform: How to install skills in Claude Code: five ways

Questions about tencentcloud-cls-alarm

How do I install tencentcloud-cls-alarm in Claude Code?

Run npx skills add AceDataCloud/Skills --skill tencentcloud-cls-alarm -a claude-code, then check ~/.claude/skills/tencentcloud-cls-alarm/SKILL.md.

What does tencentcloud-cls-alarm do?

It manages CLS alarm policies, recipient groups, time-limited mute shields, and alarm execution history. It can also enable or disable alarms and update their conditions.

What is the difference between Enable and Status?

Enable=False archives the alarm definition, while Status=False turns off its runtime activity. Use Status for everyday muting.

Source text

SKILL.md · Apache-2.0
---
name: tencentcloud-cls-alarm
description: |
  Manage Tencent Cloud CLS alarm policies, notice groups, shields and
  alarm execution logs. Use when the user asks to: list / create /
  modify / delete CLS alarms, enable or disable alarms, manage notice
  recipients (SMS / email / webhook), mute alarms during deploys, or
  view which alarms fired and when. For searching the underlying log
  content, use the companion `tencentcloud-cls` skill.
license: Apache-2.0
metadata:
  author: acedatacloud
  version: "1.0"
connections: [tencentcloud]
---

# Tencent Cloud CLS — Alarm Management

CRUD on CLS alarm policies, notice groups, mute shields, and the alarm execution log.

> **Setup:** See [tencentcloud authentication](../_shared/tencentcloud.md). Defaults to `TENCENTCLOUD_REGION` from env; CLS alarms live per-region.
>
> **Companion skill:** `tencentcloud-cls` for log content search.

## CLI (preferred)

The skill ships [`scripts/cls_alarm.py`](scripts/cls_alarm.py) — wraps every alarm / notice / shield operation as a subcommand.

```bash
# $SKILL_DIR can point at another skill loaded this turn — anchor on our own
# script (re-run this at the top of every fresh-shell Bash block).
CLSA="$SKILL_DIR/scripts/cls_alarm.py"; [ -f "$CLSA" ] || CLSA=$(find /tmp -maxdepth 8 -path '*/skills/*/scripts/cls_alarm.py' 2>/dev/null | head -1)
[ -f "$CLSA" ] || { echo "tencentcloud-cls-alarm script not found (SKILL_DIR=$SKILL_DIR)" >&2; exit 1; }

python3 "$CLSA" alarms                          # list policies
python3 "$CLSA" alarm <alarm-id>                # full detail
python3 "$CLSA" alarm-disable <alarm-id>        # quick mute (Status=false)
python3 "$CLSA" alarm-enable  <alarm-id>
python3 "$CLSA" alarm-create --json /tmp/alarm.json --dry-run
python3 "$CLSA" alarm-modify <alarm-id> --condition '$1.cnt > 20'
python3 "$CLSA" alarm-delete <alarm-id> --yes   # destructive

python3 "$CLSA" notices                         # notice groups
python3 "$CLSA" notice <notice-id>

python3 "$CLSA" shields                         # mute rules
python3 "$CLSA" shield-create --notice-id <notice-id> --start $(date +%s) --end $(date -v+2H +%s) --type 1 --reason "deploy"

python3 "$CLSA" alarm-log --time 6h             # firing history
```

For the rare schema field the CLI doesn't surface, fall through to the raw SDK examples below.

## When to Use

- Inspect existing alarm policies (filter by name, enabled flag)
- Create a new log-based alarm: CQL/SQL query → trigger condition → notice group
- Modify thresholds, query, period, recipients
- Quick enable / disable to mute during incidents
- Manage notice groups (recipients: users, groups, webhooks, with escalation)
- Time-bounded shield rules to mute during deploys
- Pull the alarm execution log to see *which* alarms fired and when

## Dependencies

```bash
pip install tencentcloud-sdk-python
```

## Quick start

```python
import os
import json
from tencentcloud.common import credential
from tencentcloud.cls.v20201016 import cls_client, models

cred = credential.EnvironmentVariableCredential().get_credential()
client = cls_client.ClsClient(cred, os.environ["TENCENTCLOUD_REGION"])
```

## Key concepts

| Object | API methods | What it is |
|---|---|---|
| Alarm policy | `DescribeAlarms` / `CreateAlarm` / `ModifyAlarm` / `DeleteAlarm` | Query against one or more topics + condition + notice groups |
| Notice group | `DescribeAlarmNotices` / `CreateAlarmNotice` / … | Recipients (users / groups / webhooks) + escalation |
| Shield | `DescribeAlarmShields` / `CreateAlarmShield` / … | Time-bounded mute scoped to a notice group |
| Alarm log | `GetAlarmLog` | Firing history |

## Workflows

### List alarm policies

```python
req = models.DescribeAlarmsRequest()
req.Limit = 100
# Optional filters: req.Filters = [{"Key": "name", "Values": ["DeepSeek"]}]
resp = client.DescribeAlarms(req)
for a in resp.Alarms:
    print(a.AlarmId, a.Name, "Enable=", a.Enable, "Status=", a.Status)
```

### Get a single alarm policy in full

```python
req = models.DescribeAlarmsRequest()
req.Filters = [{"Key": "alarmId", "Values": ["<alarm-id>"]}]
resp = client.DescribeAlarms(req)
print(json.dumps(resp.Alarms[0]._serialize(), indent=2, ensure_ascii=False))
```

### Create an alarm

```python
req = models.CreateAlarmRequest()
req.Name = "OpenAI 5xx burst"
req.AlarmTargets = [{
    "TopicId": "<trace-topic-id>",
    "Query": "* | select count(*) as cnt where status_code >= 500",
    "Number": 1,
    "StartTimeOffset": -5,
    "EndTimeOffset": 0,
    "SyntaxRule": 1,             # 1 = CQL, 0 = Lucene
}]
req.MonitorTime = {"Type": "Period", "Time": 1}
req.Condition = "$1.cnt > 10"
req.AlarmPeriod = 5              # evaluate every 5 minutes
req.TriggerCount = 1             # fire after 1 consecutive match
req.AlarmLevel = 2               # 0=Notice, 1=Warning, 2=Critical
req.AlarmNoticeIds = ["<notice-id-a>", "<notice-id-b>"]
req.MonitorObjectType = 0
req.Enable = True

resp = client.CreateAlarm(req)
print("Created", resp.AlarmId)
```

### Quick enable / disable

```python
req = models.ModifyAlarmRequest()
req.AlarmId = "<alarm-id>"
req.Status = False               # mute (Status — runtime), keep Enable=True
client.ModifyAlarm(req)
```

> **`Enable` vs `Status`** are different fields. `Enable=False` archives the alarm definition; `Status=False` is the everyday on/off switch you want for muting.

### Modify thresholds without rewriting the whole payload

```python
req = models.ModifyAlarmRequest()
req.AlarmId = "<alarm-id>"
req.Condition = "$1.cnt > 20"
req.AlarmPeriod = 10
client.ModifyAlarm(req)
```

### Delete (destructive)

```python
# Confirm with the user first — there's no undo.
req = models.DeleteAlarmRequest()
req.AlarmId = "<alarm-id>"
client.DeleteAlarm(req)
```

### Manage notice groups

```python
# List
req = models.DescribeAlarmNoticesRequest()
req.Limit = 100
for n in client.DescribeAlarmNotices(req).AlarmNotices:
    print(n.AlarmNoticeId, n.Name, n.Type)

# Create
req = models.CreateAlarmNoticeRequest()
req.Name = "Ops on-call"
req.Type = "Trigger"             # Trigger | Recovery | All
req.NoticeReceivers = [{
    "ReceiverType": "Uin",
    "ReceiverIds": [123456],
    "ReceiverChannels": ["Email", "Sms"],
    "StartTime": "00:00:00",
    "EndTime": "23:59:59",
}]
req.WebCallbacks = [{
    "Url": "https://hooks.example.com/cls",
    "CallbackType": "WeCom",
    "Method": "POST",
}]
resp = client.CreateAlarmNotice(req)
```

### Time-bounded shield (mute during deploy)

```python
import time
req = models.CreateAlarmShieldRequest()
req.AlarmNoticeId = "<notice-id>"
req.StartTime = int(time.time())
req.EndTime = int(time.time()) + 7200       # 2 hours
req.Type = 1                                # 1 = full shield, 2 = partial
req.Reason = "Deploy <git-sha>"
client.CreateAlarmShield(req)
```

### Inspect alarm firing history

```python
req = models.GetAlarmLogRequest()
req.From = int((time.time() - 86400) * 1000)
req.To = int(time.time() * 1000)
req.Query = 'alarm_name:"OpenAI*"'
req.Limit = 100
resp = client.GetAlarmLog(req)
for line in resp.Results:
    print(line.Time, line.LogJson)
```

## Cloning an alarm

The fastest way to create a similar alarm is to read the existing one, strip read-only fields, tweak, and re-create:

```python
import json
existing = client.DescribeAlarms(models.DescribeAlarmsRequest(Filters=[{"Key": "alarmId", "Values": ["<src-id>"]}])).Alarms[0]
payload = json.loads(json.dumps(existing._serialize()))      # deep clone
for k in ("AlarmId", "CreateTime", "UpdateTime"):
    payload.pop(k, None)
payload["Name"] = "OpenAI 5xx burst v2"
# ...edit other fields...
req = models.CreateAlarmRequest()
req.from_json_string(json.dumps(payload))
print(client.CreateAlarm(req).AlarmId)
```

## Important reminders

- **Always preview the payload** (`json.dumps(req._serialize(), indent=2)`) before `CreateAlarm` / `ModifyAlarm` — schema is strict and errors are unhelpful.
- Destructive ops (`DeleteAlarm`, `DeleteAlarmNotice`, `DeleteAlarmShield`) need explicit user confirmation in chat before running.
- `Enable` (archived?) vs `Status` (currently on?) are *different* fields. Use `Status` for everyday muting.
- Shield rules are scoped to a single `AlarmNoticeId`. Iterate over all notice IDs to list all shields globally.
- Default region is `ap-hongkong`; pass another region via `cls_client.ClsClient(cred, "ap-singapore")` if needed.

## Console links

- Alarm console: <https://console.cloud.tencent.com/cls/alarm/list>
- Alarm API reference: <https://www.tencentcloud.com/document/product/614/56473>

© acedatacloud · Apache-2.0 · AceDataCloud/Skills

Similar skills

All skills for Cloud: AWS, Azure, GCP →
LFG Alarm lfg-gm LFG Alarm is a Claude Code MCP server that lets an AI schedule real alarms on mobile devices. Triggers sound on token price shifts, webhook calls or social updates. CX Codex +1 ★ 11repo stars monitoring-operations alexander-cedergren monitoring-operations — a skill for setting up OCI Monitoring metrics and alarms, and for figuring out why data stops showing up. Useful when an alarm stays silent or a metric disappears. CX Codex +1 1,400installs setting-up-cloudwatch-alarm-notifications aws setting-up-cloudwatch-alarm-notifications wires CloudWatch alarms to notification channels through SNS: encrypted topics, subscriptions, access policies and alarm actions. CX Codex +1 7,200installs huawei-cloud-cce-alarm-correlation-engine huaweicloud huawei-cloud-cce-alarm-correlation-engine pulls Huawei Cloud AOM alarms for CCE clusters, groups them by severity, finds storms and chronic noise, and manages alarm rules and notification rules. CX Codex +1 168installs wecom-notify Xueheng-Li wecom-notify — a skill for Claude Code and five other platforms that sends text, images, and files to WeCom (企业微信) via the WeCom API. Triggers when a task finishes and the agent needs to push a notification to the team. CX Codex +1 512installs core-web-vitals web-quality-skills core-web-vitals is a Claude Code skill that helps improve LCP, INP, and CLS using field data and browser traces. It activates for Core Web Vitals issues, including layout shifts. CX Codex +1 36,500installs

From the same set67

The whole set →

Project sponsors

Companies that keep this analytics open