1 つのプロジェクトからの 1 つのアラートを確認
既存のアラートを 1 つ受信していることを確認します。このアラートは、1 つのプロジェクト内の任意のコンポーネントに適用されます。アラートを確認すると、通知が連続して行われなくなります。モニター対象コンポーネントが設定した値を満たすか上回ると、アラートを確認するまでアラートが送信されます。このリソースを使用するには、リクエスト元のサービス アカウントまたは API キーに組織オーナーまたはプロジェクト オーナーのロールが必要です。1 つのプロジェクトからすべてのアラートを返すエンドポイントを使用して、認証されたユーザーがアクセス可能なすべてのアラートを取得してください。
このリソースは現在も改訂中であり、変更される可能性があります。非推奨のバージョン: v2-{2023-01-01}
path パラメータ
-
プロジェクトを識別する一意の 24 桁の 16 進数文字列。 認証済みユーザーがアクセスできるすべてのプロジェクトを取得するには、 /groups エンドポイントを使用します。
注: グループとプロジェクトは同義語です。そのため、グループ ID はプロジェクト ID と同じです。既存のグループの場合、グループ/プロジェクト ID は同じままです。リソースおよび対応するエンドポイントでは、グループという用語が使用されます。
形式は次のパターンと一致する必要があります:
^([a-f0-9]{24})$
。 -
アラートを識別するユニークな 24 桁の 16 進数の文字列。
形式は次のパターンと一致する必要があります:
^([a-f0-9]{24})$
。
クエリ パラメータ
-
アプリケーションがレスポンスを
envelope
JSON オブジェクトにラップするかどうかを示すフラグ。一部の API クライアントは、HTTP レスポンス ヘッダーまたはステータス コードにアクセスできません。これを修正するには、クエリで envelope=true を設定します。結果のリストを返すエンドポイントは、結果オブジェクトをエンベロープとして使用します。アプリケーションは、レスポンス本体にステータス パラメータを追加します。デフォルト値は
false
です。 -
レスポンス本体を pretty-print 形式にするかどうかを示すフラグ。
デフォルト値は
false
です。Prettyprint
body
必須
1 つのアラートを確認または未確認にします。
-
このアラートが確認されるまでの日数と時間。このパラメーターは、UTC の ISO 8601 タイムスタンプ形式で値を表します。MongoDB ユーザーが以前にこのアラートを確認済みの場合、リソースはこのパラメータを返します。
ISO 8601 -
MongoDB Cloud ユーザーがアラートを確認するときに送信したコメント。
最大長は
200
です。 -
以前に確認されたアラートを未確認にすることを示すフラグ。この値は、デフォルトで false に設定されています。true に設定されると、acknowledgedUntil パラメータが上書きされます。
atlas api alerts acknowledgeGroupAlert --help
import (
"os"
"context"
"log"
sdk "go.mongodb.org/atlas-sdk/v20241023001/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.AcknowledgeGroupAlertApiParams{}
sdkResp, httpResp, err := client.AlertsApi.
AcknowledgeGroupAlertWithParams(ctx, params).
Execute()
}
curl --include --header "Authorization: Bearer ${ACCESS_TOKEN}" \
--header "Accept: application/vnd.atlas.2024-10-23+json" \
--header "Content-Type: application/json" \
-X PATCH "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/alerts/{alertId}" \
-d '{ <Payload> }'
curl --user "${PUBLIC_KEY}:${PRIVATE_KEY}" \
--digest --include \
--header "Accept: application/vnd.atlas.2024-10-23+json" \
--header "Content-Type: application/json" \
-X PATCH "https://cloud.mongodb.com/api/atlas/v2/groups/{groupId}/alerts/{alertId}" \
-d '{ <Payload> }'
{
"acknowledgedUntil": "2025-05-04T09:42:00Z",
"acknowledgementComment": "Expiration on 3/19. Silencing for 7days.",
"unacknowledgeAlert": true
}
{
"acknowledgedUntil": "2025-05-04T09:42:00Z",
"acknowledgementComment": "Expiration on 3/19. Silencing for 7days.",
"acknowledgingUsername": "hello@example.com",
"alertConfigId": "32b6e34b3d91647abb20e7b8",
"created": "2025-05-04T09:42:00Z",
"eventTypeName": "DEPLOYMENT_FAILURE",
"groupId": "32b6e34b3d91647abb20e7b8",
"id": "32b6e34b3d91647abb20e7b8",
"lastNotified": "2025-05-04T09:42:00Z",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"orgId": "32b6e34b3d91647abb20e7b8",
"resolved": "2025-05-04T09:42:00Z",
"status": "OPEN",
"updated": "2025-05-04T09:42:00Z"
}
{
"acknowledgedUntil": "2025-05-04T09:42:00Z",
"acknowledgementComment": "Expiration on 3/19. Silencing for 7days.",
"acknowledgingUsername": "hello@example.com",
"alertConfigId": "32b6e34b3d91647abb20e7b8",
"clusterName": "cluster1",
"created": "2025-05-04T09:42:00Z",
"eventTypeName": "CLUSTER_MONGOS_IS_MISSING",
"groupId": "32b6e34b3d91647abb20e7b8",
"id": "32b6e34b3d91647abb20e7b8",
"lastNotified": "2025-05-04T09:42:00Z",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"orgId": "32b6e34b3d91647abb20e7b8",
"resolved": "2025-05-04T09:42:00Z",
"status": "OPEN",
"updated": "2025-05-04T09:42:00Z"
}
{
"acknowledgedUntil": "2025-05-04T09:42:00Z",
"acknowledgementComment": "Expiration on 3/19. Silencing for 7days.",
"acknowledgingUsername": "hello@example.com",
"alertConfigId": "32b6e34b3d91647abb20e7b8",
"clusterName": "cluster1",
"created": "2025-05-04T09:42:00Z",
"eventTypeName": "HOST_DOWN",
"groupId": "32b6e34b3d91647abb20e7b8",
"hostnameAndPort": "cloud-test.mongodb.com:27017",
"id": "32b6e34b3d91647abb20e7b8",
"lastNotified": "2025-05-04T09:42:00Z",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"orgId": "32b6e34b3d91647abb20e7b8",
"replicaSetName": "event-replica-set",
"resolved": "2025-05-04T09:42:00Z",
"status": "OPEN",
"updated": "2025-05-04T09:42:00Z"
}
{
"acknowledgedUntil": "2025-05-04T09:42:00Z",
"acknowledgementComment": "Expiration on 3/19. Silencing for 7days.",
"acknowledgingUsername": "hello@example.com",
"alertConfigId": "32b6e34b3d91647abb20e7b8",
"clusterName": "cluster1",
"created": "2025-05-04T09:42:00Z",
"currentValue": {
"number": 42.0,
"units": "bits"
},
"eventTypeName": "OUTSIDE_METRIC_THRESHOLD",
"groupId": "32b6e34b3d91647abb20e7b8",
"hostnameAndPort": "cloud-test.mongodb.com:27017",
"id": "32b6e34b3d91647abb20e7b8",
"lastNotified": "2025-05-04T09:42:00Z",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"metricName": "ASSERT_USER",
"orgId": "32b6e34b3d91647abb20e7b8",
"replicaSetName": "event-replica-set",
"resolved": "2025-05-04T09:42:00Z",
"status": "OPEN",
"updated": "2025-05-04T09:42:00Z"
}
{
"acknowledgedUntil": "2025-05-04T09:42:00Z",
"acknowledgementComment": "Expiration on 3/19. Silencing for 7days.",
"acknowledgingUsername": "hello@example.com",
"alertConfigId": "32b6e34b3d91647abb20e7b8",
"clusterName": "cluster1",
"created": "2025-05-04T09:42:00Z",
"eventTypeName": "NO_PRIMARY",
"groupId": "32b6e34b3d91647abb20e7b8",
"hostnameAndPort": "cloud-test.mongodb.com:27017",
"id": "32b6e34b3d91647abb20e7b8",
"lastNotified": "2025-05-04T09:42:00Z",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"nonRunningHostIds": [
"32b6e34b3d91647abb20e7b8"
],
"orgId": "32b6e34b3d91647abb20e7b8",
"parentClusterId": "32b6e34b3d91647abb20e7b8",
"replicaSetName": "event-replica-set",
"resolved": "2025-05-04T09:42:00Z",
"status": "OPEN",
"updated": "2025-05-04T09:42:00Z"
}
{
"acknowledgedUntil": "2025-05-04T09:42:00Z",
"acknowledgementComment": "Expiration on 3/19. Silencing for 7days.",
"acknowledgingUsername": "hello@example.com",
"alertConfigId": "32b6e34b3d91647abb20e7b8",
"created": "2025-05-04T09:42:00Z",
"eventTypeName": "HOST_DOWN",
"groupId": "32b6e34b3d91647abb20e7b8",
"id": "32b6e34b3d91647abb20e7b8",
"instanceName": "foobar",
"lastNotified": "2025-05-04T09:42:00Z",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"orgId": "32b6e34b3d91647abb20e7b8",
"processorErrorMsg": "MongoServerError: Failed to start stream processor: (Location77175) Could not connect to the Kafka topic with kafka error code: -195, message: Local: Broker transport failure.: (Location77175)",
"processorName": "foobar",
"processorState": "STARTED",
"resolved": "2025-05-04T09:42:00Z",
"status": "OPEN",
"updated": "2025-05-04T09:42:00Z"
}
{
"acknowledgedUntil": "2025-05-04T09:42:00Z",
"acknowledgementComment": "Expiration on 3/19. Silencing for 7days.",
"acknowledgingUsername": "hello@example.com",
"alertConfigId": "32b6e34b3d91647abb20e7b8",
"created": "2025-05-04T09:42:00Z",
"eventTypeName": "CREDIT_CARD_ABOUT_TO_EXPIRE",
"groupId": "32b6e34b3d91647abb20e7b8",
"id": "32b6e34b3d91647abb20e7b8",
"lastNotified": "2025-05-04T09:42:00Z",
"links": [
{
"href": "https://cloud.mongodb.com/api/atlas",
"rel": "self"
}
],
"orgId": "32b6e34b3d91647abb20e7b8",
"resolved": "2025-05-04T09:42:00Z",
"status": "OPEN",
"updated": "2025-05-04T09:42:00Z"
}
{
"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": 500,
"detail": "(This is just an example, the exception may not be related to this endpoint)",
"reason": "Internal Server Error",
"errorCode": "UNEXPECTED_ERROR"
}