Guida rapida: elenca gli eventi che interessano un progetto o un'organizzazione utilizzando l'API Service Health

Questo documento spiega come elencare gli eventi di integrità del servizio che potrebbero influire o hanno influito sui prodotti nel tuo progetto o nella tua organizzazione. Google Cloud Google Cloud Utilizzerai l'API Service Health.

Prima di iniziare

  1. Abilita l'API Service Health per il progetto della tua organizzazione per cui vuoi elencare gli eventi.
  2. Make sure that billing is enabled for your Google Cloud project.

  3. Imposta le autorizzazioni per accedere all'API Service Health.
  4. Configura le autorizzazioni Identity and Access Management (IAM) nella tua organizzazione per utilizzare le risorse API OrganizationEvents e OrganizationImpacts.

    Prima di utilizzare i dati dei comandi riportati di seguito, effettua le seguenti sostituzioni:

    • ORGANIZATION ID: l'ID organizzazione Google Cloud.

    Esegui questo comando:

    Linux, macOS o 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

    Per ottenere il tuo ORGANIZATION_ID, vedi Ottenere l'ID risorsa dell'organizzazione.

    Le policy IAM concesse a un'organizzazione vengono ereditate da tutti i progetti dell'organizzazione. Questi criteri consentono di accedere alle API per eventi di organizzazione e di progetto in tutta l'organizzazione.

Riferimenti

Consulta i riferimenti API Events (v1,v1beta), OrganizationEvents (v1,v1beta) e OrganizationImpacts (v1, v1beta) per i metodi che puoi utilizzare e il significato dei campi nella risposta.

Quando imposti il prodotto o la località, utilizza i valori che trovi in Google Cloud products e locations.

Elenco di tutti gli incidenti attivi per un progetto

Puoi elencare tutti gli Google Cloud incidenti per un progetto Google Cloud specifico.

Prima di utilizzare i dati della richiesta, apporta le seguenti sostituzioni:

  • API_VERSION: la versione dell'API da utilizzare. Utilizza v1 o v1beta.
  • PROJECT_ID: l'ID progetto

Metodo HTTP e 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}

Per inviare la richiesta, espandi una di queste opzioni:

Dovresti ricevere una risposta JSON simile alla seguente:

{
  "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"
}

Se non disponi delle autorizzazioni richieste per elencare gli eventi, riceverai un errore 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"
        }
      }
    ]
  }
}

Elencare tutti gli incidenti attivi per un'organizzazione

Puoi elencare tutti gli Google Cloud incidenti che interessano qualsiasi progetto in cui è stato attivato Personalized Service Health nell'organizzazione Google Cloud specifica.

Prima di utilizzare i dati della richiesta, apporta le seguenti sostituzioni:

  • API_VERSION: la versione dell'API da utilizzare. Utilizza v1 o v1beta.
  • ORGANIZATION_ID: l'ID organizzazione Google Cloud.

Metodo HTTP e 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}

Per inviare la richiesta, espandi una di queste opzioni:

Dovresti ricevere una risposta JSON simile alla seguente:

{
  "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"
}

Per ottenere il tuo ORGANIZATION_ID, vedi Ottenere l'ID risorsa dell'organizzazione.

Se non disponi delle autorizzazioni per elencare gli eventi, riceverai un errore 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"
        }
      }
    ]
  }
}

Elencare i progetti di un'organizzazione che potrebbero essere interessati da un evento

Puoi elencare tutti i progetti di un'organizzazione Google Cloud specifica che:

  • Potrebbe essere interessato da un evento (OrganizationImpact).
  • Aver abilitato Personalized Service Health.

Prima di utilizzare i dati della richiesta, apporta le seguenti sostituzioni:

  • API_VERSION: la versione dell'API da utilizzare. Utilizza v1 o v1beta.
  • EVENT_ID: l'ID dell'evento che potrebbe interessare un'organizzazione.
  • ORGANIZATION_ID: l'ID organizzazione Google Cloud.

Metodo HTTP e 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}

Per inviare la richiesta, espandi una di queste opzioni:

Dovresti ricevere una risposta JSON simile alla seguente:

{
  "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"
}

Se non disponi delle autorizzazioni per elencare gli eventi, riceverai il seguente errore PERMISSION_DENIED.

{
  "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"
        }
      }
    ]
  }
}

Passaggi successivi

Consulta le istruzioni su come estrarre le informazioni sugli eventi per progetto o organizzazione utilizzando l'API Service Health.