• 製品
  • 使用を開始する
  • 関連ドキュメント
  • リソース

Opsgenie を受信 Amazon SNS と統合する

概要

Amazon SNS では、Apple、Google、Fire OS、Windows デバイスと Baidu Cloud Push を使用して中国の Android デバイスへのプッシュ通知をする、シンプルで費用対効果の高いソリューションです。

​統合によって何ができますか?

OpsgenieAmazon SNS 通知のディスパッチャーとして機能します。オンコール スケジュールに基づいて通知すべきユーザーを決定し、メール、テキスト メッセージ (SMS)、電話、iPhone や Android のプッシュ通知で通知を行い、アラートが承認またはクローズされるまでアラートをエスカレートします。

統合による機能

SNS でアラートが作成されると、統合によって Opsgenie でアラートが自動で作成されます。

統合をセットアップする

Amazon SNS は API ベースの統合です。セットアップするには、次のステップに従います。

  • OpsgenieAmazon SNS 統合を追加する

  • Amazon SNS でサブスクリプションをセットアップする

Amazon SNS 統合を追加する

Opsgenie の Free プランまたは Essentials プランを使用している、または Jira Service Management の Standard プランで Opsgenie を使用している場合は、チーム ダッシュボードからのみこの統合を追加できます。このプランでは、[設定] の [統合] ページが利用できません。

  1. [チーム] に移動して自分のチームを選択します。

  2. 左側のナビゲーションで [統合] を選択し、[統合を追加] を選択します。

統合をチーム ダッシュボードから追加すると、そのチーム統合の所有者になります。Opsgenie では、この統合を通じて受信したアラートはそのチームのみに割り当てられます。このセクションの残りの手順に従って、統合を設定してください。

Opsgenie に Amazon SNS 統合を追加するには、次の手順に従います。

  1. [設定] > [統合] の順に移動します。

  2. [統合を追加] を選択します。

  3. 検索を実行して「Amazon SNS」を選択します。

  4. 次の画面で、統合の名前を入力します。

  5. オプション: 特定のチームが統合からのアラートを受信するようにする場合は、[Assignee team (担当者チーム)] のチームを選択します。

  6. [続行] を選択します。
    この時点で、統合が保存されます。

  7. [統合を設定するステップ] セクションを展開して、Opsgenie のエンドポイントと API キーを含む統合 URL をコピーします。
    この URL は、後ほど Amazon SNS で統合を設定する際に使用します。

  8. [統合をオンにする] を選択します。
    統合のために作成したルールは、統合をオンにした場合にのみ機能します。

Amazon SNS でサブスクリプションをセットアップする

1. SNS トピックを作成します。
詳細については、「Getting started with Amazon SNS (Amazon SNS を使い始める)」を参照してください。

2. Opsgenie で統合を追加する際にコピーした URL をエンドポイントとして使用して、トピックに HTTPS サブスクリプションを追加します。

Amazon SNS サブスクリプション

設定が正常に完了すると、Opsgenie で確認のアラートが作成されます。HTTPS サブスクリプションの追加方法に関する詳細は、「Amazon SNS トピック (Amazon Simple Notification Service) を登録する」をご参照ください。

3. メッセージ属性によって、アラートのエイリアス、エンティティ、タグ、受信者、チーム、カスタム アクションを指定します。
詳細は「Amazon SNS メッセージ属性」をご参照ください。

SNS メッセージ属性

(プレーン テキスト形式)

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"}

Amazon SNS から送信されるペイロードの例

アラート ペイロード (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"} } }

その他のヘルプ