问题
I was looking on stackdriver dashboard and I found the following http request:
https://app.google.stackdriver.com/api/alerting/violation?project={project-id}&page=0&pageSize=8&policyId={policy-id}
But I didn't found any docs about this D:
回答1:
The alerting methods for Stackdriver Monitoring appear in the the Google Cloud Platform documentation.
There does not seem to be an endpoint to list triggered alerts at the moment.
The best option for now would be to add a webhook as a notification channel and store the data in whatever way is easier for you to recover later.
回答2:
Confirmed, there is currently no public API for retrieving incidents. Jofre's suggestion is a good one for now. I'd note that we're working on a new incident response tool (https://cloud.google.com/blog/products/management-tools/building-a-more-reliable-infrastructure-with-new-stackdriver-tools-and-partners) which may satisfy some of your use cases once it's fully released.
Aaron Sher, Stackdriver engineer
来源:https://stackoverflow.com/questions/51623019/can-i-get-incidents-of-stackdriver-policy-using-api