Alerts

Rules that notify you when a metric crosses a line or something fails.

Overview

An alert watches a metric or a resource and tells your channels when something is wrong, and again when it is back to normal.

When to use it

  • The disk is getting full.
  • A backup failed tonight.
  • An app keeps restarting.
  • A machine went offline.

How it works

Evaluator
Runs every 30 seconds after the sampler.
Conditions
A metric above or below a line for a while; a crash loop; a failure; a failed run; a machine offline.

A firing alert opens an incident and notifies its channels; it can remind you while it lasts. When the condition clears, the incident closes with a back-to-normal message.

Architecture

Alerts architectureAlerts are evaluated against the samples and notify channels.firingnotifySamplesEvaluatorevery 30 sIncidentChannelsemail, chat, webhook
Alerts are evaluated against the samples and notify channels.
  • Samples to Evaluator
  • Evaluator to Incident: firing
  • Evaluator to Channels: notify

Flows

CPU too high

  1. CPU of app/api stays above 0.9 cores for 5 minutes.
  2. The alert fires; ops gets a message.
  3. When it drops, ops hears it’s back to normal.

Set it up

In the console

  1. Create a channel first.
  2. Open Alerts and choose New alert.
  3. Build the rule as a sentence and choose channels; Test it.

With the CLI

enclave alert create api-cpu --metric cpu --resource app/api --above 0.9 --channel ops --wait

With OpenTofu

OpenTofu configuration
resource "enclave_alert" "api_cpu" {
  name     = "api-cpu"
  channels = ["ops"]
  condition = {
    type      = "metric"
    metric    = "cpu"
    resources = ["app/api"]
    operator  = "above"
    threshold = 0.9
  }
}

Settings reference

Every setting and output of the OpenTofu resource; the console and the CLI use the same names in their own words. Generated from platform 4d30582.

enclave_alert
NameTypeUseWhat it does
channelslist of textrequiredChannels to notify.
conditionlist of objectsrequiredWhat the alert watches.
nametextrequiredName of the alert: 3–40 lowercase letters, digits or hyphens, starting with a letter. Changing it replaces the alert.
enabledtrue or falseoptionalfalse turns the alert off (default on).
projecttextoptionalThe project to create it in. Defaults to the provider's project (ENCLAVE_PROJECT, else default). Changing it replaces the resource.
repeat_minutesnumberoptionalRemind this often while firing; 0 (default) never.
idtextoutputResource ID.
statetextoutputok, firing, no_data or disabled (as last evaluated).

Limits and security

Good to know

  • An alert fires once; set a reminder interval to be told again.

Security

  • Webhook notifications are signed when the channel has a secret.