Create an alert for sqs based on 2 metrices together

Need to create an alert based on the 2 matrices approximateNumberOfMessagesVisible and numberOfMessagesDeleted for sqs. The alert condition is approximateNumberOfMessagesVisible > n and numberOfMessagesDeleted = 0 over a period of time. Is this possible?

Hey @a.abdulla

You’ll need to use NRQL alerting for that. Perhaps a query like this could help:

FROM QueueSample SELECT count(*) WHERE provider.approximateNumberOfMessagesVisible.SampleCount > 5 AND provider.numberOfMessagesDeleted.SampleCount > 0 SINCE 1 WEEK AGO 

last 10 minutes if the average number of messages visible in queue greater than 5 and average number of messages deleted 0 then i need an alert. what will be the nrql for that?

Hey @a.abdulla

You’ll need to set the 10 minutes up in the alert configuration, since NRQL alerts can’t have a time clause in the query.

Something like this should help:

FROM QueueSample SELECT count(*) WHERE provider.approximateNumberOfMessagesVisible.Average > 5 AND provider.numberOfMessagesDeleted.Average = 0 

provider.numberOfMessagesDeleted.Average and provider.approximateNumberOfMessagesVisible.Average are all time average right? I just want to take the last 10 min average of NumberOfMessagesVisible & numberOfMessagesDeleted. How it possible or is the above solution works for this also?

When you specify a time range in the alert condition, as you can see in my screenshot (“for at least 10 minutes”, you can change that to at least once in 10 minutes…)

The alert condition is only looking at a rolling 10 minute window. When there is a spike lasting for ten minutes, it will notify you.

Change this to At least once in to specify that you want any spike to notify you.

1 Like