tencent cloud

Cloud Log Service

ドキュメントCloud Log Serviceユースケース監視アラートアラートのPagerDuty/Slackなどサードパーティプラットフォームとの連携

アラートのPagerDuty/Slackなどサードパーティプラットフォームとの連携

ダウンロード
フォーカスモード
フォントサイズ
最終更新日: 2026-10-12 15:06:44
AI翻訳

概要

アラートはカスタムコールバックを通じてPagerDuty、Slack、Microsoft Teams、Jira Service Management、Google Chatと連携でき、アラート通知を統一的に受信するのに便利です。

設定手順

ステップ1:通知コンテンツテンプレートを新規作成する

1. CLSコンソールにログインします。
2. 左側のナビゲーションバーで、監視アラート > 通知内容テンプレートを選択し、通知内容テンプレート管理ページに移動します。
3. 新規作成をクリックし、カスタムコールバックタブで、連携するチャネルに応じて以下の情報を入力して保存します。
PagerDuty
Slack
Microsoft Teams
Jira Service Management
Google Chat
説明:
CLSはEvents API V2を通じてPagerDutyと連携します。現在のServiceにEvents API V2 Integrationが追加されていない場合は、Add Integrations to an Existing Serviceを実行してください。
以下のリクエスト内容のrouting_keyをPagerDutyのIntegration Keyに置き換えてください。
PagerDutyのIntegration URLも記録してください。後続の手順で使用します。
アラートトリガー
リクエストヘッダー
Accept: application/json
Content-Type: application/json
リクエスト内容
{
"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"
}
]
}
アラート復旧
リクエストヘッダー
Accept: application/json
Content-Type: application/json
リクエスト内容
{
"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"
}
アラートトリガー
リクエストヘッダー
Content-Type: application/x-www-form-urlencoded
リクエスト内容
{{- 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)}}"}}]}
アラート復旧
リクエストヘッダー
Content-Type: application/x-www-form-urlencoded
リクエスト内容
{{- 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)}}"}}]}
アラートトリガー
リクエストヘッダー
Content-Type: application/json
リクエスト内容
{{- 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}}]
}]
}
}]
}
アラート復旧
リクエストヘッダー
Content-Type: application/json
リクエスト内容
{{- 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
}]
}
}]
}
説明:
CLSはAPI Integrationを通じてJSM(Jira Service Management)と連携します。現在API Integrationが追加されていない場合は、Add a global integrationを実行してください。追加完了後、該当Integrationを有効化し、その中のAPI keyを取得してください。
以下のリクエストヘッダー内のAuthorizationをJSMのAPI Keyに置き換えてください。形式はBasic+スペース+Base64エンコード済みAPI Keyです。
アラートトリガー
リクエストヘッダー
Accept: application/json
Content-Type: application/json
Authorization: Basic YjdiYjI5MWXXXXXXXXXXXXXXXXXdhNDUyYjVmYjQw
リクエスト内容
{{- 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)}}"
}
アラート復旧
リクエストヘッダー
Accept: application/json
Content-Type: application/json
Authorization: Basic YjdiYjI5MWXXXXXXXXXXXXXXXXXdhNDUyYjVmYjQw
リクエスト内容
{{- 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)}}"
}
注意:
中国本土のリージョン(北京、広州、上海、重慶など)では、Google Chatとの直接連携はサポートされていません。
アラートトリガー
リクエストヘッダー
Content-Type: application/json; charset=UTF-8
リクエスト内容
{{- 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)}}"}
アラート復旧
リクエストヘッダー
Content-Type: application/json; charset=UTF-8
リクエスト内容
{{- 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)}}"}

ステップ2:通知チャネルグループを新規作成する

1. 左側のナビゲーションバーで、監視アラート>通知チャネルグループを選択し、通知チャネルグループ管理ページに移動します。
2. 新規作成をクリックし、通知ルールでルールを追加をクリックし、通知チャネルの設定で以下の情報を入力して保存します:
チャネルタイプ:カスタムインターフェースコールバック
Webhookアドレス:
PagerDuty:Add Integrations to an Existing Service手順のIntegration URL。
Slack:CLSはIncoming Webhooksを通じてSlackと連携します。現在適切なIncoming Webhooksがない場合は、Sending messages using incoming webhooksを実行してIncoming Webhookを作成し、そのWebhook URLを取得してください。
Microsoft Teams:CLSはWorkflowsを通じてTeamsと連携します。Create incoming webhooks with Workflows for Microsoft Teamsを実行し、テンプレート方式でワークフローを作成して、そのURLを取得してください。テンプレートでは「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はwebhookを通じてGoogle Chatと連携します。現在適切なwebhookがない場合は、Register the incoming webhookを実行してWebhookを作成し、そのwebhook URLを取得してください。
リクエストメソッド:POST
コンテンツテンプレート:手順1で新規作成した通知コンテンツテンプレートを選択します。
説明:
詳細な設定手順については、通知チャネルグループの管理を参照してください。

ステップ3:アラートポリシーで通知チャネルグループを選択する

1. 左側のナビゲーションバーで、監視アラート > アラートポリシーを選択し、アラートポリシー管理ページに進みます。
2. 新規作成をクリックし、アラートポリシーの設定を開始します。詳細な設定手順については、アラートポリシーの設定を参照してください。通知チャネルグループを関連付ける際は、手順2で新規作成した通知チャネルグループを選択します。




ヘルプとサポート

この記事はお役に立ちましたか?

フィードバック