tencent cloud

Alarm Integration with Third-Party Platforms Such As PagerDuty and Slack
Last updated: 2025-06-20 10:15:25
Alarm Integration with Third-Party Platforms Such As PagerDuty and Slack
Last updated: 2025-06-20 10:15:25

Overview

Alarms can connect to PagerDuty, Slack, Microsoft Teams, Jira Service Management, and Google Chat via Custom Callback, making it easy to unify and receive alarm notifications.

Configuration Process

Step 1: Creating a Notification Template

1. Log in to the Cloud Log Service console.
2. In the left navigation bar, select Monitoring Alarm > Notification Template to enter the notification template management page.
3. Click Create, in the Webhook tag, fill in the following information according to the channels that need to be integrated and save.
PagerDuty
Slack
Microsoft Teams
Jira Service Management
Google Chat
Note:
CLS integrates with PagerDuty via Events API V2. If the current Service has not added Events API V2 Integration, execute Add Integrations to an Existing Service.
Replace routing_key in the following request content with the Integration Key in PagerDuty.
Note: Record the Integration URL in PagerDuty for subsequent steps.
Alarm triggered
Request Header
Accept: application/json
Content-Type: application/json
Request Content
{
"payload": {
"summary": "{{escape .Alarm}}",
"timestamp": "{{fromUnixTime .NotifyTimeUnix}}",
"severity": "{{if eq .Level "Critical"}}critical{{else if eq .Level "Warn"}}warning{{else if eq .Level "Info"}}info{{end}}",
"source": "Tencent Cloud Log Service",
"custom_details": {
"Alarm Policy": "{{escape .Alarm}}",
"Trigger Condition": "{{escape .Condition}}",
"Current Data": "{{escape .TriggerParams}}",
"Additional Message": "{{escape .Message}}",
"Multidimensional Analysis": "{{escape .AnalysisResultFormat}}"
}
},
"routing_key": "R03ECCMUCxxxxxxxxxxxNGFE87CT",
"dedup_key": "{{.RecordGroupId}}",
"event_action": "trigger",
"client": "{{escape .Topic}}",
"client_url": "{{.QueryUrl}}",
"links": [
{
"href": "{{.DetailUrl}}",
"text": "Alert Detail"
}
]
}
Alarm cleared
Request Header
Accept: application/json
Content-Type: application/json
Request Content
{
"payload": {
"summary": "{{escape .Alarm}}",
"timestamp": "{{fromUnixTime .NotifyTimeUnix}}",
"severity": "{{if eq .Level "Critical"}}critical{{else if eq .Level "Warn"}}warning{{else if eq .Level "Info"}}info{{end}}",
"source": "Tencent Cloud Log Service"
},
"routing_key": "R03ECCMUCxxxxxxxxxxxNGFE87CT",
"dedup_key": "{{.RecordGroupId}}",
"event_action": "resolve"
}
Alarm triggered
Request Header
Content-Type: application/x-www-form-urlencoded
Request Content
{{- define "subTemplate" -}}
Alarm triggered for the log service of account {{.UIN}} ({{.Nickname}}):
• Alarm Policy: {{.Alarm}}
• Alarm Level: {{.Level}}
• Monitoring Object: {{.Topic}}
• Trigger Condition: {{.Condition}}
• Current Data: {{.TriggerParams}}
• Trigger Time: {{.StartTime}}
{{- if (gt .Duration 0)}}
• Duration: {{.Duration}} minutes
{{- end}}
• Additional Message: {{.Message}}
• Multidimensional Analysis:
``{{.AnalysisResultFormat}}``
<{{.DetailUrl}}|DetailedReport> <{{.QueryUrl}}|QueryData>{{if .CanSilent}} <{{.DetailUrl}}|ClaimAlarm> <{{.SilentUrl}}|SilenceAlarm>{{end}}
{{- end -}}
payload={"username": "CLS Alert","icon_emoji": ":rotating_light:","blocks": [{"type":"header","text":{"type":"plain_text","text":":rotating_light:Alarm:{{escape .Alarm}}","emoji":true}},{"type": "section","text": {"type": "mrkdwn","text": "{{escape (substr (renderTemplate "subTemplate") 0 3500)}}"}}]}
Alarm cleared
Request Header
Content-Type: application/x-www-form-urlencoded
Request Content
{{- define "subTemplate" -}}
A CLS alarm was resolved under your account (ID: {{.UIN}}; name: {{.Nickname}}):
• Alarm Policy: {{.Alarm}}
• Alarm Level: {{.Level}}
• Monitoring Object: {{.Topic}}
• Trigger Condition: {{.Condition}}
• Trigger Time: {{.StartTime}}
• Resolved Time: {{.NotifyTime}}
• Duration: {{.Duration}} minutes"
{{- end -}}
payload={"username": "CLS Alert","icon_emoji": ":green_circle:","blocks": [{"type":"header","text":{"type":"plain_text","text":":large_green_circle:Resolved:{{escape .Alarm}}","emoji":true}},{"type": "section","text": {"type": "mrkdwn","text": "{{escape (substr (renderTemplate "subTemplate") 0 3500)}}"}}]}
Alarm triggered
Request Header
Content-Type: application/json
Request Content
{{- define "subTemplate" -}}
Alarm triggered for the log service of account {{.UIN}} ({{.Nickname}}):
- Alarm Policy: {{.Alarm}}
- Alarm Level: {{.Level}}
- Monitoring Object: {{.Topic}}
- Trigger Condition: {{.Condition}}
- Current Data: {{.TriggerParams}}
- Trigger Time: {{.StartTime}}
{{- if (gt .Duration 0)}}
- Duration: {{.Duration}} minutes
{{- end}}
- Additional Message: {{.Message}}

