Skip to main content
The triggers commands manage anomaly detection triggers: alerts that fire when a metric crosses a threshold you define. Each command targets one application, by name and environment (--app "MyApp" --environment production) or by ID (--app-id <APP_ID>, the long hexadecimal app ID from appsignal-cli apps list). The --environment flag is only needed when several apps share a name, and each command uses your default organization unless you pass --org. See Apps and organizations.
These are anomaly detection triggers on metrics. For triggers built from log lines, see Logs.

List triggers

Shell
appsignal-cli triggers list --app "MyApp" --environment production

Create a trigger

A trigger watches one metric field and opens an alert when it crosses a threshold:
Shell
appsignal-cli triggers create --app "MyApp" --environment production \
  --name "Slow web requests" \
  --metric-name response_time --kind Advanced --field mean \
  --comparison-operator ">" --condition-value 500 \
  --warmup-duration 5 --cooldown-duration 2 \
  --description "Alert when mean response time stays above 500ms"
These flags are required:
FlagDescription
--metric-name <name>The metric to monitor
--kind <kind>Trigger kind, e.g. Advanced, Performance, or HostCPUUsage
--field <field>Field to compare: count, counter, gauge, mean, p90, or p95
--comparison-operator <op>One of >, >=, <, <=, ==, or !=
--condition-value <number>Threshold to compare against
--warmup-duration <minutes>How long the condition must hold before opening an alert
--cooldown-duration <minutes>How long it must recover before closing an alert
These flags are optional:
FlagDescription
--name <text>Display name (defaults to the metric name)
--description <text>Description shown with the trigger
--notifier-ids <list>Comma-separated notifier IDs to attach
--tag <key=value>Tag filter (repeat the flag, or comma-separate)
--dashboard-id <id>Dashboard to link from notifications
--no-match-is-zeroTreat missing datapoints as 0
--format <format>Value format, e.g. duration, number, or percent
--format-input <unit>Input unit for size formats, e.g. byte or kilobyte

Update a trigger

Update a trigger by its --id (from triggers list). An update creates a new version linked to the existing trigger:
Shell
appsignal-cli triggers update --id <TRIGGER_ID> --app "MyApp" --environment production \
  --condition-value 750
update accepts the same flags as create.

Archive a trigger

Archiving a trigger also closes its associated alerts and incidents:
Shell
appsignal-cli triggers archive --id <TRIGGER_ID> --app "MyApp" --environment production

Next steps

A trigger opens an incident when it fires. Inspect those with the incidents commands.