Opsgenie を Rackspace Cloud Monitoring と統合する
Opsgenie が Rackspace ユーザーに提供するもの
Rackspace Cloud Monitoring を使用すると、オンプレミス、オフプレミス、クラウドプロバイダ、世界中のあらゆる場所にあるインフラストラクチャを簡単に監視できます。
Opsgenie の通知機能を完全にサポートして活用するには、Rackspace Cloud Monitoring アラートを Opsgenie へ送信します。メール、SMS、電話、iPhone、Android プッシュ通知を通じて Opsgenie 通知を受信し、添付ファイルを使用してアラートに追加情報を加え、アラートサイクル全体を記録します。
統合の機能性
Rackspace でアラートが作成されると、インテグレーションによって Opsgenie でアラートが自動的に作成されます。
Rackspace Webhook インテグレーションの設定
Rackspace supports email and webhook notification types. Although alerts can be sent via Email, Opsgenie provides a webhook API for Rackspace Cloud Monitoring to create alerts directly in Opsgenie data centers. The steps below describe how to integrate Rackspace and Opsgenie using webhook notifications:
Create an Opsgenie API Integration, copy the integration apiKey, and update the Rackspace account's "webhook_token" property.
curl -i -X PUT \
-d '{ "webhook_token" : "your_api_integration_key" }' \
-H 'X-Auth-Token: rackspace_auth_token' \
-H 'Content-Type: application/json' \
'https://monitoring.api.rackspacecloud.com/v1.0/1234/account'
https://api.opsgenie.com/v1/json/rackspace
URL を使用して Rackspace Cloud Monitoring で Webhook 通知を作成します。この URL はOpsgenie API によって提供されます。作成した通知を通知プランで使用します。Opsgenie から通知されるユーザーまたはユーザーのグループ (コンマ区切り) を "recipients" URL パラメーターで指定します。指定しない場合、すべてのユーザーに通知されます。
curl -i -X POST \
-d '{ "details" : { "url" : "https://api.opsgenie.com/v1/json/rackspace? recipients=john.smith@mycompany.com,operationsgroup" },
"label" : "opsgenie web hook",
"type" : "webhook"
}' \
-H 'X-Auth-Token: rackspace_auth_token' \
-H 'Content-Type: application/json' \
'https://monitoring.api.rackspacecloud.com/v1.0/1234/notifications'
完了です!Opsgenie の強力なアラートシステムのおかげで SMS、電話、iPhone または Android のプッシュ通知として Rackspace アラートを受信できるようになりました。
次の簡単なシナリオで、インテグレーションを実証しましょう。
ポート 8080 で実行されている Web サーバーのエンティティを Rackspace Cloud Monitoring で作成します。
curl -i -X POST \
-d '{ "ip_addresses" : { "default" : "78.187.83.242" },
"label" : "My Web Server"
}' \
-H 'X-Auth-Token: rackspace_auth_token' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
'https://monitoring.api.rackspacecloud.com/v1.0/1234/entities/'
次に、http チェックを作成します
curl -i -X POST \
-d' { "details" : {"method" : "GET",
"url" : "http://78.187.83.242:8080/"
},
"label" : "web server status check",
"monitoring_zones_poll" : [ "mzlon" ],
"period" : "60",
"target_alias" : "default",
"type" : "remote.http"
}' \
-H 'X-Auth-Token: rackspace_auth_token' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
'https://monitoring.api.rackspacecloud.com/v1.0/1234/entities/en41F9wnvg/checks'
Opsgenie Webhook 通知を作成します
curl -i -X POST \
-d '{ "details" : { "url" : "https://api.opsgenie.com/v1/json/rackspace?recipients=all" },
"label" : "opsgenie web hook",
"type" : "webhook"
}' \
-H 'X-Auth-Token: rackspace_auth_token' \
-H 'Content-Type: application/json' \
'https://monitoring.api.rackspacecloud.com/v1.0/1234/notifications'
Opsgenie Webhook 通知を使用して通知プランを作成します
テキスト
curl -i -X POST \
-d '{
"label": "Notification Plan 1",
"warning_state": [
"ntWArqzcoK"
],
"critical_state": [
"ntWArqzcoK"
],
"ok_state": [
"ntWArqzcoK"
]
}' \
-H 'X-Auth-Token: rackspace_auth_token' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
'https://monitoring.api.rackspacecloud.com/v1.0/1234/notification_plans'
最終的に、ウェブサーバーから来た HTTP エラーコードについて、通知プランのあるアラームを作成します。
curl -i -X POST \
-d '{ "check_id" : "chTfxuO8lm",
"criteria" : "if (metric[\"code\"] regex \"^[23]..$\") { return OK } return WARNING",
"notification_plan_id" : "npMuW2B1YL"
}' \
-H 'X-Auth-Token: rackspace_auth_token' \
-H 'Content-Type: application/json' \
-H 'Accept: application/json' \
'https://monitoring.api.rackspacecloud.com/v1.0/1234/entities/en41F9wnvg/alarms'
Web サーバーがシャットダウンされると、Rackspace Cloud Monitoring によって障害が検出され、次のような Opsgenie アラートが作成されます。
この内容はお役に立ちましたか?