mongocli ops-manager alerts list
The alerts list
command retrieves all alerts for the
specified Ops Manager project.
Syntax
mongocli ops-manager|om alert|alerts list|ls [ --limit <number-of-items-per-page> ] [ --output|-o <output-format> ] [ --page <page-number> ] [ --profile|-P <profile-name> ] [ --projectId <id-of-project> ] [ --status <alert-status> ]
Options
Option | Type | Description | Required? | ||||||
---|---|---|---|---|---|---|---|---|---|
--limit | integer | Number of items per page, up to a maximum of 500. Defaults to
100 if not specified. | no | ||||||
--output , -o | string | Command output format. Valid values are:
If omitted, the command returns output in the default format. | no | ||||||
--page | integer | Page number (1-based). Defaults to 1 if not specified. | no | ||||||
--profile , -P | string | Name of the profile where the public and private
keys for the project are saved. If omitted, uses the
default profile. To learn more about creating a
profile, see Configure the MongoDB CLI. | no | ||||||
--projectId | string | Unique identifier of the project. If omitted, uses the project ID in the profile or environment variable. | no | ||||||
--status | string | Status of the alerts you want to return. The MongoDB CLI returns alerts that match the status you indicate. Accepted values include:
| no |
Output
For each alert, the command prints the following fields in the specified format to the terminal if the command succeeds. If the command returns errors, see Troubleshooting for recommended solutions.
Name | Type | Description | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
acknowledgedUntil | date | Timestamp in ISO 8601 date and time format in UTC through which the alert has been acknowledged.
mongocli returns this value after the alert has been
acknowledged. | ||||||||
acknowledgementComment | string | Comment left by the user who acknowledged the alert.
mongocli returns this value after the alert has been
acknowledged. | ||||||||
acknowledgingUsername | string | Username of the user who acknowledged the alert. mongocli
returns this value after the alert has been acknowledged. | ||||||||
alertConfigId | string | Unique identifier of the alert configuration that triggered this
alert. | ||||||||
clusterName | string | Name the cluster to which this alert applies. | ||||||||
created | date | Timestamp in ISO 8601 date and time format in UTC when this alert was created. | ||||||||
currentValue | object | Current value of the metric that triggered the alert.
mongocli returns this value if "eventTypeName" :
"OUTSIDE_METRIC_THRESHOLD" . | ||||||||
currentValue.number | float | Value. | ||||||||
currentValue.units | string | Units for the value. Possible units are:
| ||||||||
eventTypeName | string | Name of the event that triggered the alert. The possible values
depend on the alert type. | ||||||||
groupId | string | Unique identifier of the project for which this alert was
opened. | ||||||||
hostnameAndPort | string | Hostname and port of the host to which the alert applies. | ||||||||
id | string | Unique identifier for the alert. | ||||||||
lastNotified | date | Timestamp in ISO 8601 date and time format in UTC when the last notification was sent for this
alert. Only present if notifications have been sent. | ||||||||
metricName | string | Name of the metric whose value went outside the threshold.
| ||||||||
replicaSetName | string | Name of the replica set, if applicable. | ||||||||
resolved | date | Timestamp in ISO 8601 date and time format in UTC when the alert was closed. mongocli returns
this value if "status" : "CLOSED" . | ||||||||
status | string | Current state of the alert. Possible values are:
| ||||||||
updated | date | Timestamp in ISO 8601 date and time format in UTC when this alert was last updated. |
Example
The following example uses the mongocli om alerts list
command
to retrieve all alerts that occurred for the specified project. It uses
the profile named myprofile
for accessing Ops Manager.
mongocli om alerts list --projectId 5df90590f10fab5e33de2305 \ --output json --profile myprofile
The previous command prints the following fields in the specified format to the terminal. To learn more about these fields, see Output.
{ "links": [ { "rel": "self", "href": "http://omserver:8080/api/public/v1.0/groups/5eac961b0838261259e0302d/alerts?pageNum=1\u0026itemsPerPage=100" } ], "results": [ { "id": "5eac99120838261259e035b7", "groupId": "5eac961b0838261259e0302d", "alertConfigId": "5eac99050838261259e0358e", "eventTypeName": "USERS_WITHOUT_MULTI_FACTOR_AUTH", "created": "2020-05-01T21:48:02Z", "updated": "2020-05-01T21:55:02Z", "resolved": "2020-05-01T21:55:02Z", "status": "CLOSED", "lastNotified": "2020-05-01T21:55:09Z" }, { "id": "5e90da66adbe3e61bd51084b", "groupId": "5eac961b0838261259e0302d", "alertConfigId": "5df90590f10fab5e33de2306", "eventTypeName": "REPLICATION_OPLOG_WINDOW_RUNNING_OUT", "created": "2020-04-10T20:43:18Z", "updated": "2020-04-10T20:44:10Z", "resolved": "2020-04-10T20:44:10Z", "status": "CLOSED", "lastNotified": "2020-04-10T20:44:18Z", "replicaSetName": "rs0" } ], "totalCount": 2 }