Alert Configuration File
On this page
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.
Alert Configuration Settings
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 |
---|---|---|
| boolean | Flag that indicates whether someone enabled this alert configuration for the specified project. |
| string | Required. Event type that triggers an alert. |
| array of objects | Rules to apply when matching an object against this alert
configuration. You can use this field only if the |
| object | Threshold for the metric that, when exceeded, triggers an alert.
You can use this field only if the |
| array of objects | List that contains the targets that Atlas sends notifications. |
| 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:
Example Alert Configuration File
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" } }
Example Alert Configuration Commands
After you create the file, run the Atlas CLI command to create or update the alert configuration.
Create an 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
Update an Alert Configuration
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