Create alerts

Lab

This procedure is a part of a lab that teaches you how to build a quickstart. If you haven't already, checkout the lab introduction

Each procedure in this lab builds on top of the last one, so make sure you Create a dashboard before proceeding with this one.

With New Relic alerts, you can monitor your services and receive notifications about problems that you're interested in, so you can react fast to troubleshoot and resolve them.

Tip

It is assumed that you are already familiar with the alerts basics. If you're just getting started, visit the alert documentation to familiarize yourself with the basics before proceeding.

Create an alert policy

Before you set alert conditions, you must create a policy.

From Alert & AI, go to the Alerts section and click Policies from left-hand navigation. Then, click New alert policy.

new alert policy

Name your policy FlashDB alert policy. Use the default values for the rest of the fields and click Create alert policy.

create an alert policy

The next step is to add conditions to the alert policy.

Create alert conditions

You're going to add the following alert conditions:

  • slow read responses
  • low cache hit ratio

Create a high response time alert condition

Under FlashDB alert policy, click Create a condition.

create alert condition

The next page asks you to choose a category for your condition. Choose NRQL, which allows you to create a condition using a NRQL query. Then, click Next, define thresholds.

alert condition using nrql

You want New Relic to notify you if the read operation is taking longer than expected. Name your alert condition "slow read responses" and enter the following NRQL query for your condition.

SELECT average(fdb_read_responses) FROM Metric

slow read response nrql

Here, you selected the average read response for FlashDB.

Scroll down on the same page to define threshold. Select Static as the threshold type. It is the simplest threshold type and creates a condition based on the numeric value returned by the query. Set the critical threshold value at 0.9:

slow read response critical threshold

Here, you defined a condition that will open violation whenever read response time is above 0.9 for at least 5 minutes.

Next, click Add warning threshold.

add warning threshold

Enter the threshold value at 0.8 to get a warning when the read response is above 0.8 for at least 5 minutes. Then, click Save condition.

slow read response warning threshold

Now, You can see your new condition under your FlashDB alert policy.

flashdb slow response alert

Create a cache hit ratio condition

You claimed that your database is fastest in the space, so you also want New Relic to notify you if your cache hit ratio is too low. Add another condition under the same policy by clicking Add a condition.

add more alert conditions

The next page asks you to choose the category for your condition. Choose NRQL and click Next, define threshold.

add alert condition using nrql

Enter the name "Low cache hit ratio" for your condition and use the following NRQL query.

SELECT sum(fdb_cache_hits)/sum(fdb_read_responses) FROM Metric

low cache hit ratio nrql

Next, add threshold values for critical violation and warning. The procedure is same as before. The only difference is that you want New Relic to notify you if the query returns a value below 0.85 and open a critical violation if the value falls below 0.75 for at least 5 minutes.

low cache hit ratio threshold

Save the condition to add it to your alert policy which now looks like the following.

alert policy conditions

Add a notification channel

To receive notifications for any opened violations, you also need to add a notification channel.

First, move to the Notification channels tab and click Add notification channels.

add notification channel

From the list of channel options, click Email.

email notification channel

Select the email you want to receive your notifications on, and click Update policy.

update policy

Notification channel is now added.

Summary

During this procedure, you created FlashDB alert policy and added slow read responses and low cache hit ratio conditions to it. You also added a notification channel to receive notifications about any opened violations.

Lab

This procedure is a part of lab that teaches you how to build a quickstart. Continue on to next lesson: Create a quickstart