Docs Menu
Docs Home
/ /
Atlas CLI
/ /

Alert Configuration File

On this page

  • Alert Configuration Settings
  • Example Alert Configuration File
  • Example Alert Configuration Commands

You can use a configuration file to specify the settings for creating or updating an alert configuration through the Atlas CLI. The Atlas CLI accepts .json configuration files.

Depending on the type of alert configuration, you can specify the following settings to create or update an alert configuration in a configuration file:

Field
Type
Description

enabled

boolean

Flag that indicates whether someone enabled this alert configuration for the specified project.

eventTypeName

string

Required. Event type that triggers an alert.

matchers

array of objects

Rules to apply when matching an object against this alert configuration. You can use this field only if the eventTypeName specifies an event for a host, replica set, or sharded cluster.

metricThreshold

object

Threshold for the metric that, when exceeded, triggers an alert. You can use this field only if the eventTypeName reflects a change in measurement or metric.

notifications

array of objects

List that contains the targets that Atlas sends notifications.

threshold

object

A limit that triggers an alert when exceeded.

For detailed descriptions and a full list of available settings, see the request body schema in the API specification:

  • Create One Alert Configuration in One Project

  • Update One Alert Configuration for One Project

To create or update an alert configuration, specify the fields that you want to include in the configuration file. For example, the following sample file enables an alert configuration that notifies you when a replica set called event-replica-set loses its primary node:

{
"enabled": true,
"eventTypeName": "NO_PRIMARY",
"matchers": [
{
"fieldName": "REPLICA_SET_NAME",
"operator": "EQUALS",
"value": "event-replica-set"
}
],
"notifications": [
{
"datadogApiKey": "****************************a23c",
"datadogRegion": "US",
"delayMin": 0,
"intervalMin": 5,
"notifierId": "6462742adc47d365036da07c",
"typeName": "DATADOG"
}
],
"threshold": {
"operator": "<",
"threshold": 0,
"units": "bits"
}
}

After you create the file, run the Atlas CLI command to create or update the alert configuration.

To create an alert configuration, specify the --flag option and the path to the file. The following example creates an alert configuration by using a configuration file named alert-config.json:

atlas alerts settings create --file /alert-config.json

To update an alert configuration, specify the ID of the alert configuration that you want to update, the --flag option, and the path to the file. The following example updates an existing alert configuration by using a configuration file named alert-config.json:

atlas alerts settings update <alertConfigId> --file /alert-config.json

Back

Online Archive