ユーザーとして Opsgenie の利用を開始する
プロフィールの設定、Opsgenie からの通知の取得、オンコール スケジュールの表示に関するすべての方法を説明します。
Amazon SNS では、Apple、Google、Fire OS、Windows デバイスと Baidu Cloud Push を使用して中国の Android デバイスへのプッシュ通知をする、シンプルで費用対効果の高いソリューションです。
Opsgenie は Amazon SNS の通知のディスパッチャーとして機能して、オンコール スケジュールに基づいて通知する適切な担当者を決定します。メール、テキスト メッセージ (SMS)、電話、iPhone、Android のプッシュ通知によって通知して、アラートが確認されるかクローズされるまでアラートをエスカレートします。
SNS でアラートが作成されると、統合によって Opsgenie でアラートが自動で作成されます。
この統合はチーム ダッシュボードから追加可能
Opsgenie の Free または Essentials の各プランを使用している、または Jira Service Management の Standard プランで Opsgenie を使用している場合、このプランでは [設定] の [統合] ページが利用できないため、この統合はチーム ダッシュボードからのみ追加できます。
統合をチーム ダッシュボードから追加すると、そのチーム統合の所有者になります。Opsgenie では、この統合を通じて受信したアラートはそのチームのみに割り当てられます。
そのためには、次の手順に従います。
Teams からチーム ダッシュボードに移動します。
[統合] > [統合を追加] の順に選択します。
残りの手順に従って統合を完了します。
[設定] > [統合] の順に移動します。Amazon SNS を検索して [追加] を選択します。
[応答者] フィールドによって SNS アラートの通知先を指定します。入力し始めると、オートコンプリートの候補が表示されます。
Opsgenie のエンドポイントと API キーを含む統合 URL をコピーします。
[Save Integration (統合の保存)] を選択します。
2. Opsgenie インテグレーションから提供された URL を使用して、Opsgenie の API エンドポイントを持つトピックに HTTPS サブスクリプションを追加します。
Opsgenie への SNS サブスクリプションを正常に設定すると、Opsgenie に確認アラートが作成されます。
MessageAttributes を使用して、アラートのエイリアス、エンティティ、タグ、受信者、チーム、カスタム アクションを指定します。
テキスト
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
AmazonSNSClient snsClient = new AmazonSNSClient(new BasicAWSCredentials("AWS_ACCESS_KEY","AWS_SECRET_KEY"));
String msg = "This is the description of Sns Integration test alert";
String subject = "Sns Integration Test alert";
PublishRequest publishRequest = new PublishRequest("arn:aws:sns:us-east-1:974xxxxxxx:OpsGenieSns", msg, subject);
publishRequest.addMessageAttributesEntry("eventType", new MessageAttributeValue()
.withDataType("String").withStringValue("create"));
publishRequest.addMessageAttributesEntry("alias", new MessageAttributeValue()
.withDataType("String").withStringValue("testalertalias"));
publishRequest.addMessageAttributesEntry("entity", new MessageAttributeValue()
.withDataType("String").withStringValue("Test alert entity"));
publishRequest.addMessageAttributesEntry("tags", new MessageAttributeValue()
.withDataType("String").withStringValue("trial"));
publishRequest.addMessageAttributesEntry("recipients", new MessageAttributeValue()
.withDataType("String").withStringValue("none"));
publishRequest.addMessageAttributesEntry("teams", new MessageAttributeValue()
.withDataType("String").withStringValue("team1,team2"));
publishRequest.addMessageAttributesEntry("actions", new MessageAttributeValue()
.withDataType("String").withStringValue("customAction"));
PublishResult publishResult = snsClient.publish(publishRequest);
"MessageAttributes" のすべてのフィールドはオプションです。実行するアクションを指定するには、"eventType" フィールドを送信します。"eventType" が指定されていない場合は、アラートが作成されます。
以下に示すように、アクションを実行するには、"eventType" を指定する必要があります。
アクションを作成する -> "eventType" : {"Type":"String","Value":"create"}
アクションを閉じる -> "eventType" : {"Type":"String","Value":"close"}
アクションを承認する -> "eventType" : {"Type":"String","Value":"acknowledge"}
メモ アクションを追加する -> "eventType" : {"Type":"String","Value":"addNote"}
アラートのペイロードを作成します。
JSON
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
{
"Type" : "Notification",
"MessageId" : "0323d595-6aed-5dd4-a378-9811daf7d3ed",
"TopicArn" : "arn:aws:sns:us-east-1:9747xxxxxxx:gj",
"Subject" : "Sns Integration Test alert",
"Message" : "This is the description of Sns Integration test alert",
"Timestamp" : "2015-03-18T15:24:31.877Z",
"SignatureVersion" : "1",
"Signature" : "QplK4lyJWAtjIV9BzcF4AHTKT+VTupYqJIzxxxxxxxxxxx4QR8EdAYr31xDjI8...",
"SigningCertURL" : "https://sns.us-east-1.amazonaws.com/SimpleNotificationService-dxxxxd67.pem",
"UnsubscribeURL" : "https://sns.us-east-1.amazonaws.com/?Action=Unsubscribe..",
"MessageAttributes" : {
"alias" : {"Type":"String","Value":"testalertalias"},
"entity" : {"Type":"String","Value":"snstestentity"},
"tags" : {"Type":"String","Value":"tag1,tag2"},
"eventType" : {"Type":"String","Value":"create"},
"recipients" : {"Type":"String","Value":"all"},
"teams" : {"Type":"String","Value":"team1,team2"},
"actions" : {"Type":"String","Value":"act1,act2"}
}
}
この内容はお役に立ちましたか?