翻訳は機械翻訳により提供されています。提供された翻訳内容と英語版の間で齟齬、不一致または矛盾がある場合、英語版が優先します。
アラート通知チャネル API
アラート通知チャネル API を使用して通知チャネルを作成、更新、削除、取得します。
通知チャネルの識別子 (id) は自動増分数値で、ワークスペースごとに一意です。通知チャネルの一意の識別子 (uid) は、複数のワークスペース間のフォルダを一意に識別するために使用できます。通知チャネルを作成するときに指定しない場合は、自動的に生成されます。uid を使用すると、通知チャネルにアクセスしたり、複数の Amazon Managed Grafana ワークスペース間の通知チャネルを同期したりするための、一貫した URL を設定できます。
注記
Amazon Managed Grafana ワークスペースで Grafana API を使用するには、有効な Grafana API トークンが必要です。このトークンは API リクエストの Authorization
フィールドに含めます。API コールを認証するトークンの作成方法については、「トークンを使用した認証」を参照してください。
すべての通知チャネルの取得
認証されたユーザーが表示アクセス許可を持つ、すべての通知チャネルを返します。
GET /api/alert-notifications
リクエストの例
GET /api/alert-notifications HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer 1234abcd567exampleToken890
レスポンスの例
HTTP/1.1 200 Content-Type: application/json [ { "id": 1, "uid": "sns-uid", "name": "test", "type": "sns", "isDefault": false, "sendReminder": false, "disableResolveMessage": false, "frequency": "", "created": "2023-09-08T19:57:56Z", "updated": "2023-09-08T19:57:56Z", "settings": { "authProvider": "default", "autoResolve": true, "httpMethod": "POST", "messageFormat": "json", "severity": "critical", "topic": "<SNS-TOPIC-ARN>", "uploadImage": false }, "secureFields": {} } ]
すべての通知チャネルの取得 (ルックアップ)
すべての通知チャネルを返しますが、詳細情報が少なくなります。認証されたユーザーがアクセスでき、主にアラートルールを設定するときに、Grafana ワークスペースコンソール UI でアラート通知チャネルを提供するために使用します。
GET /api/alert-notifications/lookup
リクエストの例
GET /api/alert-notifications/lookup HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer 1234abcd567exampleToken890
レスポンスの例
HTTP/1.1 200 Content-Type: application/json [ { "id": 1, "uid": "sns-uid", "name": "test", "type": "sns", "isDefault": false }, { "id": 2, "uid": "slack-uid", "name": "Slack", "type": "slack", "isDefault": false } ]
UID によるすべての通知チャネルの取得
GET /api/alert-notifications/uid/:uid
リクエストの例
GET /api/alert-notifications/uid/sns-uid HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer 1234abcd567exampleToken890
レスポンスの例
HTTP/1.1 200 Content-Type: application/json { "id": 1, "uid": "sns-uid", "name": "test", "type": "sns", "isDefault": false, "sendReminder": false, "disableResolveMessage": false, "frequency": "", "created": "2023-09-08T19:57:56Z", "updated": "2023-09-08T19:57:56Z", "settings": { "authProvider": "default", "autoResolve": true, "httpMethod": "POST", "messageFormat": "json", "severity": "critical", "topic": "<SNS-TOPIC-ARN>", "uploadImage": false }, "secureFields": {} }
Id によるすべての通知チャネルの取得
GET /api/alert-notifications/:id
リクエストの例
GET /api/alert-notifications/1 HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer 1234abcd567exampleToken890
レスポンスの例
HTTP/1.1 200 Content-Type: application/json { "id": 1, "uid": "sns-uid", "name": "test", "type": "sns", "isDefault": false, "sendReminder": false, "disableResolveMessage": false, "frequency": "", "created": "2023-09-08T19:57:56Z", "updated": "2023-09-08T19:57:56Z", "settings": { "authProvider": "default", "autoResolve": true, "httpMethod": "POST", "messageFormat": "json", "severity": "critical", "topic": "<SNS-TOPIC-ARN>", "uploadImage": false }, "secureFields": {} }
通知チャネルの作成
Amazon Managed Grafana でサポートされている通知チャネルを確認するには、「コンタクトポイント (通知先) の使用」でサポート対象の通知方法のリストを参照してください。
POST /api/alert-notifications
リクエストの例
POST /api/alert-notifications HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer 1234abcd567exampleToken890 { "uid": "new-sns-uid", // optional "name": "sns alert notification", //Required "type": "sns", //Required "isDefault": false, "sendReminder": false, "settings": { "authProvider": "default", "autoResolve": true, "httpMethod": "POST", "messageFormat": "json", "severity": "critical", "topic": "<SNS-TOPIC-ARN>", "uploadImage": false } }
レスポンスの例
HTTP/1.1 200 Content-Type: application/json { "id": 1, "uid": "new-sns-uid", "name": "sns alert notification", "type": "sns", "isDefault": false, "sendReminder": false, "settings": { "authProvider": "default", "autoResolve": true, "httpMethod": "POST", "messageFormat": "json", "severity": "critical", "topic": "<SNS-TOPIC-ARN>", "uploadImage": false }, "created": "2018-04-23T14:44:09+02:00", "updated": "2018-08-20T15:47:49+02:00" }
UID による通知チャネルの更新
PUT /api/alert-notifications/uid/:uid
リクエストの例
PUT /api/alert-notifications/uid/sns-uid HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer 1234abcd567exampleToken890 { "uid": "sns-uid", // optional "name": "sns alert notification", //Required "type": "sns", //Required "isDefault": false, "sendReminder": true, "frequency": "15m", "settings": { "authProvider": "default", "autoResolve": true, "httpMethod": "POST", "messageFormat": "json", "severity": "critical", "topic": "<SNS-TOPIC-ARN>", "uploadImage": false } }
レスポンスの例
HTTP/1.1 200 Content-Type: application/json { "id": 1, "uid": "sns-uid", "name": "sns alert notification", "type": "sns", "isDefault": false, "sendReminder": true, "frequency": "15m", "settings": { "authProvider": "default", "autoResolve": true, "httpMethod": "POST", "messageFormat": "json", "severity": "critical", "topic": "<SNS-TOPIC-ARN>", "uploadImage": false }, "created": "2017-01-01 12:34", "updated": "2017-01-01 12:34" }
Id による通知チャネルの更新
PUT /api/alert-notifications/:id
リクエストの例
PUT /api/alert-notifications/1 HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer 1234abcd567exampleToken890 { "id": 1, "uid": "sns-uid", // optional "name": "sns alert notification", //Required "type": "sns", //Required "isDefault": false, "sendReminder": true, "frequency": "15m", "settings": { "authProvider": "default", "autoResolve": true, "httpMethod": "POST", "messageFormat": "json", "severity": "critical", "topic": "<SNS-TOPIC-ARN>", "uploadImage": false } }
レスポンスの例
HTTP/1.1 200 Content-Type: application/json { "id": 1, "uid": "sns-uid", "name": "sns alert notification", "type": "sns", "isDefault": false, "sendReminder": true, "frequency": "15m", "settings": { "authProvider": "default", "autoResolve": true, "httpMethod": "POST", "messageFormat": "json", "severity": "critical", "topic": "<SNS-TOPIC-ARN>", "uploadImage": false }, "created": "2017-01-01 12:34", "updated": "2017-01-01 12:34" }
UID による通知チャネルの削除
DELETE /api/alert-notifications/uid/:uid
リクエストの例
DELETE /api/alert-notifications/uid/sns-uid HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer 1234abcd567exampleToken890
レスポンスの例
HTTP/1.1 200 Content-Type: application/json { "message": "Notification deleted" }
Id による通知チャネルの削除
DELETE /api/alert-notifications/:id
リクエストの例
DELETE /api/alert-notifications/1 HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer 1234abcd567exampleToken890
レスポンスの例
HTTP/1.1 200 Content-Type: application/json { "message": "Notification deleted" }
テスト通知チャネル
指定された通知チャネルタイプおよび設定のテスト通知メッセージを送信します。
POST /api/alert-notifications/test
リクエストの例
POST /api/alert-notifications/test HTTP/1.1 Accept: application/json Content-Type: application/json Authorization: Bearer 1234abcd567exampleToken890 { "type": "sns", "settings": { "authProvider": "default", "autoResolve": true, "httpMethod": "POST", "messageFormat": "json", "severity": "critical", "topic": "<SNS-TOPIC-ARN>", "uploadImage": false } }
レスポンスの例
HTTP/1.1 200 Content-Type: application/json { "message": "Test notification sent" }