What you will learn in this TP
- Describe alerts and SLOs in Terraform
- Configure thresholds, window and loss of signal
- Route an issue to a destination with a workflow
- Test an alert end to end
All steps and instructions are shown. Recommended for this lab: autonomous
Introduction #
Context. The shop goes to production. The team requires alerts and the SLO to be reviewed and versioned like code: you describe them in Terraform, then prove the alert really arrives.
Prerequisites: a free New Relic account (license key), a machine with Docker, curl and jq, the Lab 1 application running, Terraform 1.6 or later · Estimated time: 60 min
An alert policy, an error rate condition, a workflow to your e-mail and an availability SLO, created and destroyed by Terraform, with a notification received.Setup #
Guided steps, with their solution.
1. Prepare Terraform
Why? The provider acts with a user key, not with the license key which only sends data.
Create a USER key, exportNEW_RELIC_API_KEY,NEW_RELIC_ACCOUNT_IDandNEW_RELIC_REGION, writemain.tfand runterraform plan. How many resources will be created?2. Understand the condition
Why? Each setting changes when on-call gets woken up: you must be able to justify it.
Explainthreshold_occurrences = "all",aggregation_delayand the threeexpiration_*settings. Why open an incident on expiration?3. Apply
Why? Applying from code guarantees production and the Git repository are identical.
Apply the configuration with your address, then find the policy, the workflow and the SLO in the UI.4. Trigger the alert
Why? An alert that was never tested is an alert nobody knows works.
For 8 minutes, send orders whose number is a multiple of 17 (all failing), follow the incident then the issue, and check the e-mail arrives.5. Read the SLO and destroy
Why? The error budget shows the incident's effect on the promised reliability; destroying avoids orphan alerts.
Open Service levels: what share of the weekly error budget did the incident consume? Then destroy every resource and stop the containers.
Validate your work
Check that each goal above is reached and that you get the result described in the introduction.
Difficulty level : ●●●●○ (4/5)
My progress
Sign in to track your progress and take notes. Sign in
💬 Questions about this lesson
No questions yet: be the first to ask for help or share your configuration.
Recommended Articles
Alerts, service levels and incidents in New Relic
Setting up useful alerting in New Relic: policies and NRQL conditions, static and anomaly thresho...
Automating New Relic and controlling costs
Managing New Relic as code and keeping the bill under control: NerdGraph API, newrelic CLI, newre...
New Relic best practices
Best practices to succeed with New Relic: adoption approach, account organization, naming and tag...
Service-Level Objectives (new platform) in Dynatrace
Defining and steering SLOs in the Dynatrace Service-Level Objectives app: templates and custom DQ...
Grafana SLO in Grafana Cloud
Grafana SLO in Grafana Cloud: SLI, objective and error budget, creating a ratio SLO, fast and slo...
Terraform: principles, architecture and workflow
Understand Terraform: declarative infrastructure as code, architecture (core, providers, state), ...
Datadog best practices: tags, costs, alerts and governance
Checklist for using Datadog effectively: unified tagging, cost control (hosts, logs, custom metri...
Monitors, SLOs, dashboards and Datadog as code
Create effective monitors (metrics, logs, APM, composites, anomalies), SLOs, dashboards, and mana...
NRQL: querying all your New Relic data
Mastering NRQL, New Relic's query language: SELECT … FROM structure, filters, aggregation functio...