Kurzanleitung: Ereignisse auflisten, die sich auf ein Projekt oder eine Organisation auswirken, mit der Service Health API

In diesem Dokument wird beschrieben, wie Sie Ereignisse zum Dienststatus auflisten, die sich auf Google Cloud Produkte in Ihrem Google Cloud Projekt oder Ihrer Organisation auswirken könnten oder bereits ausgewirkt haben. Sie verwenden die Service Health API.

Hinweise

  1. Aktivieren Sie die Service Health API für das Projekt in Ihrer Organisation, für das Sie Ereignisse auflisten möchten.
  2. Make sure that billing is enabled for your Google Cloud project.

  3. Legen Sie Berechtigungen für den Zugriff auf die Service Health API fest.
  4. Konfigurieren Sie IAM-Berechtigungen (Identity and Access Management) für Ihre Organisation, um die API-Ressourcen „OrganizationEvents“ und „OrganizationImpacts“ zu verwenden.

    Ersetzen Sie folgende Werte, bevor sie einen der Befehlsdaten verwenden:

    • ORGANIZATION ID: Ihre Google Cloud-Organisations-ID.

    Führen Sie folgenden Befehl aus:

    Linux, macOS oder Cloud Shell

    gcloud organizations add-iam-policy-binding ORGANIZATION_ID \
    --member {USER|GROUP|SERVICE_ACCOUNT} \
    --role roles/servicehealth.viewer

    Windows (PowerShell)

    gcloud organizations add-iam-policy-binding ORGANIZATION_ID `
    --member {USER|GROUP|SERVICE_ACCOUNT} `
    --role roles/servicehealth.viewer

    Windows (cmd.exe)

    gcloud organizations add-iam-policy-binding ORGANIZATION_ID ^
    --member {USER|GROUP|SERVICE_ACCOUNT} ^
    --role roles/servicehealth.viewer

    Informationen zum Abrufen Ihrer ORGANIZATION_ID finden Sie unter Ressourcen-ID Ihrer Organisation abrufen.

    Die für eine Organisation gewährten IAM-Richtlinien werden von allen Projekten in der Organisation übernommen. Mit diesen Richtlinien können Sie unternehmensweit auf Organisations- und Projektereignis-APIs zugreifen.

Verweise

In den API-Referenzen zu „Ereignisse“ (v1,v1beta), „OrganizationEvents“ (v1,v1beta) und „OrganizationImpacts“ (v1, v1beta) finden Sie Informationen zu den verfügbaren Methoden und zur Bedeutung der Felder in der Antwort.

Verwenden Sie beim Festlegen des Produkts oder Standorts die Werte unter Google Cloud products und locations.

Alle aktiven Vorfälle für ein Projekt auflisten

Sie können alle Google Cloud Vorfälle für ein bestimmtes Google Cloud Projekt auflisten.

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • API_VERSION: Die zu verwendende API-Version. Verwenden Sie v1 oder v1beta.
  • PROJECT_ID: die ID des Projekts.

HTTP-Methode und URL:

GET https://servicehealth.googleapis.com/API_VERSION/projects/PROJECT_ID/locations/global/events?filter=state=ACTIVE%20category=INCIDENT&page_size=2&page_token={page_token}

Wenn Sie die Anfrage senden möchten, maximieren Sie eine der folgenden Optionen:

Sie sollten eine JSON-Antwort ähnlich wie diese erhalten:

{
  "events": [
    {
      "name": "projects/PROJECT_ID/locations/global/events/event-123",
      "title": "We are experiencing a connectivity issue affecting Google Cloud SQL in us-east1, australia-southeast2.",
      "description": "The issue with Google Cloud SQL has been resolved for all affected projects. We thank you for your patience while we worked on resolving the issue.",
      "category": "INCIDENT",
      "detailedCategory": "CONFIRMED_INCIDENT",
      "state": "ACTIVE",
      "detailedState": "CONFIRMED",
      "eventImpacts": [
        {
          "product": {
            "productName": "Google Cloud SQL",
            "id": "hV87iK5DcEXKgWU2kDri",
          },
          "location": {
            "locationName": "asia-east2",
          }
        },
        {
          "product": {
            "productName": "Google Cloud SQL",
            "id": "hV87iK5DcEXKgWU2kDri",
          },
          "location": {
            "locationName": "asia-southeast1",
          }
        }
      ],
      "relevance": "RELATED",
      "updateTime": "2022-10-18T17:44:05.690761Z",
      "startTime": "2022-10-18T17:41:20.112287Z",
    },
    {
      "name": "projects/PROJECT_ID/locations/global/events/event-567",
      "title": "Cloud Firestore may experience errors.",
      "description": "Mitigation work is currently underway by our engineering team. The mitigation is expected to complete by 2022-10-07T16:30:00Z.",
      "category": "INCIDENT",
      "detailedCategory": "CONFIRMED_INCIDENT",
      "state": "ACTIVE",
      "detailedState": "CONFIRMED",
      "eventImpacts": [
        {
          "product": {
            "productName": "Cloud Firestore",
            "id": "CETSkT92V21G6A1x28me",
          },
          "location": {
            "locationName": "us-central1-a",
          }
        }
      ],
      "relevance": "RELATED",
      "updateTime": "2022-10-07T15:19:59.409530Z",
      "startTime": "2022-10-07T15:10:35.887125Z",
      "nextUpdateTime": "2022-10-07T16:30:00Z"
    }
  ],
  "nextPageToken": "CgwIw8bDmgYQz4nUlgMQChomcHJvamVjdHMvcHNoLW1hbnVhbC"
}

