Search code examples
python-3.xgoogle-cloud-platformgoogle-cloud-functionsstackdrivergoogle-cloud-monitoring

GCP: Is it possible for a Cloud function to trigger when an Alert fires?


I am using Google Cloud Monitoring of Google Cloud Platform.

I have created some alert policies for objects that I monitor. However , When there is an alert that fires a, there are some pieces of information that are not included that I want included into the email. So I am thinking to use a cloud function that will trigger upon one of the policies I have created if that is possible to do in this case .

If it is possible please provide advice in this issue.


Solution

  • Cloud Monitoring supports using Pub/Sub as a notification channel: https://cloud.google.com/monitoring/support/notification-options#pubsub

    You should be able to write a Cloud Function that acts as a Pub/Sub trigger to respond to these events: https://cloud.google.com/functions/docs/calling/pubsub