{{- range $key,$value := .AnalysisResult}}

{{$key}}

{{$value}}
{{- end}}
{{- end -}}
{
"type": "message",
"attachments": [{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.3",
"msteams": {"width": "Full"},
"body": [
{
"type": "TextBlock",
"text": "Alarm:{{escape .Alarm}}",
"wrap": true,
"color": "{{if eq .Level "Critical"}}attention{{else if eq .Level "Warn"}}warning{{else if eq .Level "Info"}}accent{{end}}",
"size": "Large"
},
{
"type": "TextBlock",
"text": "{{- escape (substr (renderTemplate "subTemplate") 0 3500)}}",
"wrap": true
},
{
"type": "ActionSet",
"actions": [{"type":"Action.OpenUrl","title":"DetailedReport","url":"{{.DetailUrl}}"},{"type":"Action.OpenUrl","title":"QueryData","url":"{{.QueryUrl}}"}{{if.CanSilent}},{"type":"Action.OpenUrl","title":"ClaimAlarm","url":"{{.DetailUrl}}"},{"type":"Action.OpenUrl","title":"SilenceAlarm","url":"{{.SilentUrl}}"}{{end}}]
}]
}
}]
}
Alarm cleared
Request Header
Content-Type: application/json
Request Content
{{- define "subTemplate" -}}
A CLS alarm was resolved under your account (ID: {{.UIN}}; name: {{.Nickname}}):
- Alarm Policy: {{.Alarm}}
- Alarm Level: {{.Level}}
- Monitoring Object: {{.Topic}}
- Trigger Condition: {{.Condition}}
- Trigger Time: {{.StartTime}}
- Resolved Time: {{.NotifyTime}}
- Duration: {{.Duration}} minutes"
{{- end -}}
{
"type": "message",
"attachments": [{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.3",
"msteams": {"width": "Full"},
"body": [
{
"type": "TextBlock",
"text": "Resolved:{{escape .Alarm}}",
"wrap": true,
"color": "good",
"size": "Large"
},
{
"type": "TextBlock",
"text": "{{- escape (substr (renderTemplate "subTemplate") 0 3500)}}",
"wrap": true
}]
}
}]
}
Note:
CLS connects with JSM (Jira Service Management) through API Integration. If no API Integration is currently added, execute Add a global Integration. After adding, enable the Integration and obtain the API key.
Replace Authorization in the request header with the API Key in JSM, format Basic+space+API Key after Base64 encoding.
Alarm triggered
Request Header
Accept: application/json
Content-Type: application/json
Authorization: Basic YjdiYjI5MWXXXXXXXXXXXXXXXXXdhNDUyYjVmYjQw
Request Content
{{- define "subTemplate" -}}
Current Data:{{.TriggerParams}}
Additional Message:{{.Message}}
{{.AnalysisResultFormat}}
Detail Report:{{.DetailUrl}}
{{- end -}}
{
"message": "{{escape .Alarm}}",
"alias": "{{.RecordGroupId}}",
"description": "Alarm Policy:{{escape .Alarm}}\\nTrigger Condition:{{escape .Condition}}",
"entity": "{{escape .Topic}}",
"source": "Tencent Cloud Log Service",
"priority": "{{if eq .Level "Critical"}}P1{{else if eq .Level "Warn"}}P2{{else if eq .Level "Info"}}P5{{end}}",
"note": "{{escape (substr (renderTemplate "subTemplate") 0 3500)}}"
}
Alarm cleared
Request Header
Accept: application/json
Content-Type: application/json
Authorization: Basic YjdiYjI5MWXXXXXXXXXXXXXXXXXdhNDUyYjVmYjQw
Request Content
{{- define "subTemplate" -}}
Alarm was resolved
Trigger Time:{{.StartTime}}
Resolved Time:{{.NotifyTime}}
Duration: {{.Duration}} minutes"
{{- end -}}
{
"message": "{{escape .Alarm}}",
"alias": "{{.RecordGroupId}}",
"description": "Alarm Policy:{{escape .Alarm}}\\nTrigger Condition:{{escape .Condition}}",
"entity": "{{escape .Topic}}",
"source": "Tencent Cloud Log Service",
"priority": "{{if eq .Level "Critical"}}P1{{else if eq .Level "Warn"}}P2{{else if eq .Level "Info"}}P5{{end}}",
"note": "{{escape (substr (renderTemplate "subTemplate") 0 3500)}}"
}
Note:
Google Chat is not supported in Chinese mainland regions (Beijing, Guangzhou, Shanghai, Chongqing).
Alarm triggered
Request Header
Content-Type: application/json; charset=UTF-8
Request Content
{{- define "subTemplate" -}}
*Alarm triggered for the log service of account {{.UIN}} ({{.Nickname}})*
* Alarm Policy: {{.Alarm}}
* Alarm Level: {{.Level}}
* Monitoring Object: {{.Topic}}
* Trigger Condition: {{.Condition}}
* Current Data: {{.TriggerParams}}
* Trigger Time: {{.StartTime}}
{{- if (gt .Duration 0)}}
* Duration: {{.Duration}} minutes
{{- end}}
* Additional Message: {{.Message}}
* Multidimensional Analysis:
``{{.AnalysisResultFormat}}``
<{{.DetailUrl}}|DetailedReport> <{{.QueryUrl}}|QueryData>{{if .CanSilent}} <{{.DetailUrl}}|ClaimAlarm> <{{.SilentUrl}}|SilenceAlarm>{{end}}
{{- end -}}
{"text": "{{escape (substr (renderTemplate "subTemplate") 0 3500)}}"}
Alarm cleared
Request Header
Content-Type: application/json; charset=UTF-8
Request Content
{{- define "subTemplate" -}}
*A CLS alarm was resolved under your account (ID: {{.UIN}}; name: {{.Nickname}})*
* Alarm Policy: {{.Alarm}}
* Alarm Level: {{.Level}}
* Monitoring Object: {{.Topic}}
* Trigger Condition: {{.Condition}}
* Trigger Time: {{.StartTime}}
* Resolved Time: {{.NotifyTime}}
* Duration: {{.Duration}} minutes"
{{- end -}}
{"text": "{{escape (substr (renderTemplate "subTemplate") 0 3500)}}"}

