google-cloud-platformmonitoringgcloudstackdriver

Is there a way to fetch Google Cloud Monitoring Incident metrics via the API?


When reviewing the documentation here (https://cloud.google.com/monitoring/alerts/incidents-events#incident) and using the general product, it appears that the open incidents and associated details are only displayed via the Google Cloud Console.

The CLI and API appear to only support management of alerting policies, but I cannot find a way to retrieve a list of open incidents. For example, I'd like to send an alert if more than 5 incidents are open for 12 hours on a specific alerting policy. It would seem that the data exists (as provided from the Google Cloud Console), but the API is not public.


Solution

  • I think it is not possible.

    Incidents appear to not be part of Google's public API for Cloud Monitoring.

    There are a couple of ways to verify this:

    1. APIs Explorer documents Cloud Monitoring API and there are no Incident resource types nor methods.
    2. Using e.g. Chrome Developer Console while browsing Cloud Console: Incidents doesn't (appear to) include any public API endpoints/methods

    There's an existing feature request (FR) on Google's public issue tracker for this.

    I encourage you to "Star this issue" by clicking the star icon to the left of the issue title Manage Incidents via API to both "+1" the FR and to subscribe to updates on it.