Questo documento spiega come elencare gli eventi di stato del servizio che potrebbero influire o aver influito sui prodotti Google Cloud nel tuo progetto o nella tua organizzazione Google Cloud . Utilizzerai l'API Service Health.
Prima di iniziare
-
Enable the Service Health API:
Roles required to enable APIs
To enable APIs, you need the Service Usage Admin IAM role (
roles/serviceusage.serviceUsageAdmin), which contains theserviceusage.services.enablepermission. Learn how to grant roles.gcloud services enable servicehealth.googleapis.com
-
Verify that billing is enabled for your Google Cloud project.
- Se utilizzi un progetto esistente per questa guida, verifica di disporre delle autorizzazioni necessarie per completare la guida. Se hai creato un nuovo progetto, disponi già delle autorizzazioni necessarie.
Ruoli obbligatori
Per ottenere le autorizzazioni necessarie per elencare gli eventi di Service Health, chiedi all'amministratore di concederti il ruolo IAM Personalized Service Health Viewer (roles/servicehealth.viewer) sul progetto o sull'organizzazione per cui vuoi elencare gli eventi.
Per saperne di più sulla concessione dei ruoli, consulta Gestisci l'accesso a progetti, cartelle e organizzazioni.
Potresti anche riuscire a ottenere le autorizzazioni richieste tramite i ruoli personalizzati o altri ruoli predefiniti.
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 sostituzioni seguenti:
- API_VERSION: la versione dell'API da utilizzare. Utilizza
v1ov1beta. - PROJECT_ID: l'ID del 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"
}
}
]
}
}
Elenca tutti gli incidenti attivi per un'organizzazione
Puoi elencare tutti gli Google Cloud incidenti che interessano qualsiasi progetto che ha abilitato Personalized Service Health nell'organizzazione Google Cloud specifica.
Prima di utilizzare i dati della richiesta, apporta le sostituzioni seguenti:
- API_VERSION: la versione dell'API da utilizzare. Utilizza
v1ov1beta. - 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 Recuperare 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 in 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 sostituzioni seguenti:
- API_VERSION: la versione dell'API da utilizzare. Utilizza
v1ov1beta. - 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 guide su come estrarre le informazioni sugli eventi per progetto o organizzazione utilizzando l'API Service Health.