Tomas Tesfazghi
Tomas Tesfazghi

Reputation: 31

API for fetching incidents on specific alert policy

I'm trying to find the API to get the incident for a specific alert policy that I created on GCP. I'm able to get emails when the threshold is reached, but I couldn't find a way to fetch that incident using [postman][1]. I found the API to get the policy that I created on GCP, but not for incident generated. Any help is appreciated.

Edited: The Json response that i get for the alert Policy API (https://monitoring.googleapis.com/v3/projects/{projectId}/alertPolicies/{alertId}) looks like this

{ "name": "projects/{projectId}/alertPolicies/{alertId}", "displayName": "Max Memory Utilization on a Node", "combiner": "OR", "creationRecord": { "mutateTime": "2021-03-02T18:05:21.054509916Z", "mutatedBy": "myemail" }, "mutationRecord": { "mutateTime": "2021-08-09T16:24:50.941114533Z", "mutatedBy": "myemail" }, "conditions": [ { "conditionThreshold": { "filter": "resource.type = "gce_instance" AND metric.type = "compute.googleapis.com/guest/memory/bytes_used"", "comparison": "COMPARISON_GT", "thresholdValue": 5, "duration": "0s", "trigger": { "count": 1 }, "aggregations": [ { "alignmentPeriod": "60s", "perSeriesAligner": "ALIGN_MEAN", "crossSeriesReducer": "REDUCE_MAX", "groupByFields": [ "metric.label.instance_name" ] } ] }, "displayName": "Memorystore Memcached Node - Memory usage [MAX]", "name": "projects/{projectId}/alertPolicies/{alertId}/conditions/14902542656838734365" } ], "notificationChannels": [ "projects/{projectId}/notificationChannels/17463875491346552338" ], "enabled": true, "alertStrategy": {} }

but this is just policy

Upvotes: 3

Views: 797

Answers (1)

MariCruzR
MariCruzR

Reputation: 157

I understand that you're trying to record the triggering of an alerting policy by using Postman. You can actually achieve this by using the monitoring system offered by GCP.

The linked documentation gives you a guidance on how you can view and manage incidents for metric-based alerting policies. It also gives you an approach on how to both filter the incidents and find older ones. Please, comment bellow if this has helped you.

Upvotes: 0

Related Questions