Hi,
I’d like some help on an NRQL query based alert.
I have the following query. The logic is:
- get the latest detail_state (SUCCEEDED or FAILED)
- raise alert if the latest event is failed
- alert should close when the latest event is <> failed
SELECT latest(detail_state
) from codepipelineevents FACET detail_pipeline WHERE detail-type
= ‘CodePipeline Pipeline Execution State Change’ and detail_pipeline =‘test-pipeline’ and detail_state
=‘FAILED’
I would expect the count to be 0 if the latest event is <> failed. If the latest event is failed count should be 1 and an incident raised. When the next status update comes through the query would then return 0 rows and the incident is closed.
Any ideas how I can achieve this?
Thanks