Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Monitoring REST API to synchronize alarm/incident list

So I've written code to fetch AlertPolicies of alert setup with certain user label. OAUTH2 access token is working fine etc.

What I need to do is REST API sync the incident list for the project(s). Dash board shows it, so GCP knows the list. But how to fetch that list with REST API with service account?

I know that GCP probably answers Pub/Sub or webhook. But those are not what I am looking. What I am looking that us (partner sales company) can be actively synchronizing last 1h of active alarms detected by GCP monitoring. Actor would be my code, so that errors can be detected and alarmed to our staff. 

So is there some other API (monitoring v3 I am familiar) I need to use, or is there such API? This is easy on other public clouds, but for some reason not with GCP I cannot find documentation etc.

0 6 1,419
6 REPLIES 6

This is easy on other public clouds, but for some reason not with GCP I cannot find documentation etc.

Hi, can you share the documentation on how this is achieved in other cloud providers?
This could be helpful in my research on how to actively synchronize the last 1h of active alarms.

First before answering the Q, I was monitoring what happens on my Chrome via web developer and I see calls to "https://monitoring.clients6.google.com/v3/projects/xxxx-yyyy-zzzz/incidents" which I quickly tried to mimic. There is a bit different host from generic monitoring.googleapis.com and some key=cccc parameter which I was not eager enough to decipher, if that is user key via login or something.

Maybe this question is written better what I also try to accomplish:
https://stackoverflow.com/questions/68894463/api-for-fetching-incidents-on-specific-alert-policy

Azure: https://learn.microsoft.com/en-us/rest/api/monitor/alertsmanagement/alerts/get-all?tabs=HTTP
AWS: Cloudwatch describleAlarms & describeAlarmsHistory & MetricAlarm -keywords

What I need to do is REST API sync the incident list for the project(s). Dash board shows it, so GCP knows the list…

By incidents, do you mean as shown in the Status Dashboard?

By incidents, do you mean as shown in the Status Dashboard?

I re-checked this, not that one linked to URL. 
I am at cloud console, my own project, monitoring, alerting and there I see incident list from my alarms my Org has created. This is the alarm list I need to transfer to my company's ticketing system. And that end user interface dashboard is fetched with query to "incidents"-end point at GCP-end. That is the one I checked with web developer. But naturally I *want* to use official API.

jorge_tin_0-1666943747533.png

 

It is not possible at the moment.

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.

Also, post a comment there about why it would be helpful for you. Additionally, please notice the more stars  the issue tracker has, the more likely it is to be implemented.

Thank you @comaro for pointing the existing issue, I did what you asked because it is the same thing basically what I am seeking for a solution.

Top Solution Authors