LoginSignup
4
2

More than 1 year has passed since last update.

GoogleCloudMonitoringのAlartingとPagerDutyの連携(PagerDuty Services)

Last updated at Posted at 2021-12-04

GCPのCloudMonitoringとPagerDutyの連携方法について紹介します。PagerDutyとの連携方法としてCloudMonitoring では PagerDuty ServicesPagerDuty Sync の二種類がありますが本記事ではPagerDuty Servicesについて紹介します。CloudMonitoringとPagerDutyで同じKeyなのに名前が違うという問題があったため参考になればと思います。

連携手順

  • PagerDutyのService Keyを生成
  • CloudMontoringのalertingの設定にて PagerDuty Services にトークンを設定
  • Alartingの通知チャネルに作成したPagerDuty宛のチャネルを紐付け

PagerDutyのService Keyを生成

まず最初に、PagerDutyの連携したいServiceのIntegrationから Event API v2 を追加します。

Add_Integrations_-_PagerDuty.png

追加できたら、追加した Event API v2 の詳細を確認し、Integration Keyをコピーしておきます。これがCloudMonitoringで指定するService Keyいなります。

zozo-ma-alert_-_PagerDuty.png

CloudMontoringのAlertingの設定にて PagerDuty Services にトークンを設定

次にGCPにて、 CloudMonitoring > Alaring > EDIT NOTIFICATOIN CHANNEL から PagerDuty ServicesAdd を選択します。

Notification_channels_–_Monitoring_–_lfm-production_–_Google_Cloud_Platform-3.png

そして、 Service Key に先程作成したPagerDutyの Integration Key を設定すれば連携は完了です。

Notification_channels_–_Monitoring_–_lfm-production_–_Google_Cloud_Platform-2.png

保存前に、 TEST CONNECTION で通知のテストを行うことができます。

Alartingの通知チャネルに作成したPagerDuty宛のチャネルを紐付け

あとは、Alartingの設定にて、通知先に作成したPagerDutyのチャネルを設定したらアラート発生時にPagerDutyに通知されます。

Edit_alerting_policy_–_Monitoring_–_lfm-production_–_Google_Cloud_Platform.png

連携の注意点

PagerDuty Services を利用して連携を行った場合、CloudMonitoring側でアラートがresolveされると勝手にPagerDuty側のページャもクローズされてしまいます。このため、例えば一時的なエラーが発生していて、エラーが発生しなくなりアラートがresolveされたが実はそのタイミングで根本対応しなければ行けなかったみたいな場合に困ってしまいます。

その場合は、以下の `` のチェックを外すと、CloudMonitoring側でのresolve時にPagerDutyに通知されなくなります。また、このときSlack等別のチャネルとも連携している場合にはそちらにも通知されなくなるため注意が必要です。

Edit_alerting_policy_–_Monitoring_–_lfm-production_–_Google_Cloud_Platform.png

まとめ

本記事ではGCPのCloudMonitoringとPagerDutyの連携方法のうち PagerDuty Services を利用する方法を紹介しました。 PagerDuty Sync というものもあるため、使い心地の違いなど知見が有りましたら教えて下さい。

4
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2