Return One Shard in One Cluster

GET /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/shardMetrics/{replicaSetName}

Returns the size, load and open alerts of one shard in one sharded cluster. Returns everything the list method returns for this shard, plus its read latency, its WiredTiger cache throughput, its queued range deletion tasks, and the alerts open on its nodes.

Role requirements
  • Project Read Only

Path parameters

  • groupId string Required

    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})$.

  • clusterName string Required

    Human-readable label that identifies the cluster.

    Format should match the following pattern: ^[a-zA-Z0-9][a-zA-Z0-9-]*$.

  • replicaSetName string Required

    Name of the replica set that identifies the shard.

Query parameters

  • envelope boolean

    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.

  • pretty boolean

    Flag that indicates whether the response body should be in the prettyprint format.

    Default value is false.

    Prettyprint

Responses

  • 200 application/vnd.atlas.2025-03-12+json

    OK

    Hide headers attributes Show headers attributes
    • RateLimit-Limit

      The maximum number of requests that a user can make within a specific time window.

    • RateLimit-Remaining

      The number of requests remaining in the current rate limit window before the limit is reached.

    Hide response attributes Show response attributes object
    • alerts array[object]

      Alerts open on this shard's nodes, sorted by creation date with the most recently created first. MongoDB Cloud returns this property when you request a single shard, and returns at most 100 alerts.

      Not more than 100 elements.

      Hide alerts attributes Show alerts attributes object

      Open alert on one of the shard's nodes.

      • message string Required

        Human-readable description of the condition that triggered this alert.

      • severity string Required

        Severity that MongoDB Cloud assigned to this alert.

        Values are INFO, WARNING, ERROR, or CRITICAL.

    • cacheThroughput object

      Bytes per second that the shard moved in and out of the cache over the last hour.

      Hide cacheThroughput attributes Show cacheThroughput attributes object
      • readIntoBytesPerSecond number(double) Required

        Average bytes per second read into the cache, across the shard's nodes over the last hour.

      • writtenFromBytesPerSecond number(double) Required

        Average bytes per second written from the cache, across the shard's nodes over the last hour.

    • cpuUtilization object Required

      CPU utilization of the shard's nodes over the last hour, as a percentage.

      Hide cpuUtilization attributes Show cpuUtilization attributes object
      • averagePercent number(double) Required

        Average CPU utilization across the shard's nodes over the last hour.

      • maximumPercent number(double) Required

        Highest CPU utilization that any one of the shard's nodes reached over the last hour.

    • dataSizeBytes integer(int64) Required

      Total size of the user data stored on this shard. The resource expresses this value in bytes.

      Minimum value is 0.

    • rangeDeleterTasks number(double)

      Average number of range deletion tasks queued across the shard's nodes, measured at the time of the request.

      Minimum value is 0.

    • readLatencyMicroseconds number(double)

      Average latency of the read operations this shard served over the last hour, in microseconds.

      Minimum value is 0.

    • readOperationsPerSecond object Required

      Operations per second that the shard served over the last hour.

      Hide readOperationsPerSecond attributes Show readOperationsPerSecond attributes object
      • average number(double) Required

        Average operations per second across the shard's nodes over the last hour.

      • maximum number(double) Required

        Highest operations per second that any one of the shard's nodes reached over the last hour.

    • replicaSetName string Required

      Name of the shard's replica set. This is the name that identifies the same shard on the processes, alerts, events, and backup resources.

    • shardedCollections integer(int32) Required

      Number of sharded collections with data on this shard.

      Minimum value is 0.

    • warnings array[string] Required

      Conditions that MongoDB Cloud observed on this shard relative to the rest of the cluster. HOTSPOT means this shard's average CPU utilization is more than twice the average across all shards of the cluster. This is a cluster-scoped comparison, so its value depends on how loaded the other shards are and not only on this shard.

      Not more than 100 elements. Value is HOTSPOT.

    • writeOperationsPerSecond object Required

      Operations per second that the shard served over the last hour.

      Hide writeOperationsPerSecond attributes Show writeOperationsPerSecond attributes object
      • average number(double) Required

        Average operations per second across the shard's nodes over the last hour.

      • maximum number(double) Required

        Highest operations per second that any one of the shard's nodes reached over the last hour.

  • 400 application/json

    Bad Request.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

  • 401 application/json

    Unauthorized.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

  • 403 application/json

    Forbidden.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

  • 404 application/json

    Not Found.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

  • 429 application/json

    Too Many Requests.

    Hide headers attributes Show headers attributes
    • RateLimit-Limit

      The maximum number of requests that a user can make within a specific time window.

    • RateLimit-Remaining

      The number of requests remaining in the current rate limit window before the limit is reached.

    • Retry-After

      The minimum time you should wait, in seconds, before retrying the API request. This header might be returned for 429 or 503 error responses.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

  • 500 application/json

    Internal Server Error.

    Hide response attributes Show response attributes object
    • badRequestDetail object

      Bad request detail.

      Hide badRequestDetail attribute Show badRequestDetail attribute object
      • fields array[object]

        Describes all violations in a client request.

        Hide fields attributes Show fields attributes object
        • description string Required

          A description of why the request element is bad.

        • field string Required

          A path that leads to a field in the request body.

    • detail string | null

      Describes the specific conditions or reasons that cause each type of error.

    • error integer(int32) Required

      HTTP status code returned with this error.

      External documentation
    • errorCode string Required

      Application error code returned with this error.

    • parameters array[object]

      Parameters used to give more information about the error.

    • reason string | null

      Application error message returned with this error.

