Skip to content

Commit ef7c5ca

Browse files
authored
Merge pull request #199 from davidhou17/DOCSP-32865
(DOCSP-32865): Add details for config files for alert configurations
2 parents 901a00e + 8446e34 commit ef7c5ca

File tree

4 files changed

+156
-1
lines changed

4 files changed

+156
-1
lines changed
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"enabled": true,
3+
"eventTypeName": "NO_PRIMARY",
4+
"matchers": [
5+
{
6+
"fieldName": "REPLICA_SET_NAME",
7+
"operator": "EQUALS",
8+
"value": "event-replica-set"
9+
}
10+
],
11+
"notifications": [
12+
{
13+
"datadogApiKey": "****************************a23c",
14+
"datadogRegion": "US",
15+
"delayMin": 0,
16+
"intervalMin": 5,
17+
"notifierId": "6462742adc47d365036da07c",
18+
"typeName": "DATADOG"
19+
}
20+
],
21+
"threshold": {
22+
"operator": "<",
23+
"threshold": 0,
24+
"units": "bits"
25+
}
26+
}

source/reference/json.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ you can pass a configuration file when using the {+atlas-cli+} to:
2020
- :ref:`Create <atlas-clusters-search-indexes-create>` or
2121
:ref:`update an Atlas Search Index <atlas-clusters-search-indexes-update>`.
2222
- :ref:`Create a {+df+} database <atlas-dataFederation-create>`.
23+
- :ref:`Create <atlas-alerts-settings-create>` or
24+
:ref:`update an alert configuration <atlas-alerts-settings-update>`.
2325

2426
Usage
2527
-----
@@ -57,6 +59,12 @@ command. The commands you can use include but are not limited to:
5759
* - :ref:`atlas-dataFederation-create`
5860
- :oas-atlas-op:`Create One Federated Database Instance in One Project </createFederatedDatabase>`
5961

62+
* - :ref:`atlas-alerts-settings-create`
63+
- :oas-atlas-op:`Create One Alert Configuration in One Project </createAlertConfiguration>`
64+
65+
* - :ref:`atlas-alerts-settings-update`
66+
- :oas-atlas-op:`Update One Alert Configuration for One Project </updateAlertConfiguration>`
67+
6068
When you run the command in your terminal, specify the ``--file`` option
6169
and provide the path to the |json| configuration file that defines your
6270
desired settings.
@@ -120,10 +128,18 @@ To learn more about {+adf+} configuration files, see
120128
:ref:`atlas-cli-data-federation-config-file`. For a sample file,
121129
see :ref:`example-fdi-config-file`.
122130

131+
Alert Configuration File
132+
------------------------
133+
134+
To learn more about alert configuration files, see
135+
:ref:`atlas-cli-alert-config-file`. For a sample file,
136+
see :ref:`example-alert-config-file`.
137+
123138
.. toctree::
124139
:titlesonly:
125140

126141
/reference/json/cluster-config-file
127142
/reference/json/cloud-backup-schedule-config-file
128143
/reference/json/data-federation-config-file
129144
/reference/json/search-index-config-file
145+
/reference/json/alert-config-file
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
.. _atlas-cli-alert-config-file:
2+
3+
========================
4+
Alert Configuration File
5+
========================
6+
7+
.. contents:: On this page
8+
:local:
9+
:backlinks: none
10+
:depth: 1
11+
:class: singlecol
12+
13+
You can use a configuration file to specify the
14+
settings for :ref:`creating <atlas-alerts-settings-create>`
15+
or :ref:`updating <atlas-alerts-settings-update>` an alert
16+
configuration through the {+atlas-cli+}. The {+atlas-cli+}
17+
accepts ``.json`` configuration files.
18+
19+
.. _alert-config-settings:
20+
21+
Alert Configuration Settings
22+
----------------------------
23+
24+
Depending on the type of alert configuration, you can specify the
25+
following settings to create or update an alert configuration
26+
in a configuration file:
27+
28+
.. list-table::
29+
:widths: 20 10 70
30+
:header-rows: 1
31+
32+
* - Field
33+
- Type
34+
- Description
35+
36+
* - ``enabled``
37+
- boolean
38+
- Flag that indicates whether someone enabled this
39+
alert configuration for the specified project.
40+
41+
* - ``eventTypeName``
42+
- string
43+
- Required. Event type that triggers an alert.
44+
45+
* - ``matchers``
46+
- array of objects
47+
- Rules to apply when matching an object against this alert
48+
configuration. You can use this field only if the ``eventTypeName``
49+
specifies an event for a host, replica set, or sharded cluster.
50+
51+
* - ``metricThreshold``
52+
- object
53+
- Threshold for the metric that, when exceeded, triggers an alert.
54+
You can use this field only if the ``eventTypeName`` reflects
55+
a change in measurement or metric.
56+
57+
* - ``notifications``
58+
- array of objects
59+
- List that contains the targets that |service| sends notifications.
60+
61+
* - ``threshold``
62+
- object
63+
- A limit that triggers an alert when exceeded.
64+
65+
For detailed descriptions and a full list of available settings,
66+
see the request body schema in the API specification:
67+
68+
- :oas-atlas-op:`Create One Alert Configuration in One Project </createAlertConfiguration>`
69+
- :oas-atlas-op:`Update One Alert Configuration for One Project </updateAlertConfiguration>`
70+
71+
.. _example-alert-config-file:
72+
73+
Example Alert Configuration File
74+
--------------------------------
75+
76+
To create or update an alert configuration, specify the
77+
fields that you want to include in the configuration file.
78+
For example, the following sample file enables an alert
79+
configuration that notifies you when a replica set called
80+
``event-replica-set`` loses its primary node:
81+
82+
.. literalinclude:: /includes/alert-configuration-config-file.json
83+
84+
Example Alert Configuration Commands
85+
------------------------------------
86+
87+
After you create the file, run the {+atlas-cli+}
88+
command to create or update the alert configuration.
89+
90+
Create an Alert Configuration
91+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
92+
93+
To create an alert configuration, specify the ``--flag`` option
94+
and the path to the file. The following example creates an
95+
alert configuration by using a configuration file named
96+
``alert-config.json``:
97+
98+
.. code-block::
99+
100+
atlas alerts settings create --file /alert-config.json
101+
102+
Update an Alert Configuration
103+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
104+
105+
To update an alert configuration, specify the ID of the
106+
alert configuration that you want to update, the ``--flag``
107+
option, and the path to the file. The following example updates
108+
an existing alert configuration by using a configuration file
109+
named ``alert-config.json``:
110+
111+
.. code-block::
112+
113+
atlas alerts settings update <alertConfigId> --file /alert-config.json

source/reference/json/search-index-config-file.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ search-config.json:
8181

8282
.. code-block::
8383

84-
atlas clusters search indexes create --clusterName myCluster --file search-config.json --output json
84+
atlas clusters search indexes create --clusterName myCluster --file /search-config.json --output json
8585

8686

8787

0 commit comments

Comments
 (0)