Your data. Anywhere you go.

New Relic for iOS or Android

Download on the App Store    Android App on Google play

New Relic Insights App for iOS

Download on the App Store

Learn more

Close icon

NRQL Query to detect multiple locations failing for a Synthetics check



I have a situation where I have a synthetics ping check that is monitored from multiple locations; one private minion and three public locations. I have two alert policies, a “warning” policy and a “critical” policy.

The business would like me to create separate alert conditions for each policy.

The warning condition should trigger if only there is a failure on the private minion.
The critical condition should trigger if there is a failure on private minion and at least one public location.

I was wondering if there is some kind of NRQL query I could write that would satisfy these conditions?




Hey @mfletcher - that’s a good use case for NRQL alerts.

For your warning threshold, to Alert when there is a failure from your private location a query like below should help:

SELECT count(*) FROM SyntheticCheck WHERE result = 'FAILED' and locationLabel = 'myPrivateLocation'

Your critical threshold is a little more difficult.

Every Synthetics event is a single monitor run, which is from only one location. Therefore a query that features something like:
WHERE locationLabel = 'myPrivateLocation' AND locationLabel in ('publicLocation1', 'publicLocation2', 'publicLocation3')
will not work. Each event cannot come from multiple locations, so the AND clause in that query will result in it never working.

Alternatively you can use OR in a query like below:

SELECT count(*) FROM SyntheticCheck WHERE result = 'FAILED' and (locationLabel = 'myPrivateLocation' OR locationLabel in ('publicLocation1', 'publicLocation2', 'publicLocation3'))

You can then run that query on an alert set up as

SUM OF query results > 1 in X Minutes.

Note - This query will alert if any 2 locations fail in your selected time period. This could be 2 public locations, not including your private location too.
Where your requirement is 1 Private Location + 1 or more Public Locations.

Let us know if that helps.


Hi @RyanVeitch, thats awesome! I’ll give it a try.




Sweet! Let us know if those queries work out for you. @mfletcher