Alert using NRQL

I am trying to set alert on the endpoint with its htttp status code,means if it is not equal to 200 then it should be notify me. how can i achive that.

SELECT count(*) from Transaction where http.statusCode != ‘200’

you can also specify a couple of more fields here to narrow it down like labels.environment, appName, etc. so it will look something like this

SELECT count() from Transaction where http.statusCode != ‘200’ and labels.environment = '’ and appName = '*’

you can also use like instead of ‘=’ to extend the range of the query.

2 Likes

@RishavSharma thank you for the response.
I have tried this query but theres confusion that what should I enter the value of condition threshold .

well considering that what you are looking for is an alert for whatever is not a success (200), I assume you are looking for failures.
therefore you have to look at different instances and figure out yourself what is tolerable and what is not, also its extent.
you can also use metric queries as well and a transaction error event table but, I believe that you have recently started up using new relic, therefore, understand the full extent of the transaction event table first.

3 Likes

Sorry for the belated response here, but I did want to pop in and say thank you for the excellent advice @RishavSharma! Let us know if you need more guidance @divyesh.patel .

1 Like

I’m stil try to figure it out, can you give me any other way to achive this

Hi there @divyesh.patel -

Looks like we got you sorted in this other post today: New Relic alert using NRQL

1 Like