本文說明 Personalized Service Health 發生中斷時的因應措施。
Personalized Service Health 可能會受到事件影響,部分或完全無法運作。您可以透過 Status API 資源和 Google CloudService Health 資訊主頁,查看 Service Health 的事件、處理問題和效能問題。
使用 Status API
Service Health API 的 Status API 資源會告知您特定 Service Health 功能是否發生問題。
事前準備
如要開始使用 Status API,請按照下列步驟操作:
- 為您要用來存取這項狀態的專案或機構啟用 Service Health API。
-
Make sure that billing is enabled for your Google Cloud project.
- 設定存取 Service Health API 的權限。
在專案或機構中設定 Identity and Access Management (IAM) 權限,即可使用 Status API。
如要設定專案的權限,請執行下列指令:
gcloud projects add-iam-policy-binding PROJECT_ID \ --member {USER|GROUP|SERVICE_ACCOUNT} \ --role roles/servicehealth.viewer
如要設定機構的權限,請執行下列指令:
gcloud organizations add-iam-policy-binding ORGANIZATION_ID \ --member {USER|GROUP|SERVICE_ACCOUNT} \ --role roles/servicehealth.viewer
如要取得 ORGANIZATION_ID,請參閱「取得機構資源 ID」。
機構中所有專案都會沿用機構的 IAM 政策。這些政策可讓您存取整個機構的機構和專案事件 API。
參考資料
如要瞭解可用的方法和回應中欄位的意義,請參閱 Status API 參考資料。
設定產品或位置時,請使用 Google Cloud 產品和位置中的值。
使用專案 ID 取得 Service Health 狀態
如要使用專案 ID 取得服務健康狀態,請使用下列要求:
GET https://servicehealth.googleapis.com/v1beta/projects/PROJECT_ID/locations/global/status
如果狀態值為 OK
,要求會產生下列回應:
{
"state": "OK",
}
這個狀態表示使用專案 ID 存取的功能 (例如事件或影響) 沒有內部問題。
如果狀態值為 ISSUES_DETECTED
,要求會產生下列回應:
{
"state": "ISSUES_DETECTED",
"issues": [
{
"message": "We are experiencing problems creating new events",
"details": {
"API": "events"
}
},
{
"message": "We are experiencing problems creating new impacts",
"details": {
"API": "impacts"
}
}
]
}
ISSUES_DETECTED
狀態也會傳回一組問題,指出使用專案 ID 存取的特徵可能不準確。
如果沒有取得狀態的權限,就會收到 PERMISSION_DENIED
錯誤。
{
"error": {
"code": 403,
"message": "Permission 'servicehealth.statuses.get' denied on resource '//servicehealth.googleapis.com/projects/PROJECT_ID/locations/global/status' (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/status",
"permission": "servicehealth.statuses.get"
}
}
]
}
}
使用機構 ID 取得服務健康狀態
如要取得狀態,請使用下列要求:
GET https://servicehealth.googleapis.com/v1beta/organizations/ORGANIZATION_ID/locations/global/status
如果服務健康狀態正常運作,狀態應會產生下列回應:
{
"state": "OK",
}
如果服務健康狀態發生可能影響準確度或功能的相關問題,狀態應會產生 ISSUES_DETECTED
狀態的回應:
{
"state": "ISSUES_DETECTED",
"issues": [
{
"message": "We are experiencing problems creating new organization level events",
"details": {
"API": "organizationEvents"
}
},
{
"message": "We are experiencing problems creating new organization level impacts",
"details": {
"API": "organizationImpacts"
}
}
]
}
如果沒有取得狀態的權限,就會收到 PERMISSION_DENIED
錯誤。
{
"error": {
"code": 403,
"message": "Permission 'servicehealth.statuses.get denied on resource '//servicehealth.googleapis.com/organizations/ORGANIZATION_ID/locations/global/status' (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/status",
"permission": "servicehealth.statuses.get"
}
}
]
}
}
檢查 Google Cloud 服務健康狀態
Google Cloud Service Health 會顯示 Personalized Service Health 是否發生問題。你也可以使用 RSS 動態消息來取用資料。
如要進一步瞭解 Google Cloud Service Health,請參閱「事件和 Google Cloud Service Health」。