Use our New Relic query language (NRQL) to create alerts conditions with ease.
Your condition describes what you want to be notified about, and only requires two attributes: a query and a threshold. The query defines the data that's important to you, and determines what you want to be notified about. The threshold determines when you’ll be notified.
Follow these steps to write your first alerts condition using a NRQL query and a threshold. Once you're done, you'll have a working alert condition.
Ready to get started? Make sure you have a New Relic account. It's free, forever!
You can use a NRQL query to return data about how your environment is performing. Then, you can create a condition from that query.
In this example, a condition is created for each host's CPU utilization (query), which will trigger a notification when the CPU utilization is above the 0.7% (threshold). Generally, you won't use thresholds below 1%, but this example simply shows you how to set up a threshold.
Find the NRQL query builder at the top of the UI.
Click the Query your data button to open the query builder and start writing a NRQL query. Once you've written a valid query, you can create a condition from it.
The condition shows each host’s CPU utilization. Use this NRQL query, or something similar that's relevant to what you're monitoring, to create a condition.
This query finds the average CPU utilization in an environment and then breaks it down (facets) by individual host names.
Once you've created a valid NRQL query, click Create alert.
Learn more about the NRQL syntax to create other useful queries.
Give your NRQL condition a name that's meaningful to you.
Set critical and warning thresholds to determine when you’re notified about your environment's performance.
A critical threshold is required for your alerts condition.
A warning threshold is optional. These thresholds don't create an incident or notify you like the critical threshold does. If a critical threshold opens an incident and notifies you, warning threshold violations created afterwards will be included in the report.
In this example from the Set your condition thresholds section, our critical threshold (red) checks for any hosts with CPU utilization over 0.7% for at least 5 minutes. A warning threshold (yellow) is also added showing when any host's CPU utilization goes over 0.67% for at least 5 minutes.
After you enter threshold values, you can see the threshold lines on the graph:
Finally, add your condition to an existing policy or create a new one.
When you create a new policy, you can group your violations by policy, condition, or by violation (this creates an incident for each violation). These incident preferences settings determine how frequently you're notified when there's a violation.
For a detailed, comprehensive overview of NRQL conditions, see Create NRQL alert conditions