Get Measurements of a Database for a MongoDB Process¶
On this page
Groups and projects are synonymous terms. Your {GROUP-ID}
is the
same as your project ID. For existing groups, your group/project ID
remains the same. The resource and corresponding endpoints use the
term groups
.
Get the measurements of the specified databases for an Atlas MongoDB
process. An Atlas MongoDB process can be either a mongod
or
mongos
.
To calculate some metric series, Atlas takes the rate between every two adjacent points. For these metric series, the first data point has a null value because Atlas can't calculate a rate for the first data point given the query time range.
The Atlas Administration API authenticates using HTTP Digest Authentication. Provide a programmatic API public key and corresponding private key as the username and password when constructing the HTTP request. To learn how to configure API access for an Atlas project, see Get Started with the Atlas Administration API.
Resource¶
Base URL: https://cloud.mongodb.com/api/atlas/v1.0
GET /groups/{GROUP-ID}/processes/{HOST}:{PORT}/databases/{DATABASE-NAME}/measurements
Request Path Parameters¶
Parameter | Type | Necessity | Description |
---|---|---|---|
GROUP-ID | string | Required | Unique 24-hexadecimal digit string that identifies the project
that owns this Atlas MongoDB process. |
HOST | string | Required | Hostname, FQDN, IPv4 address, or IPv6 address of the
machine running the Atlas MongoDB process. |
PORT | number | Required | IANA port to which the Atlas MongoDB process listens. |
DATABASE-NAME | string | Required | Label that identifies the database from which you want to
retrieve measurements. |
---|
Request Query Parameters¶
Name | Type | Necessity | Description | Default |
---|---|---|---|---|
pageNum | integer | Optional | Page number, starting with one, that Atlas returns of the
total number of objects. | 1 |
itemsPerPage | integer | Optional | Number of items that Atlas returns per page, up to a maximum
of 500. | 100 |
includeCount | boolean | Optional | Flag that indicates whether Atlas returns the totalCount
parameter in the response body. | true |
pretty | boolean | Optional | Flag that indicates whether Atlas returns the JSON
response in the
prettyprint format. | false |
envelope | boolean | Optional | Flag that indicates whether Atlas wraps the response in an envelope. Some API clients cannot access the HTTP response headers or
status code. To remediate this, set Endpoints that return a list of results use the results object as an envelope. Atlas adds the status parameter to the response body. | false |
granularity | string | Required | Duration in ISO 8601 notation that specifies the interval between measurement data points. Example PT1M specifies 1-minute granularity. Atlas supports the following subset of ISO 8601-formatted time periods:
When you specify granularity, you must specify either period or start and end. Atlas retrieves database metrics every 20 minutes by default. Results include data points with 20 minute intervals. To learn more, see View MongoDB Processes. | ||
---|---|---|---|---|---|
period | string | Required | Duration in ISO 8601 notation that specifies the length of time in the past to query. Mutually exclusive with start and end. Example To request the last 36 hours, specify: period=P1DT12H. | ||
start | string | Required | Timestamp in ISO 8601 date and time format in UTC when to start retrieving measurements. If you
specify start you must also specify end. Mutually
exclusive with period. | ||
end | string | Required | Timestamp in ISO 8601 date and time format in UTC when to stop retrieving measurements. If you specify end you must also specify start. Mutually exclusive with period. | ||
m | string | Optional | Type of measurements this endpoint return. If you don't set m, the endpoint returns all measurements. To specify multiple values for m, you must repeat the m parameter. Example
You must specify measurements that are valid for the host. Atlas returns an error if any specified measurements are invalid. The Measurement Values section details these metrics. |
Request Body Parameters¶
This endpoint doesn't use HTTP request body parameters.
Response Elements¶
M0/M2/M5 clusters return a subset of the metrics documented.
If you set the query parameter to envelope=true, the resource wraps the response in a content object.
The HTTP response returns a JSON document that includes the following objects:
Name | Type | Description |
---|---|---|
end | string | Timestamp in ISO 8601 date and time format in UTC when to stop retrieving measurements. |
granularity | string | Duration in ISO 8601 notation that specifies the interval between
measurement data points. |
groupId | string | Unique 24-hexadecimal digit string that identifies the project
that owns the Atlas MongoDB process. |
hostId | string | Hostname and port of the host running the Atlas MongoDB
process. |
links | array | One or more links to sub-resources and/or related resources. The relations between URLs are explained in the Web Linking Specification |
measurements | array | List of measurements recorded and their data points. |
measurements .dataPoints | array | Value of and metadata provided for one data point. If Atlas
has no data point for a particular moment in time, the value
field is set to null. |
measurements .dataPoints .timestamp | string | Timestamp in ISO 8601 date and time format in UTC when this time interval that this data point
represents began. |
measurements .dataPoints .value | number | Value this data point provides. |
measurements .name | string | Name of the measurement that this data point covers. The Measurement Values section details these metrics. |
measurements .units | string | Magnitude by which Atlas quanitifies the measurement. |
processId | string | Hostname and port of the machine running the Atlas
MongoDB process. |
start | string | Timestamp in ISO 8601 date and time format in UTC when to start retrieving measurements. |
databaseName | string | Name of the database to which the measurements pertain. |
---|
Measurement Values¶
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 | Measures the database's on-disk storage space, as collected from
the MongoDB dbStats command. |
---|
Example Request¶
Replace the information in brackets {}
with your own Atlas
information to execute this example request:
curl --user "{PUBLIC-KEY}:{PRIVATE-KEY}" --digest \ --header "Content-Type: application/json" \ --include \ --request GET "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/processes/{HOST}:{PORT}/databases/{DATABASE-NAME}/measurements?granularity=PT1M&period=PT1M&pretty=true"
Example Response¶
Response Header¶
401 Unauthorized Content-Type: application/json;charset=ISO-8859-1 Date: {dateInUnixFormat} WWW-Authenticate: Digest realm="MMS Public API", domain="", nonce="{nonce}", algorithm=MD5, op="auth", stale=false Content-Length: {requestLengthInBytes} Connection: keep-alive
200 OK Vary: Accept-Encoding Content-Type: application/json Strict-Transport-Security: max-age=300 Date: {dateInUnixFormat} Connection: keep-alive Content-Length: {requestLengthInBytes}
Response Body¶
1 { 2 "databaseName":"{DATABASE-NAME}", 3 "granularity":"PT1M", 4 "groupId":"{PROJECT-ID}", 5 "hostId":"shard-00-00.mongodb.net:27017", 6 "links":[], 7 "measurements":[ 8 { 9 "dataPoints":[ 10 11 ], 12 "name":"DATABASE_AVERAGE_OBJECT_SIZE", 13 "units":"BYTES" 14 } 15 ], 16 "processId":"shard-00-00.mongodb.net:27017" 17 }