Navigation

mongocli cloud-manager events list

The events list command retrieves information about events for a given MongoDB Cloud Manager project or organization. You must specify either a project or an organization in the command.

mongocli cloud-manager events list|ls
[ --output|-o <output-format> ]
[ --profile|-P <profile-name> ]
[ --projectId <project-ID> ]
[ --orgId <organization-ID> ]
[ --limit <items-per-page> ]
[ --maxDate <max-date> ]
[ --minDate <min-date> ]
[ --page <page-num> ]
Note

Use -h or --help to view the command-line help for this command.

Specify either a project with --projectId or an organization with --orgId.

Option
Type
Description
Required?
--limit
integer
Number of items per page, up to a maximum of 500. Defaults to 100 if not specified.
no
--maxDate
string
Return events whose created date is less than or equal to it.
no
--minDate
string
Return events whose created date is greater than or equal to it.
no
--orgId
string
Unique identifier of the organization for which to retrieve events.
yes
--output, -o
string

Command output format. Valid values are:

  • json for output in JSON format
  • go-template for custom output using the Go template
  • go-template-file for custom output specified using the Go template file

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 project ID and the Programmatic API 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.

yes
Note

The --orgId and --projectId flags are exclusive. You must use one or the other, but not both.

The command prints the following fields in the specified format to the terminal if the command succeeds. If the command prints an error, see Troubleshooting for recommended solutions.

events list returns an array of documents, each representing one event within your MongoDB Cloud Manager project or organization.

Note

A subset of the following fields may appear, depending on the event type.

Name
Type
Description
alertId
string
Unique identifier for the alert associated with the event.
alertConfigId
string
Unique identifier for the alert configuration associated with the alertId.
apiKeyId
string
Unique identifier for the API Key that triggered the event. If this field is present in the response, the command does not return the userId field.
collection
string
Name of the collection on which the event occurred. This field can be present when the eventTypeName is either DATA_EXPLORER or DATA_EXPLORER_CRUD.
created
date
ISO 8601-formatted UTC date when the event occurred.
currentValue
document
Describes the value of the metricName at the time of the event.
currentValue.number
int
The value of the metricName at the time of the event.
currentValue.units
string

The unit of measurement of the currentValue.number.

Possible values are:

  • RAW
  • BITS
  • BYTES
  • KILOBITS
  • KILOBYTES
  • MEGABITS
  • MEGABYTES
  • GIGABITS
  • GIGABYTES
  • TERABYTES
  • PETABYTES
  • MILLISECONDS
  • SECONDS
  • MINUTES
  • HOURS
  • DAYS
database
string
Name of the database on which the event occurred. This field can be present when the eventTypeName is either DATA_EXPLORER or DATA_EXPLORER_CRUD.
eventTypeName
string

The type of event.

Possible values are:

Alert type
Possible values
Host
OUTSIDE_METRIC_THRESHOLD
HOST_RESTARTED
HOST_UPGRADED
HOST_NOW_SECONDARY
HOST_NOW_PRIMARY
Replica set
NO_PRIMARY
TOO_MANY_ELECTIONS
Sharded cluster
CLUSTER_MONGOS_IS_MISSING
User
JOINED_GROUP
REMOVED_FROM_GROUP
USER_ROLES_CHANGED_AUDIT
Project
USERS_AWAITING_APPROVAL
USERS_WITHOUT_MULTI_FACTOR_AUTH
GROUP_CREATED
Team
JOINED_TEAM
REMOVED_FROM_TEAM
Organization
INVITED_TO_ORG
JOINED_ORG
Data Explorer
DATA_EXPLORER
DATA_EXPLORER_CRUD
Billing
CREDIT_CARD_ABOUT_TO_EXPIRE
CHARGE_SUCCEEDED
INVOICE_CLOSED
groupId
string
The unique identifier for the project in which the event occurred.
hostname
string
The hostname of the host machine associated with the event.
id
string
The unique identifier for the event.
invoiceId
string
The unique identifier of the invoice associated with the event.
isGlobalAdmin
boolean
Flag indicating whether the user who triggered this event has the Global Monitoring Administrator role.
links
array

One or more links to sub-resources and/or related resources.

metricName
string
The name of the metric associated with the alertId.
opType
string
Type of operation that occurred. This field is present when the eventTypeName is either DATA_EXPLORER or DATA_EXPLORER_CRUD.
orgId
string
The unique identifier for the organization in which the event occurred.
paymentId
string
The unique identifier of the invoice payment associated with the event.
port
int
The port on which the mongod or mongos listens.
publicKey
string
Public key associated with the API Key that triggered the event. If this field is present in the response, the command does not return the username field.
remoteAddress
string
IP address of the userId user who triggered the event.
replicaSetName
string
The name of the replica set associated with the event.
shardName
string
The name of the shard associated with the event.
targetPublicKey
string
The public key of the API Key targeted by the event.
targetUsername
string
The username for the user targeted by the event.
teamId
string
The unique identifier for the team associated with the event.
userId
string
The unique identifier for the user who triggered the event. If this field is present in the response, does not return the apiKeyId field.
username
string
The username for the user who triggered the event. If this field is present in the response, the command does not return the publicKey field.
whitelistEntry
string
The whitelist entry of the API Key targeted by the event.
totalCount
number
The number of events returned.

The following example uses the mongocli cloud-manager events list command to retrieve information about events on the project with project ID 5dd5a6b6f10fab1d71a58495. It uses the default profile to access Cloud Manager.

mongocli cloud-manager events list --output json --projectId 5dd5a6b6f10fab1d71a58495

The previous example produces the following output:

{
"links": [
{
"rel": "self",
"href": "https://cloud.mongodb.com/api/public/v1.0/groups/5dd5a6b6f10fab1d71a58495/events?pageNum=1\u0026itemsPerPage=100"
},
{
"rel": "next",
"href": "https://cloud.mongodb.com/api/public/v1.0/groups/5dd5a6b6f10fab1d71a58495/events?itemsPerPage=100\u0026pageNum=2"
}
],
"results": [
{
"alertId": "",
"alertConfigId": "",
"created": "2020-04-28T21:35:53Z",
"eventTypeName": "",
"groupId": "5dd5a6b6f10fab1d71a58495",
"hostname": "",
"id": "5ea8a1b99686076aaeddda0e",
"links": [
{
"rel": "self",
"href": "https://cloud.mongodb.com/api/public/v1.0/groups/5dd5a6b6f10fab1d71a58495/events/5ea8a1b99686076aaeddda0e"
}
]
},
{
"alertId": "",
"alertConfigId": "",
"collection": "listingsAndReviews",
"created": "2020-04-28T21:35:08Z",
"database": "sample_airbnb",
"eventTypeName": "DATA_EXPLORER",
"groupId": "5dd5a6b6f10fab1d71a58495",
"hostname": "",
"id": "5ea8a18c60e808539ca00023",
"links": [
{
"rel": "self",
"href": "https://cloud.mongodb.com/api/public/v1.0/groups/5dd5a6b6f10fab1d71a58495/events/5ea8a18c60e808539ca00023"
}
],
"opType": "find",
"remoteAddress": "71.202.1.242",
"userId": "5dd5a63b7a3e5a6c5bd0c8a3",
"username": "user@example.com"
},
...
],
"totalCount": 258
}
Give Feedback