Step 2: Creating a New Notification Channel Group

1. In the left navigation bar, select Monitoring Alarm > Notification Group to access the Notification Group Management Page.
2. Click Create, then click Add rule in Notification rules, and fill in the following information in Set notification channel and save:
Type: Custom webhooks.
Webhook address:
PagerDuty: Integration URL in the Add Integrations to an Existing Service procedure.
Slack: CLS integrates with Slack through Incoming Webhooks. If there is no suitable Incoming Webhook currently, execute Sending messages using incoming webhooks, create an Incoming Webhook, and obtain the Webhook URL.
Microsoft Teams: CLS integrates with Teams through Workflows. Execute Create incoming webhooks with Workflows for Microsoft Teams, create a workflow using the template method, and retrieve the URL. For the template, select "Post to a channel when a webhook request is received".
Jira Service Management: https://api.atlassian.com/jsm/ops/integration/v2/alerts.
Google Chat: CLS integrates with Google Chat via webhook. If no suitable webhook is currently available, execute Register the incoming webhook to create a webhook and obtain the webhook URL.
Request Method: POST
Notification template: Select the one created in Step 1.
Note:
Detailed configuration instructions can be found in Manage Notification Group.

Step 3: Selecting a Notification Channel Group in the Alarm Policy

1. In the left navigation bar, select Monitoring Alarm > Alarm Policy to enter the alarm policy management page.
2. Click Create to start configuring the alarm policy. For detailed configuration instructions, refer to Configure Alarm Policy. When associating a notification group, select the Step 2 newly created notification channel group.



Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback