返回 Atlas Search 硬件和状态指标
返回指定项目中某个进程在提供的时间范围内的 Atlas Search 硬件和状态数据系列。您必须具有“项目只读”或更高角色才能查看 Atlas Search 指标类型。
路径参数
-
为 MongoDB 进程提供服务的主机名和 IANA 端口的组合。主机必须是运行 MongoDB 进程(mongod 或 mongos)的主机的主机名、完全限定域名 (FQDN) 或 Internet 协议地址(IPv4 或 IPv6)。该端口必须是 MongoDB 进程侦听请求的 IANA 端口。
格式应符合以下模式:
^([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})$
。 -
用于标识项目的唯一 24-十六进制数字字符串。 使用 /groups 端点检索身份验证的用户有权访问权限的所有项目。
注意:群组和项目是同义词。您的群组 ID 与项目 ID 相同。对于现有群组,群组/项目 ID 保持不变。资源和相应的端点使用“群组”一词。
格式应符合以下模式:
^([a-f0-9]{24})$
。
查询参数
-
持续时间,用于指定 Atlas 报告指标的时间间隔。此参数以 UTC 格式的 ISO 8601 持续时间格式表示其值。
-
Atlas 报告指标的持续时间。此参数以 UTC 格式的 ISO 8601 持续时间格式表示其值。在未设置开始和结束时包含此参数。
-
MongoDB Cloud 开始报告指标的日期和时间。此参数以 UTC 格式的 ISO 8601 时间戳表示其值。未设置周期时,请包含此参数。
-
MongoDB Cloud 停止报告指标的日期和时间。此参数以 UTC 格式的 ISO 8601 时间戳表示其值。未设置周期时,请包含此参数。
-
指示应用程序是否将响应包装在
envelope
JSON 对象中的标志。某些 API 客户端无法访问 HTTP 响应标头或状态代码。要修复此问题,请在查询中设置 Envelope=true。返回结果列表的端点将结果对象用作 envelope。应用程序将状态参数添加到响应正文中。默认值为
false
。 -
包含您希望 MongoDB Atlas 报告关联数据系列的指标的列表。如果不设置此参数,该资源将返回相关数据系列的所有硬件和状态指标。
不超过
10
个元素。值为FTS_DISK_USAGE
、FTS_PROCESS_CPU_KERNEL
、FTS_PROCESS_CPU_USER
、FTS_PROCESS_NORMALIZED_CPU_KERNEL
、FTS_PROCESS_NORMALIZED_CPU_USER
、FTS_PROCESS_RESIDENT_MEMORY
、FTS_PROCESS_SHARED_MEMORY
、FTS_PROCESS_VIRTUAL_MEMORY
、JVM_CURRENT_MEMORY
、JVM_MAX_MEMORY
或PAGE_FAULTS
。
atlas api monitoringAndLogs listGroupHostFtsMetricMeasurements --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20230101001/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.ListGroupHostFtsMetricMeasurementsApiParams{}
sdkResp, httpResp, err := client.MonitoringandLogsApi.
ListGroupHostFtsMetricMeasurementsWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2023-01-01+json" \
-X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/measurements?pretty=true"
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2023-01-01+json" \
-X GET "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/hosts/{processId}/fts/metrics/measurements?pretty=true"
{
"end": "2025-05-04T09:42:00Z",
"granularity": "PT1M",
"groupId": "32b6e34b3d91647abb20e7b8",
"hardwareMeasurements": [
{
"dataPoints": [
{
"timestamp": "2025-05-04T09:42:00Z",
"value": 42.0
}
],
"name": "string",
"units": "BYTES"
}
],
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"processId": "mongodb.example.com:27017",
"start": "2025-05-04T09:42:00Z",
"statusMeasurements": [
{
"dataPoints": [
{
"timestamp": "2025-05-04T09:42:00Z",
"value": 42.0
}
],
"name": "string",
"units": "BYTES"
}
]
}
{
"error": 400,
"detail": "(This is just an example, the exception may not be related to this endpoint) No provider AWS exists.",
"reason": "Bad Request",
"errorCode": "VALIDATION_ERROR"
}
{
"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": 429,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Too Many Requests",
"errorCode": "RATE_LIMITED"
}
{
"error": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}