Navigation

Get Measurements for a MongoDB Process

Info With Circle IconCreated with Sketch.Note

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 measurements for a specific Atlas MongoDB process. A Atlas MongoDB process can be either a mongod or mongos.

The Atlas 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 Configure Atlas API Access.

https://cloud.mongodb.com/api/atlas/v1.0

GET /groups/{GROUP-ID}/processes/{HOST}:{PORT}/measurements
ParameterRequired/OptionalDescription
GROUP-IDRequiredID of the project that owns this Atlas MongoDB process.
HOSTRequiredThe hostname of the machine running the Atlas MongoDB process.
PORTRequiredThe port to which the Atlas MongoDB process listens.
FieldRequired/OptionalDescription
granularityRequired

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.

periodRequiredAn 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.
startRequiredThe time at which to start retrieving measurements, as specified by an ISO-8601 timestamp string. If you specify start you must also specify end. Mutually exclusive with period.
endRequiredThe time at which to stop retrieving measurements, as specified by an ISO-8601 timestamp string. If you specify end you must also specify start. Mutually exclusive with period.
mOptional

Specifies which measurements to return. If m is not specified, all measurements are returned.

To specify multiple values for m, you must repeat the m parameter. For example:

../measurements?m=<measurement>&m=<measurement>&m=...

You must specify measurements that are valid for the host. Atlas returns an error if any specified measurements are invalid For available measurements, see Measurement Values.

pageNumOptional.

The page to return.

Defaults to 1.

itemsPerPageOptional.

Number of items to return per page, up to a maximum of 500.

Defaults to 100.

includeCountOptional.

Specifies whether the response returns the totalCount field.

Defaults to true.

envelopeOptional.

A boolean that specifies whether or not to wrap the response in an envelope.

Defaults to false.

prettyOptional

A boolean that specifies whether or not to return a "pretty-printed" JSON document.

Defaults to false.

This endpoint does not use HTTP request body parameters.

Important With Circle IconCreated with Sketch.Important
Free Tier

M0 Free Tier clusters return a subset of the metrics documented here.

If you set the query element envelope to true, the response is wrapped by the content object.

The HTTP response returns a JSON document that includes the following objects:

NameTypeDescription
endstringTimestamp in ISO 8601 date and time format in UTC when the period for which to retrieve measurements ends.
granularitystring

Duration in ISO 8601 notation that specifies the size of each data point's covered interval.

Beaker IconExample

PT5M specifies a 5-minute granularity.

groupIdstringUnique identifier of the project that owns the Atlas MongoDB process.
hostIdstringHostname of the machine running the Atlas MongoDB process.
linksarray of objectsAn array of documents, representing a link to one or more sub-resources and/or related resources such as list pagination. See Linking for more information.
measurementsarray of objectsAn array of measurements and their data points.
measurements
.dataPoints
array of objectsEach object represents a single data point. If there is no data point available for a particular moment in time (i.e., a timestamp), the value field is set to null.
measurements
.dataPoints
.timestamp
stringTimestamp of the beginning of the time interval represented by this data point.
measurements
.dataPoints
.value
floatValue of the data point.
measurements
.name
stringName of the measurement. For possible values, see Host Metrics.
measurements
.units
string

Quanitifier of this measurement. You may use:

  • PERCENT
  • MILLISECONDS
  • BYTES
  • GIGABYTES
  • BYTES_PER_SECOND
  • MEGABYTES_PER_SECOND
  • GIGABYTES_PER_HOUR
  • SCALAR_PER_SECOND
  • SCALAR
processIdstringHostname and port of the machine running the Atlas MongoDB process.
startstringTimestamp in ISO 8601 date and time format in UTC when the period for which to retrieve measurements starts.

The following example request sets a granularity and period of one minute. Replace the information in brackets {} with your own Atlas information to execute this example request:

curl -u "<ATLAS-USERNAME>:<API-KEY>" --digest -i "https://cloud.mongodb.com/api/atlas/v1.0/groups/{GROUP-ID}/processes/{HOST}:{PORT}}/measurements?granularity=PT1M&period=PT1M&pretty=true"
HTTP/1.1 200 OK
Vary: Accept-Encoding
Cache-Control: no-cache, no-transform, must-revalidate, proxy-revalidate, max-age=0
Content-Type: application/json
Strict-Transport-Security: max-age=300
Date: Tue, 22 Aug 2017 20:31:22 GMT
Connection: keep-alive
Content-Length: 16848
{ "end" : "2017-08-22T20:31:14Z", "granularity" : "PT1M", "groupId" : "12345678", "hostId" : "shard-00-00.mongodb.net:27017", "links" : [ { "href" : "https://cloud.mongodb.com/api/atlas/v1.0/groups/12345678/processes/shard-00-00.mongodb.net:27017/measurements?granularity=PT1M&period=PT1M&pretty=true", "rel" : "self" }, { "href" : "https://cloud.mongodb.com/api/atlas/v1.0/groups/12345678/processes/shard-00-00.mongodb.net:27017", "rel" : "http://mms.mongodb.com/host" } ], "measurements" : [ { "dataPoints" : [ { "timestamp" : "2017-08-22T20:31:12Z", "value" : null }, { "timestamp" : "2017-08-22T20:31:14Z", "value" : null } ], "name" : "ASSERT_REGULAR", "units" : "SCALAR_PER_SECOND" }, { ... }], "processId" : "shard-00-00.mongodb.net:27017", "start" : "2017-08-22T20:30:45Z" }
Give Feedback