ב-Service Health בהתאמה אישית יש את המשאבים OrganizationEvents ו-OrganizationImpacts ב-API, שמאפשרים לקבל מידע על אירועים שמשפיעים על הארגון. המידע כולל:
- אירועים ב-Service Health שעשויים להשפיע על פרויקט אחד או יותר בארגון.
- רשימת הפרויקטים שמושפעים או עלולים להיות מושפעים מאירוע שמשפיע על הארגון.
במאמר הצגת אירועים ברמת הארגון במסוף Google Cloud מוסבר איך מציגים אירועים ברמת הארגון במסוף Google Cloud .
לפני שמתחילים
- מפעילים את Service Health API בפרויקט אחד לפחות בארגון. המשאבים OrganizationEvents ו-OrganizationImpacts ב-API מקבלים מידע רק על פרויקטים שבהם Service Health API מופעל.
- מגדירים הרשאות גישה ל-Service Health API.
כדי להשתמש במשאבי ה-API OrganizationEvents ו-OrganizationImpacts, צריך להגדיר הרשאות לניהול זהויות והרשאות גישה (IAM) בארגון. מריצים את הפקודה הבאה:
gcloud organizations add-iam-policy-binding $ORGANIZATION_ID \ --member {USER|GROUP|SERVICE_ACCOUNT} \ --role roles/servicehealth.viewerכדי לקבל את הערך של ORGANIZATION_ID, אפשר לעיין במאמר קבלת מזהה המשאב של הארגון.
כללי מדיניות ה-IAM שמוגדרים בארגון עוברים בירושה לכל הפרויקטים בארגון. כללי המדיניות האלה מאפשרים לכם לגשת לממשקי ה-API של אירועים ברמת הארגון וברמת הפרויקט בכל הארגון.
קובצי עזר
במאמרי העזרה של ה-API בנושא OrganizationEvents ו-OrganizationImpacts מפורטות השיטות שבהן אפשר להשתמש ומשמעות השדות בתגובה.
בתגובה מה-API, כל רשומה ברשימה impact כוללת את state (AFFECTED או RESOLVED), startTime ו-endTime (כשהבעיה נפתרה) לכל מוצר ומיקום שהושפעו.
כשמגדירים את המוצר או המיקום, משתמשים בערכים שמופיעים ב-Google Cloud products וב-locations.
הצגת רשימת הפרויקטים בארגון שעשויים להיות מושפעים מאירוע מסוים
רשימה של כל האירועים הפעילים בארגון
קבלת פרטים על אירוע שמשפיע על ארגון
אתם יכולים להשתמש ב-Get API כדי לראות מידע מפורט על אירוע שמשפיע על הארגון.
לפני שמשתמשים בנתוני הבקשה, צריך להחליף את הנתונים הבאים:
- API_VERSION: גרסת ה-API שבה ייעשה שימוש. אפשר להשתמש ב-
v1או ב-v1beta. - ORGANIZATION_ID: מזהה הארגון ב-Google Cloud.
- EVENT_ID: מזהה האירוע.
- PROJECT_ID: מזהה הפרויקט שמשמש למכסות ולחיוב.
ה-method של ה-HTTP וכתובת ה-URL:
GET https://servicehealth.googleapis.com/API VERSION/organizations/ORGANIZATION_ID/locations/global/organizationEvents/EVENT_ID
כדי לשלוח את הבקשה צריך להרחיב אחת מהאפשרויות הבאות:
אתם אמורים לקבל תגובת JSON שדומה לזו:
{
"name": "organizations/ORGANIZATION_ID/locations/global/organizationEvents/EVENT_ID",
"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 as of Tuesday, 2022-10-18 11:00 US/Pacific. We thank you for your patience while we worked on resolving the issue.",
"category": "INCIDENT",
"detailedCategory": "CONFIRMED_INCIDENT",
"state": "CLOSED",
"detailedState": "RESOLVED",
"eventImpacts": [
{
"product": {
"productName": "Google Cloud SQL",
"id": "hV87iK5DcEXKgWU2kDri",
},
"location": {
"locationName": "us-central1",
}
}
],
"updates": [
{
"updateTime": "2022-10-18T17:41:20.112287Z",
"title": "We are experiencing a connectivity issue affecting Google Cloud SQL in us-east1, australia-southeast2.",
"description": "We are experiencing an intermittent issue with Google Cloud SQL. Our engineering team continues to investigate the issue.",
"symptom": "None at this time.",
"workaround": "None at this time."
},
{
"updateTime": "2022-10-18T18:00:05.690761Z",
"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 as of Tuesday, 2022-10-18 11:00 US/Pacific.\n\nWe thank you for your patience while we worked on resolving the issue.",
"symptom": "None at this time.",
"workaround": "None at this time."
}
],
"updateTime": "2022-10-18T18:00:05.690761Z",
"startTime": "2022-10-18T17:41:20.112287Z",
"endTime": "2022-10-18T18:00:05.690761Z",
}
אם אין לכם הרשאות לקבלת אירועים, תופיע השגיאה הבאה ב-PERMISSION_DENIED.
{
"error": {
"code": 403,
"message": "Permission 'servicehealth.organizationEvents.get' denied on resource '//servicehealth.googleapis.com/organizations/ORGANIZATION_ID/locations/global/organizationEvents/EVENT_ID' (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/organizationEvents/EVENT_ID",
"permission": "servicehealth.organizationEvents.get"
}
}
]
}
}
כדי לפתור את השגיאה, צריך להגדיר את ההרשאות הנדרשות.
קבלת פרטים על פרויקט בארגון שעשוי להיות מושפע מאירוע
באירוע נתון, מזהה האירוע נשאר זהה בין האירועים של הפרויקט והארגון.
OrganizationImpact מכיל EVENT_ID ו-PROJECT_NUMBER, שבהם אפשר להשתמש כדי לקבל פרטים על אירוע שמשפיע על הפרויקט. הפרטים האלה כוללים את state ו-relevance.
אפשר להחליף את PROJECT_NUMBER ב-PROJECT_ID, שמוחזר על ידי Get API.