管理影響機構的事件

本文說明如何使用 Service Health API 管理影響貴機構的事件。

Personalized Service Health 提供 OrganizationEvents 和 OrganizationImpacts API 資源,可讓您取得影響貴機構的事件資訊。這類資訊包括:

  • 可能影響機構中一或多個專案的服務健康狀態事件。
  • 可能或已受到影響的專案清單。

事前準備

  1. 為機構底下的至少一個專案啟用 Service Health API。OrganizationEvents 和 OrganizationImpacts API 資源只會取得已啟用 Service Health API 的專案資訊。
  2. Make sure that billing is enabled for your Google Cloud project.

  3. 設定存取 Service Health API 的權限
  4. 在機構中設定身分與存取權管理 (IAM) 權限,以便使用 OrganizationEvents 和 OrganizationImpacts API 資源。執行下列指令:

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

    如要取得 ORGANIZATION_ID,請參閱「取得機構資源 ID」。

    機構中所有專案都會繼承機構的 IAM 政策。這些政策可讓您存取整個機構的機構和專案事件 API。

參考資料

如要瞭解可使用的方法,以及回應中欄位的意義,請參閱 OrganizationEventsOrganizationImpacts API 參考資料。

設定產品或位置時,請使用 Google Cloud productslocations 中的值。

列出機構中可能受事件影響的專案

請參閱快速入門導覽課程

列出機構的所有未解決事件

請參閱快速入門導覽課程

取得影響機構的事件詳細資料

您可以使用 Get API,查看影響機構的事件詳細資訊。

使用任何要求資料之前,請先替換以下項目:

  • API_VERSION:要使用的 API 版本。使用 v1v1beta
  • ORGANIZATION_ID:您的 Google Cloud 機構 ID。
  • EVENT_ID:事件的 ID。

HTTP 方法和網址:

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

如要修正這項錯誤,請設定必要權限

取得可能受事件影響的機構專案詳細資料

對於特定事件,專案和機構事件的事件 ID 保持不變。OrganizationImpact 包含 EVENT_IDPROJECT_NUMBER,可用於取得影響專案的事件詳細資料。這些詳細資料包括 staterelevance

PROJECT_NUMBER 可與 Get API 傳回的 PROJECT_ID 互換。