Return Measurements for One MongoDB Process
Returns disk, partition, or host measurements per process for the specified host for the specified project. Returned value can be one of the following:
- Throughput of I/O operations for the disk partition used for the MongoDB process
- Percentage of time during which requests the partition issued and serviced
- Latency per operation type of the disk partition used for the MongoDB process
- Amount of free and used disk space on the disk partition used for the MongoDB process
- Measurements for the host, such as CPU usage or number of I/O operations
To use this resource, the requesting Service Account or API Key must have the Project Read Only role.
Path parameters
-
Unique 24-hexadecimal digit string that identifies your project. Use the /groups endpoint to retrieve all projects to which the authenticated user has access.
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.
Format should match the following pattern:
^([a-f0-9]{24})$
. -
Combination of hostname and Internet Assigned Numbers Authority (IANA) port that serves the MongoDB process. The host must be the hostname, fully qualified domain name (FQDN), or Internet Protocol address (IPv4 or IPv6) of the host that runs the MongoDB process (
mongod
ormongos
). The port must be the IANA port on which the MongoDB process listens for requests.Format should match the following pattern:
^([0-9]{1,3}\.){3}[0-9]{1,3}|([0-9a-f]{1,4}\:){7}([0-9a-f]{1,4})|(([a-z0-9]+\.){1,10}[a-z]+)?(\:[0-9]{4,5})$
.
Query parameters
-
Flag that indicates whether Application wraps the response in an
envelope
JSON object. Some API clients cannot access the HTTP response headers or status code. To remediate this, set envelope=true in the query. Endpoints that return a list of results use the results object as an envelope. Application adds the status parameter to the response body.Default value is
false
. -
Flag that indicates whether the response body should be in the prettyprint format.
Default value is
false
.Prettyprint -
One or more types of measurement to request for this MongoDB process. If omitted, the resource returns all measurements. To specify multiple values for
m
, repeat them
parameter for each value. Specify measurements that apply to the specified host. MongoDB Cloud returns an error if you specified any invalid measurements.At least
1
but not more than10
elements. Values areASSERT_MSG
,ASSERT_REGULAR
,ASSERT_USER
,ASSERT_WARNING
,BACKGROUND_FLUSH_AVG
,CACHE_BYTES_READ_INTO
,CACHE_BYTES_WRITTEN_FROM
,CACHE_DIRTY_BYTES
,CACHE_USED_BYTES
,CACHE_FILL_RATIO
,DIRTY_FILL_RATIO
,COMPUTED_MEMORY
,CONNECTIONS
,CURSORS_TOTAL_OPEN
,CURSORS_TOTAL_TIMED_OUT
,DB_DATA_SIZE_TOTAL
,DB_STORAGE_TOTAL
,DOCUMENT_METRICS_DELETED
,DOCUMENT_METRICS_INSERTED
,DOCUMENT_METRICS_RETURNED
,DOCUMENT_METRICS_UPDATED
,EXTRA_INFO_PAGE_FAULTS
,FTS_DISK_UTILIZATION
,FTS_MEMORY_MAPPED
,FTS_MEMORY_RESIDENT
,FTS_MEMORY_VIRTUAL
,FTS_PROCESS_CPU_KERNEL
,FTS_PROCESS_CPU_USER
,FTS_PROCESS_NORMALIZED_CPU_KERNEL
,FTS_PROCESS_NORMALIZED_CPU_USER
,GLOBAL_ACCESSES_NOT_IN_MEMORY
,GLOBAL_LOCK_CURRENT_QUEUE_READERS
,GLOBAL_LOCK_CURRENT_QUEUE_TOTAL
,GLOBAL_LOCK_CURRENT_QUEUE_WRITERS
,GLOBAL_PAGE_FAULT_EXCEPTIONS_THROWN
,INDEX_COUNTERS_BTREE_ACCESSES
,INDEX_COUNTERS_BTREE_HITS
,INDEX_COUNTERS_BTREE_MISS_RATIO
,INDEX_COUNTERS_BTREE_MISSES
,JOURNALING_COMMITS_IN_WRITE_LOCK
,JOURNALING_MB
,JOURNALING_WRITE_DATA_FILES_MB
,MAX_PROCESS_CPU_CHILDREN_KERNEL
,MAX_PROCESS_CPU_CHILDREN_USER
,MAX_PROCESS_CPU_KERNEL
,MAX_PROCESS_CPU_USER
,MAX_PROCESS_NORMALIZED_CPU_CHILDREN_KERNEL
,MAX_PROCESS_NORMALIZED_CPU_CHILDREN_USER
,MAX_PROCESS_NORMALIZED_CPU_KERNEL
,MAX_PROCESS_NORMALIZED_CPU_USER
,MAX_SWAP_USAGE_FREE
,MAX_SWAP_USAGE_USED
,MAX_SYSTEM_CPU_GUEST
,MAX_SYSTEM_CPU_IOWAIT
,MAX_SYSTEM_CPU_IRQ
,MAX_SYSTEM_CPU_KERNEL
,MAX_SYSTEM_CPU_SOFTIRQ
,MAX_SYSTEM_CPU_STEAL
,MAX_SYSTEM_CPU_USER
,MAX_SYSTEM_MEMORY_AVAILABLE
,MAX_SYSTEM_MEMORY_FREE
,MAX_SYSTEM_MEMORY_USED
,MAX_SYSTEM_NETWORK_IN
,MAX_SYSTEM_NETWORK_OUT
,MAX_SYSTEM_NORMALIZED_CPU_GUEST
,MAX_SYSTEM_NORMALIZED_CPU_IOWAIT
,MAX_SYSTEM_NORMALIZED_CPU_IRQ
,MAX_SYSTEM_NORMALIZED_CPU_KERNEL
,MAX_SYSTEM_NORMALIZED_CPU_NICE
,MAX_SYSTEM_NORMALIZED_CPU_SOFTIRQ
,MAX_SYSTEM_NORMALIZED_CPU_STEAL
,MAX_SYSTEM_NORMALIZED_CPU_USER
,MEMORY_MAPPED
,MEMORY_RESIDENT
,MEMORY_VIRTUAL
,NETWORK_BYTES_IN
,NETWORK_BYTES_OUT
,NETWORK_NUM_REQUESTS
,OP_EXECUTION_TIME_COMMANDS
,OP_EXECUTION_TIME_READS
,OP_EXECUTION_TIME_WRITES
,OPCOUNTER_CMD
,OPCOUNTER_DELETE
,OPCOUNTER_TTL_DELETED
,OPCOUNTER_GETMORE
,OPCOUNTER_INSERT
,OPCOUNTER_QUERY
,OPCOUNTER_REPL_CMD
,OPCOUNTER_REPL_DELETE
,OPCOUNTER_REPL_INSERT
,OPCOUNTER_REPL_UPDATE
,OPCOUNTER_UPDATE
,OPERATIONS_SCAN_AND_ORDER
,OPERATIONS_QUERIES_KILLED
,OPLOG_MASTER_LAG_TIME_DIFF
,OPLOG_MASTER_TIME
,OPLOG_RATE_GB_PER_HOUR
,OPLOG_SLAVE_LAG_MASTER_TIME
,OPLOG_REPLICATION_LAG
,PROCESS_CPU_CHILDREN_KERNEL
,PROCESS_CPU_CHILDREN_USER
,PROCESS_CPU_KERNEL
,PROCESS_CPU_USER
,PROCESS_NORMALIZED_CPU_CHILDREN_KERNEL
,PROCESS_NORMALIZED_CPU_CHILDREN_USER
,PROCESS_NORMALIZED_CPU_KERNEL
,PROCESS_NORMALIZED_CPU_USER
,QUERY_EXECUTOR_SCANNED
,QUERY_EXECUTOR_SCANNED_OBJECTS
,QUERY_TARGETING_SCANNED_OBJECTS_PER_RETURNED
,QUERY_TARGETING_SCANNED_PER_RETURNED
,RESTARTS_IN_LAST_HOUR
,SWAP_USAGE_FREE
,SWAP_USAGE_USED
,SYSTEM_CPU_GUEST
,SYSTEM_CPU_IOWAIT
,SYSTEM_CPU_IRQ
,SYSTEM_CPU_KERNEL
,SYSTEM_CPU_NICE
,SYSTEM_CPU_SOFTIRQ
,SYSTEM_CPU_STEAL
,SYSTEM_CPU_USER
,SYSTEM_MEMORY_AVAILABLE
,SYSTEM_MEMORY_FREE
,SYSTEM_MEMORY_USED
,SYSTEM_NETWORK_IN
,SYSTEM_NETWORK_OUT
,SYSTEM_NORMALIZED_CPU_GUEST
,SYSTEM_NORMALIZED_CPU_IOWAIT
,SYSTEM_NORMALIZED_CPU_IRQ
,SYSTEM_NORMALIZED_CPU_KERNEL
,SYSTEM_NORMALIZED_CPU_NICE
,SYSTEM_NORMALIZED_CPU_SOFTIRQ
,SYSTEM_NORMALIZED_CPU_STEAL
,SYSTEM_NORMALIZED_CPU_USER
,TICKETS_AVAILABLE_READS
,TICKETS_AVAILABLE_WRITE
,OPERATION_THROTTLING_REJECTED_OPERATIONS
, orQUERY_SPILL_TO_DISK_DURING_SORT
. -
Duration over which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC. Include this parameter when you do not set start and end.
-
Duration that specifies the interval at which Atlas reports the metrics. This parameter expresses its value in the ISO 8601 duration format in UTC.
-
Date and time when MongoDB Cloud begins reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set period.
-
Date and time when MongoDB Cloud stops reporting the metrics. This parameter expresses its value in the ISO 8601 timestamp format in UTC. Include this parameter when you do not set period.
atlas api getHostMeasurements --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20250312001/admin"
)
func main() {
ctx := context.Background()
clientID := os.Getenv("MONGODB_ATLAS_CLIENT_ID")
clientSecret := os.Getenv("MONGODB_ATLAS_CLIENT_SECRET")
client, err := sdk.NewClient(
sdk.UseOAuthAuth(clientID, clientSecret),
sdk.UseBaseURL(url))
if err != nil {
log.Fatalf("Error: %v", err)
}
params = &sdk.GetHostMeasurementsApiParams{}
sdkResp, httpResp, err := client.MonitoringandLogsApi.
GetHostMeasurementsWithParams(ctx, params).
Execute()
}
curl --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
-X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/processes/{processId}/measurements?pretty=true"
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest \
--header "Accept: application/vnd.atlas.2025-03-12+json" \
-X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/processes/{processId}/measurements?pretty=true"
{
"databaseName": "string",
"end": "2025-05-04T09:42:00Z",
"granularity": "PT1M",
"groupId": "32b6e34b3d91647abb20e7b8",
"hostId": "mongodb.example.com:27017",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"measurements": [
{
"dataPoints": [
{
"timestamp": "2025-05-04T09:42:00Z",
"value": 42.0
}
],
"name": "string",
"units": "BYTES"
}
],
"partitionName": "string",
"processId": "mongodb.example.com:27017",
"start": "2025-05-04T09:42:00Z"
}
{
"error": 401,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Unauthorized",
"errorCode": "NOT_ORG_GROUP_CREATOR"
}
{
"error": 403,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Forbidden",
"errorCode": "CANNOT_CHANGE_GROUP_NAME"
}
{
"error": 404,
"detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
"reason": "Not Found",
"errorCode": "RESOURCE_NOT_FOUND"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}