Wenn Sie nicht die erforderlichen Berechtigungen zum Auflisten von Ereignissen haben, erhalten Sie den Fehler PERMISSION_DENIED.

{
  "error": {
    "code": 403,
    "message": "Permission 'servicehealth.events.list' denied on resource '//servicehealth.googleapis.com/projects/PROJECT_ID/locations/global' (or it may not exist).",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "IAM_PERMISSION_DENIED",
        "domain": "servicehealth.googleapis.com",
        "metadata": {
          "resource": "projects/PROJECT_ID/locations/global",
          "permission": "servicehealth.events.list"
        }
      }
    ]
  }
}

Alle aktiven Vorfälle für eine Organisation auflisten

Sie können alle Google Cloud Vorfälle auflisten, die sich auf ein Projekt auswirken, für das in der jeweiligen Organisation Personal Service Health aktiviert ist Google Cloud .

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • API_VERSION: Die zu verwendende API-Version. Verwenden Sie v1 oder v1beta.
  • ORGANIZATION_ID: Ihre Google Cloud-Organisations-ID.

HTTP-Methode und URL:

GET https://servicehealth.googleapis.com/API_VERSION/organizations/ORGANIZATION_ID/locations/global/organizationEvents?filter=state=ACTIVE%20category=INCIDENT&page_size=2&page_token={page_token}

Wenn Sie die Anfrage senden möchten, maximieren Sie eine der folgenden Optionen:

Sie sollten eine JSON-Antwort ähnlich wie diese erhalten:

{
  "organization_events": [
    {
      "name": "organizations/ORGANIZATION_ID/locations/global/organizationEvents/event-123",
      "title": "We are experiencing a connectivity issue affecting Google Cloud SQL in us-east1, australia-southeast2.",
      "description": "The issue with Google Cloud SQL has been resolved for all affected projects. We thank you for your patience while we worked on resolving the issue.",
      "category": "INCIDENT",
      "detailedCategory": "CONFIRMED_INCIDENT",
      "state": "ACTIVE",
      "detailedState": "CONFIRMED",
      "eventImpacts": [
        {
          "product": {
            "productName": "Google Cloud SQL",
            "id": "hV87iK5DcEXKgWU2kDri",
          },
          "location": {
            "locationName": "asia-east2",
          }
        },
        {
          "product": {
            "productName": "Google Cloud SQL",
            "id": "hV87iK5DcEXKgWU2kDri",
          },
          "location": {
            "locationName": "asia-southeast1",
          }
        }
      ],
      "updateTime": "2022-10-18T17:44:05.690761Z",
      "startTime": "2022-10-18T17:41:20.112287Z",
    },
    {
      "name": "organizations/ORGANIZATION_ID/locations/global/organizationEvents/event-567",
      "title": "Cloud Firestore may experience errors.",
      "description": "Mitigation work is currently underway by our engineering team. The mitigation is expected to complete by 2022-10-07T16:30:00Z.",
      "category": "INCIDENT",
      "detailedCategory": "CONFIRMED_INCIDENT",
      "state": "ACTIVE",
      "detailedState": "CONFIRMED",
      "eventImpacts": [
        {
          "product": {
            "productName": "Cloud Firestore",
            "id": "CETSkT92V21G6A1x28me",
          },
          "location": {
            "locationName": "us-central1-a",
          }
        }
      ],
      "updateTime": "2022-10-07T15:19:59.409530Z",
      "startTime": "2022-10-07T15:10:35.887125Z",
      "nextUpdateTime": "2022-10-07T16:30:00Z"
    }
  ],
  "nextPageToken": "CgwIw8bDmgYQz4nUlgMQChomcHJvamVjdHMvcHNoLW1hbnVhbC"
}

