Navigation

mongocli atlas metrics databases describe

The metrics databases describe command gets the measurements of the specified database for an Atlas process.

You can get the hostnames associated with a particular Atlas project with the process list command.

mongocli atlas metrics databases describe <hostname>:<port> <db-name>
--granularity <time-interval>
--period <time-period>
--start <start-time>
--end <end-time>
[ --type <type-of-measurement> ]
[ --limit <number-of-items-per-page> ]
[ --output|-o <output-format> ]
[ --page <page-number> ]
[ --profile|-P <profile-name> ]
[ --projectId <id-of-project> ]
Note

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

Option
Type
Description
Required?
<hostname>:<port>
String
The hostname of the server running the Atlas MongoDB process and the port to which the process listens.
yes
<db-name>
String
Name of the database to describe.
yes
--granularity
String

An ISO 8601-formatted time period that specifies the interval between measurement data points. For example, PT1M specifies 1-minute granularity.

The following subset of ISO 8601-formatted time periods are supported:

  • PT1M
  • PT5M
  • PT1H
  • P1D

When you specify granularity, you must specify either period or start and end.

yes
--period
String
An ISO 8601-formatted time period that specifies the length of time in the past to query. For example, to request the last 36 hours, specify: --period P1DT12H. Mutually exclusive with start and end.
yes
--start
String
The time at which to start retrieving metrics, as specified by an ISO 8601 timestamp string. If you specify start you must also specify end. Mutually exclusive with period.
yes
--end
String
The time at which to stop retrieving metrics, as specified by an ISO 8601 timestamp string. If you specify end you must also specify start. Mutually exclusive with period.
yes
--type
String

Specifies which measurement to return. If type is not specified, all metrics are returned.

You must specify metrics that are valid for the host. Atlas returns an error if any specified metrics are invalid.

The following measurement values are valid:

  • DATABASE_AVERAGE_OBJECT_SIZE
  • DATABASE_COLLECTION_COUNT
  • DATABASE_DATA_SIZE
  • DATABASE_STORAGE_SIZE
  • DATABASE_INDEX_SIZE
  • DATABASE_INDEX_COUNT
  • DATABASE_EXTENT_COUNT
  • DATABASE_OBJECT_COUNT
  • DATABASE_VIEW_COUNT
no
--limit
integer
Number of items per page, up to a maximum of 500. Defaults to 100 if omitted.
no
--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 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

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.

NAME UNITS TIMESTAMP VALUE
DATABASE_AVERAGE_OBJECT_SIZE BYTES 2020-10-06T14:47:03Z 691.96466
DATABASE_COLLECTION_COUNT SCALAR 2020-10-06T14:47:03Z 5
DATABASE_DATA_SIZE BYTES 2020-10-06T14:47:03Z 5.2300764e+07
DATABASE_STORAGE_SIZE BYTES 2020-10-06T14:47:03Z 4.1414656e+07
DATABASE_INDEX_SIZE BYTES 2020-10-06T14:47:03Z 2.0668416e+07
DATABASE_INDEX_COUNT SCALAR 2020-10-06T14:47:03Z 9
DATABASE_EXTENT_COUNT SCALAR 2020-10-06T14:47:03Z 0
DATABASE_OBJECT_COUNT SCALAR 2020-10-06T14:47:03Z 75583
DATABASE_VIEW_COUNT SCALAR 2020-10-06T14:47:03Z 0

The following example uses the mongocli atlas metrics databases describe command to retrieve the DATABASE_AVERAGE_OBJECT_SIZE for the database sample_db, running on atlas-111xxx-shard-00-00.111xx.mongodb.net. It uses the default profile for accessing Atlas and specifying a project.

mongocli atlas metrics databases describe cluster0-shard-00-00.111xx.mongodb.net:27017 sample_db --granularity PT5M --period PT1H --type DATABASE_AVERAGE_OBJECT_SIZE -o json

The command prints the following fields to the terminal in JSON format. To learn more about these fields, see Output.

{
"end": "2020-10-06T21:05:21Z",
"granularity": "PT5M",
"groupId": "5ddab74939ffb786fa79f10f",
"hostId": "atlas-111xxx-shard-00-00.111xx.mongodb.net:27017",
"links": [
{
"rel": "self",
"href": "..."
},
{
"rel": "http://mms.mongodb.com/host",
"href": "..."
}
],
"measurements": [
{
"dataPoints": [
{
"timestamp": "2020-10-06T20:25:21Z",
"value": 691.96466
},
{
"timestamp": "2020-10-06T20:50:21Z",
"value": 691.96466
},
{
"timestamp": "2020-10-06T21:05:21Z",
"value": 691.96466
}
],
"name": "DATABASE_AVERAGE_OBJECT_SIZE",
"units": "BYTES"
}
],
"processId": "atlas-111xxx-shard-00-00.111xx.mongodb.net:27017",
"start": "2020-10-06T20:25:21Z",
"databaseName": "sample_db"
}
Give Feedback