Niklas B
Niklas B

Reputation: 1969

Manually triggering alert in Google Cloud Monitoring

I want to be able to programmatically trigger alerts in Google Cloud Monitoring. Basically I have a watchdog that I want to execute certain actions based on multiple criteria. One of those actions is that I want it to trigger a new alert in Google Cloud Monitoring.

Is there a smooth way to do this?

So far my best guess is:

  1. Setup an alert policy on a custom metric (like isTriggeringAlert>0)
  2. Write the actions to a log ("[ALERT]: ....") and use Cloud Monitoring to catch that log

Both works, but was wondering if there is a programatic way to trigger instead? I haven't found anything in the Python SDK for Cloud Monitoring (just how to create monitoring policies)

Regards, Niklas

Upvotes: 2

Views: 2322

Answers (2)

Dennis P
Dennis P

Reputation: 11

As a workaround. You can snooze an active incident for 1 minute.

Upvotes: 1

Sergiusz
Sergiusz

Reputation: 1235

This feature has been requested, but isn't available yet.
As a workaround, you can try writing appropriate data into timeSeries using this API.

Upvotes: 3

Related Questions