במאמר הזה מוסבר איך להציג רשימה של אירועים ב-"Service Health בהתאמה אישית" שעשויים להשפיע או שהשפיעו על מוצרי Google Cloud בפרויקט או בארגון ב- Google Cloud . אתם תשתמשו ב-Personalized Service Health API.
לפני שמתחילים
-
מפעילים את Service Health API, אם הוא עדיין לא מופעל:
התפקידים שנדרשים כדי להפעיל ממשקי API
כדי להפעיל ממשקי API, צריך את ההרשאה
serviceusage.services.enable. אם אתם יצרתם את הפרויקט, סביר להניח שכבר יש לכם את ההרשאה הזו דרך התפקיד "בעלים" (roles/owner). אחרת, תוכלו לקבל את ההרשאה הזו דרך התפקיד "אדמין בממשק 'שימוש בשירות'" (roles/serviceusage.serviceUsageAdmin). איך מקצים תפקידיםgcloud services enable servicehealth.googleapis.com
- אם משתמשים בפרויקט קיים, מוודאים שיש את ההרשאות הנדרשות כדי להשלים את ההדרכה. אם משתמשים בפרויקט חדש, לא צריך לוודא כי כבר יש את ההרשאות הנדרשות.
התפקידים הנדרשים
כדי לקבל את ההרשאות שנדרשות להצגת רשימת האירועים ב-Service Health, צריך לבקש מהאדמין את התפקיד צפייה ב-Service Health בהתאמה אישית (roles/servicehealth.viewer) ב-IAM ברמת הפרויקט או הארגון, בהתאם.
כדי לקרוא הסבר על מתן תפקידים, ראו איך מנהלים את הגישה ברמת הפרויקט, התיקייה והארגון.
יכול להיות שאפשר לקבל את ההרשאות הנדרשות גם באמצעות תפקידים בהתאמה אישית או תפקידים מוגדרים מראש.
קובצי עזר
במאמרי העזרה של ה-API בנושאים Events (v1, v1beta), Impacts (v1beta), OrganizationEvents (v1, v1beta) ו-OrganizationImpacts (v1, v1beta) מפורטות השיטות שבהן אפשר להשתמש ומשמעות השדות בתגובה.
כשמגדירים את המוצר או המיקום, משתמשים בערכים שמופיעים ב-Google Cloud products וב-locations.
הצגת רשימה של כל האירועים הפעילים בפרויקט
אתם יכולים להציג רשימה של כל האירועים ב- Google Cloud בפרויקט ספציפי ב- Google Cloud .
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- API_VERSION: גרסת ה-API שבה ייעשה שימוש. אפשר להשתמש ב-
v1או ב-v1beta. - PROJECT_ID: מזהה הפרויקט
ה-method של ה-HTTP וכתובת ה-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}כדי לשלוח את הבקשה צריך להרחיב אחת מהאפשרויות הבאות:
אתם אמורים לקבל תגובת JSON שדומה לזו:
{
"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"
}
אם אין לכם את ההרשאות הנדרשות להצגת אירועים, תופיע השגיאה 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"
}
}
]
}
}
הצגת רשימה של כל האירועים הפעילים בארגון
אתם יכולים להציג רשימה של כל האירועים ב- Google Cloud שמשפיעים על פרויקטים שבהם מופעל "Service Health בהתאמה אישית" בארגון הספציפי ב- Google Cloud .
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- API_VERSION: גרסת ה-API שבה ייעשה שימוש. אפשר להשתמש ב-
v1או ב-v1beta. - ORGANIZATION_ID: מזהה הארגון ב-Google Cloud.
- PROJECT_ID: מזהה הפרויקט שמשמש למכסות ולחיוב.
ה-method של ה-HTTP וכתובת ה-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}כדי לשלוח את הבקשה צריך להרחיב אחת מהאפשרויות הבאות:
אתם אמורים לקבל תגובת JSON שדומה לזו:
{
"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"
}
כדי לקבל את הערך של ORGANIZATION_ID, תוכלו להיעזר בהוראות למציאת המזהה של משאב הארגון.
אם אין לכם הרשאות להצגת אירועים, תופיע השגיאה 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"
}
}
]
}
}
הצגת רשימת הפרויקטים בארגון שעשויים להיות מושפעים מאירוע מסוים
אתם יכולים להציג רשימה של כל הפרויקטים בארגון ספציפי ב- Google Cloud , שבהם:
- יכול להיות שהמסלול יושפע מאירוע (
OrganizationImpact). - הפעילו את "המרכז האישי ב-Service Health".
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- API_VERSION: גרסת ה-API שבה ייעשה שימוש. אפשר להשתמש ב-
v1או ב-v1beta. - EVENT_ID: המזהה של האירוע שעשוי להשפיע על הארגון.
- ORGANIZATION_ID: מזהה הארגון ב-Google Cloud.
- PROJECT_ID: מזהה הפרויקט שמשמש למכסות ולחיוב.
ה-method של ה-HTTP וכתובת ה-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}כדי לשלוח את הבקשה צריך להרחיב אחת מהאפשרויות הבאות:
אתם אמורים לקבל תגובת JSON שדומה לזו:
{
"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"
}
אם אין לכם הרשאות להצגת רשימת אירועים, תופיע השגיאה הבאה של 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"
}
}
]
}
}
הצגת רשימה של המשאבים המושפעים בפרויקט
במוצרים Google Cloud נתמכים, אתם יכולים להציג רשימה של משאבי Google Cloud ספציפיים בפרויקט שמושפעים מאירוע ב-Service Health.
כדי להציג רשימה של המשאבים המושפעים, צריך להפעיל את Service Health API (servicehealth.googleapis.com) בפרויקט לפחות 24 שעות לפני תחילת האירוע, ולחשבון המשתמש צריכה להיות ההרשאה servicehealth.impacts.list (שכלולה ב-roles/servicehealth.viewer).
API בארכיטקטורת REST (v1beta)
כדי להציג רשימה של המשאבים המושפעים בפרויקט, שולחים בקשה ל-Service Health API עם הפרמטרים הבאים:
| פרמטר | ערך | תיאור |
|---|---|---|
parent |
projects/PROJECT_ID/locations/global |
חובה. מזהה הפרויקט או מספר הפרויקט שבו רוצים להציג את המשאבים שהושפעו. |
pageSize |
1 עד 100 | זה שינוי אופציונלי. המספר המקסימלי של השפעות שיוחזרו בכל דף. אם לא מציינים ערך, ברירת המחדל היא 10. |
pageToken |
מחרוזת | זה שינוי אופציונלי. טוקן מ-ListImpactsResponse קודם לאחזור של דף התוצאות הבא. |
filter |
מחרוזת | זה שינוי אופציונלי. ביטוי סינון כדי להגדיר את היקף ההשפעות שמוחזרות. לדוגמה, כדי להציג רשימה של משאבים שהושפעו מאירוע ספציפי, מגדירים את filter=events:projects/PROJECT_ID/locations/global/events/EVENT_ID. |
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הערכים בשדות הבאים:
-
PROJECT_ID: השם או המזהה של הפרויקט שלכם ב-Google Cloud.
ה-method של ה-HTTP וכתובת ה-URL:
GET https://servicehealth.googleapis.com/v1beta/projects/PROJECT_ID/locations/global/impacts
כדי להשתמש ב-curl, צריך להפעיל את נקודת הקצה (endpoint) של GET ישירות:
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://servicehealth.googleapis.com/v1beta/projects/PROJECT_ID/locations/global/impacts"
gcloud
מריצים את הפקודה הבאה כדי להציג את רשימת המשאבים שהושפעו בפרויקט:
gcloud beta service-health impacts list \
--project=PROJECT_ID \
--location=global
כדי להציג רק את המשאבים שמושפעים מאירוע ספציפי, מעבירים את הדגל --filter:
gcloud beta service-health impacts list \
--project=PROJECT_ID \
--location=global \
--filter="events:projects/PROJECT_ID/locations/global/events/EVENT_ID"
אם הבקשה תאושר, גוף התגובה יכלול רשימה של אובייקטים מסוג Impact, כמו בדוגמה הבאה:
{
"impacts": [
{
"name": "projects/my-project/locations/global/impacts/f9a8b7c6-d5e4-4f3a-9b2c-1d0e9f8a7b6c",
"events": [
"projects/my-project/locations/global/events/1234567890abcdef"
],
"asset": {
"assetName": "//cloudsql.googleapis.com/projects/9876543210/instances/prod-orders-db",
"assetType": "sqladmin.googleapis.com/Instance"
},
"description": "Instance experienced elevated connection errors during regional network disruption.",
"createTime": "2026-10-08T14:12:05.120450Z",
"updateTime": "2026-10-08T14:12:05.120450Z"
}
]
}
דוגמאות למסננים נפוצים למשאבים שהושפעו
אפשר להעביר פרמטר של שאילתת filter (או --filter ב-Google Cloud CLI) כדי לצמצם את רשומות ה-Impact שמוחזרות:
- הצגת רשימה של המשאבים שהושפעו מאירוע ספציפי:
filter=events:projects/PROJECT_ID/locations/global/events/EVENT_ID - רשימת המשאבים המושפעים מסוג משאב ספציפי (לדוגמה, מכונות Cloud SQL):
filter=asset.assetType="sqladmin.googleapis.com/Instance" - הצגת רשימה של משאבים שהושפעו ועודכנו אחרי חותמת זמן ספציפית:
filter=updateTime>"2026-10-08T00:00:00Z"
קבלת פרטים על משאב מושפע
אפשר לאחזר רשומת Impact ספציפית באמצעות IMPACT_ID שלה.
API בארכיטקטורת REST (v1beta)
כדי לקבל פרטים על רשומת משאב ספציפית שהושפעה, שולחים בקשה עם הפרמטר הבא:
| פרמטר | ערך | תיאור |
|---|---|---|
name |
projects/PROJECT_ID/locations/global/impacts/IMPACT_ID |
חובה. השם המלא של משאב הרשומה מסוג Impact שרוצים לאחזר. |
ה-method של ה-HTTP וכתובת ה-URL:
GET https://servicehealth.googleapis.com/v1beta/projects/PROJECT_ID/locations/global/impacts/IMPACT_ID
curl -X GET \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json; charset=utf-8" \ "https://servicehealth.googleapis.com/v1beta/projects/PROJECT_ID/locations/global/impacts/IMPACT_ID"
gcloud
מריצים את הפקודה הבאה כדי לקבל פרטים על רשומת משאב שהושפעה:
gcloud beta service-health impacts describe IMPACT_ID \
--project=PROJECT_ID \
--location=global
אם הבקשה מצליחה, גוף התגובה מכיל אובייקט Impact:
{
"name": "projects/my-project/locations/global/impacts/f9a8b7c6-d5e4-4f3a-9b2c-1d0e9f8a7b6c",
"events": [
"projects/my-project/locations/global/events/1234567890abcdef"
],
"asset": {
"assetName": "//cloudsql.googleapis.com/projects/9876543210/instances/prod-orders-db",
"assetType": "sqladmin.googleapis.com/Instance"
},
"description": "Instance experienced elevated connection errors during regional network disruption.",
"createTime": "2026-10-08T14:12:05.120450Z",
"updateTime": "2026-10-08T14:12:05.120450Z"
}
המאמרים הבאים
במדריכים הבאים מוסבר איך לשלוף פרטי אירועים לפי פרויקט או ארגון באמצעות Service Health API.