GET /api/atlas/v2/groups/{groupId}/clusters/{clusterName}/shardMetrics/{replicaSetName}
atlas api shardingInsights getClusterShardMetric --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")

	// See https://dochub.mongodb.org/core/atlas-go-sdk-oauth
	client, err := sdk.NewClient(sdk.UseOAuthAuth(clientID, clientSecret))

	if err != nil {
		log.Fatalf("Error: %v", err)
	}

	params = &sdk.GetGroupClusterShardMetricApiParams{}
	sdkResp, httpResp, err := client.ShardingInsightsApi.
		GetGroupClusterShardMetricWithParams(ctx, params).
		Execute()
}
curl --include --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}/clusters/{clusterName}/shardMetrics/{replicaSetName}?pretty=true"
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
  --digest --include \
  --header "Accept: application/vnd.atlas.2025-03-12+json" \
  -X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/clusters/{clusterName}/shardMetrics/{replicaSetName}?pretty=true"
Response examples (200)
# Headers

# Payload
{
  "alerts": [
    {
      "message": "string",
      "severity": "INFO"
    }
  ],
  "cacheThroughput": {
    "readIntoBytesPerSecond": 42.0,
    "writtenFromBytesPerSecond": 42.0
  },
  "cpuUtilization": {
    "averagePercent": 42.0,
    "maximumPercent": 42.0
  },
  "dataSizeBytes": 42,
  "rangeDeleterTasks": 42.0,
  "readLatencyMicroseconds": 42.0,
  "readOperationsPerSecond": {
    "average": 42.0,
    "maximum": 42.0
  },
  "replicaSetName": "atlas-abcdef-shard-0",
  "shardedCollections": 42,
  "warnings": [
    "HOTSPOT"
  ],
  "writeOperationsPerSecond": {
    "average": 42.0,
    "maximum": 42.0
  }
}
Response examples (400)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
  "error": 400,
  "errorCode": "VALIDATION_ERROR",
  "reason": "Bad Request"
}
Response examples (401)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint)",
  "error": 401,
  "errorCode": "NOT_ORG_GROUP_CREATOR",
  "reason": "Unauthorized"
}
Response examples (403)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint)",
  "error": 403,
  "errorCode": "CANNOT_CHANGE_GROUP_NAME",
  "reason": "Forbidden"
}
Response examples (404)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint) Cannot find resource AWS",
  "error": 404,
  "errorCode": "RESOURCE_NOT_FOUND",
  "reason": "Not Found"
}
Response examples (429)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint)",
  "error": 429,
  "errorCode": "RATE_LIMITED",
  "reason": "Too Many Requests"
}
Response examples (500)
{
  "detail": "(This is just an example, the exception may not be related to this endpoint)",
  "error": 500,
  "errorCode": "UNEXPECTED_ERROR",
  "reason": "Internal Server Error"
}