Informationen zum Abrufen Ihrer ORGANIZATION_ID finden Sie unter Ressourcen-ID Ihrer Organisation abrufen.

Wenn Sie nicht berechtigt sind, Ereignisse aufzulisten, erhalten Sie den Fehler PERMISSION_DENIED.

{
  "error": {
    "code": 403,
    "message": "Permission 'servicehealth.organizationEvents.list' denied on resource '//servicehealth.googleapis.com/organizations/ORGANIZATION_ID/locations/global' (or it may not exist).",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "IAM_PERMISSION_DENIED",
        "domain": "servicehealth.googleapis.com",
        "metadata": {
          "resource": "organizations/<var class="readonly">ORGANIZATION_ID</var>/locations/global",
          "permission": "servicehealth.organizationEvents.list"
        }
      }
    ]
  }
}

Projekte einer Organisation auflisten, die von einem Ereignis betroffen sein könnten

Sie können alle Projekte unter einer bestimmten Google Cloud Organisation auflisten, die:

  • Kann von einem Ereignis (OrganizationImpact) betroffen sein.
  • Sie haben Personalized Service Health aktiviert.

Ersetzen Sie diese Werte in den folgenden Anfragedaten:

  • API_VERSION: Die zu verwendende API-Version. Verwenden Sie v1 oder v1beta.
  • EVENT_ID: die ID des Ereignisses, das sich möglicherweise auf eine Organisation auswirkt.
  • ORGANIZATION_ID: Ihre Google Cloud-Organisations-ID.

HTTP-Methode und URL:

GET https://servicehealth.googleapis.com/API_VERSION/organizations/ORGANIZATION_ID/locations/global/organizationImpacts?filter=events:organizations%2FORGANIZATION_ID%2Flocations%2Fglobal%2FEVENT_ID&page_size=2&page_token={page_token}

Wenn Sie die Anfrage senden möchten, maximieren Sie eine der folgenden Optionen:

Sie sollten eine JSON-Antwort ähnlich wie diese erhalten:

{
  "organization_impacts": [
    {
      "name": "organizations/ORGANIZATION_ID/locations/global/organizationImpacts/impact-123",
      "events": [
        "organizations/ORGANIZATION_ID/locations/global/organizationEvents/EVENT_ID",
      ],
      "asset": {
        "assetName": "//cloudresourcemanager.googleapis.com/projects/{PROJECT_NUMBER_1}",
        "assetType": "cloudresourcemanager.googleapis.com/Project",
      },
      "updateTime": "2022-10-18T17:44:05.690761Z",
    },
    {
      "name": "organizations/ORGANIZATION_ID/locations/global/organizationImpacts/impact-234",
      "events": [
        "organizations/ORGANIZATION_ID/locations/global/organizationEvents/EVENT_ID",
      ],
      "asset": {
        "assetName": "//cloudresourcemanager.googleapis.com/projects/{PROJECT_NUMBER_2}",
        "assetType": "cloudresourcemanager.googleapis.com/Project",
      },
      "updateTime": "2022-10-18T17:44:05.690761Z",
    }
  ],
  "nextPageToken": "CgwIw8bDmgYQz4nUlgMQChomcHJvamVjdHMvcHNoLW1hbnVhbC"
}

Wenn Sie nicht die Berechtigungen zum Auflisten von Ereignissen haben, erhalten Sie den folgenden PERMISSION_DENIED-Fehler.

{
  "error": {
    "code": 403,
    "message": "Permission 'servicehealth.organizationImpacts.list' denied on resource '//servicehealth.googleapis.com/organizations/ORGANIZATION_ID/locations/global' (or it may not exist).",
    "status": "PERMISSION_DENIED",
    "details": [
      {
        "@type": "type.googleapis.com/google.rpc.ErrorInfo",
        "reason": "IAM_PERMISSION_DENIED",
        "domain": "servicehealth.googleapis.com",
        "metadata": {
          "resource": "organizations/ORGANIZATION_ID/locations/global",
          "permission": "servicehealth.organizationImpacts.list"
        }
      }
    ]
  }
}

Nächste Schritte

In den Anleitungen erfahren Sie, wie Sie Ereignisinformationen nach Projekt oder Organisation mithilfe der Service Health API abrufen.