[[["容易理解","easyToUnderstand","thumb-up"],["確實解決了我的問題","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["難以理解","hardToUnderstand","thumb-down"],["資訊或程式碼範例有誤","incorrectInformationOrSampleCode","thumb-down"],["缺少我需要的資訊/範例","missingTheInformationSamplesINeed","thumb-down"],["翻譯問題","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["上次更新時間:2025-09-03 (世界標準時間)。"],[],[],null,["# Troubleshoot missing notifications\n\nThis page explains why you might not receive notifications as expected,\nand offers possible remedies for those situations.\n\nNotifications aren't received\n-----------------------------\n\nIf you don't receive any notifications through any configured\nnotification channels, then do the following:\n\n1. In the Google Cloud console, go to the **Logs Explorer** page:\n\n [Go to **Logs Explorer**](https://console.cloud.google.com/logs/query)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Logging**.\n2. Select the appropriate Google Cloud project.\n3. Query the logs for notification channel events:\n\n 1. Expand the **Log name** menu, and select **notification_channel_events**.\n 2. Expand the **Severity** menu and select **Error**.\n 3. Optional: To select a custom time range, use the time-range selector.\n 4. Click **Run query**.\n\n The previous steps create the following query: \n\n resource.type:\"stackdriver_notification_channel\"\n logName=\"projects/\u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e/logs/monitoring.googleapis.com%2Fnotification_channel_events\"\n severity=ERROR\n\n The summary line and the `jsonPayload` field typically contain failure\n information. For example, when a gateway error occurs, the summary line\n includes \"failed with 502 Bad Gateway\".\n\nWebhook notifications aren't received\n-------------------------------------\n\nThis section applies when you don't receive notifications through a configured\nwebhook notification channel.\n\n### Private endpoint\n\nIf you have a private endpoint, then use\n[Pub/Sub notifications](/monitoring/support/notification-options#pubsub)\ncombined with a [pull subscription](/pubsub/docs/pull) to that notification topic.\nYou can't use webhooks for notifications to private endpoints.\n\nWhen you configure a Pub/Sub notification channel, incident\nnotifications are sent to a Pub/Sub queue that has Identity and Access Management\ncontrols. Any service that can query for, or listen to, a Pub/Sub topic\ncan consume these notifications. For example, applications running on\nApp Engine, Cloud Run, or Compute Engine virtual machines can\nconsume these notifications.\n\nIf you use a pull subscription, then a request is sent to Google that waits for\na message to arrive. These subscriptions require access to Google but they\ndon't require rules for firewalls or inbound access.\n\n### Public endpoint\n\nTo identify why the delivery failed, examine your Cloud Logging log entries\nfor failure information.\n\nFor example, you can search for log entries for the notification channel\nresource by using the Logs Explorer, with a filter like the following:\n\n\u003cbr /\u003e\n\n```\nresource.type=\"stackdriver_notification_channel\"\n```\n\n\u003cbr /\u003e\n\nPub/Sub notifications aren't received\n-------------------------------------\n\nIf you don't receive notifications through a configured\nPub/Sub notification channel, then try the following:\n\n- Ensure that the notifications service account exists. Notifications aren't\n sent when the service account has been deleted.\n\n To verify that the service account exists, do the following:\n 1. In the Google Cloud console, go to the **IAM** page:\n\n [Go to **IAM**](https://console.cloud.google.com/iam-admin/iam)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **IAM \\& Admin**.\n 2. Search for a service account that has the following naming convention:\n\n ```\n service-PROJECT_NUMBER@gcp-sa-monitoring-notification.iam.gserviceaccount.com\n ```\n\n If this service account isn't listed, then select\n **Include Google-provided role grants**.\n\n If the notifications service account doesn't exist, then you must\n begin the process of creating the Pub/Sub notification channel\n for Monitoring to create the service account:\n 1. In the Google Cloud console, go to the\n *notifications* **Alerting** page:\n\n [Go to **Alerting**](https://console.cloud.google.com/monitoring/alerting)\n\n \u003cbr /\u003e\n\n If you use the search bar to find this page, then select the result whose subheading is\n **Monitoring**.\n 2. Click **Edit notification channels**.\n 3. In the **Pub/Sub** section, click **Add new**.\n\n Monitoring creates the notifications service account\n when one doesn't exist. The **Create Pub/Sub Channel** dialog\n shows the name of the notifications service account.\n | **Note:** You don't need to finish creating the Pub/Sub notification channel for Monitoring to create the notifications service account.\n 4. If you don't want to add a notification channel, click **Cancel** .\n Otherwise, finish creating the notification channel and click\n **Add channel**.\n\n 5. Grant the service account permissions to publish your Pub/Sub\n topics:\n\n 1. In a new browser tab, open the [Create a notification channel](/monitoring/support/notification-options#creating_channels) document.\n 2. Select the **Pub/Sub** tab, and then follow the steps in the **Authorize service account** section of the page.\n- Ensure that the notifications service account has been authorized to\n send notifications for the Pub/Sub topics of interest.\n\n To view the permissions for a service account, you can use the\n Google Cloud console or the Google Cloud CLI command:\n - The **IAM** page in the Google Cloud console lists the roles for each service account.\n - The Pub/Sub **Topics** page in the Google Cloud console, lists each topic. When you select a topic, the **Permissions** tab lists the roles granted to service accounts.\n - To list all service accounts and their roles, run the following\n Google Cloud CLI command:\n\n gcloud projects get-iam-policy \u003cvar translate=\"no\"\u003ePROJECT_ID\u003c/var\u003e\n\n The following is a partial response for this command: \n\n ```\n serviceAccount:service-PROJECT_NUMBER@gcp-sa-monitoring-notification.iam.gserviceaccount.com\n role: roles/monitoring.notificationServiceAgent\n - members:\n [...]\n role: roles/owner\n - members:\n - serviceAccount:service-PROJECT_NUMBER@gcp-sa-monitoring-notification.iam.gserviceaccount.com\n role: roles/pubsub.publisher\n ```\n\n The command response includes only roles, it doesn't include per-topic\n authorization.\n - To list the IAM bindings for a specific topic, run the\n following command:\n\n \u003cbr /\u003e\n\n gcloud pubsub topics get-iam-policy \u003cvar translate=\"no\"\u003eTOPIC\u003c/var\u003e\n\n The following is a sample response for this command: \n\n ```\n bindings:\n - members:\n - serviceAccount:service-PROJECT_NUMBER@gcp-sa-monitoring-notification.iam.gserviceaccount.com\n role: roles/pubsub.publisher\n etag: BwXPRb5WDPI=\n version: 1\n ```\n\n For information about how to authorize the notifications service account,\n see [Authorize service account](/monitoring/support/notification-options#auth-pubsub-service-account).\n\nYou aren't notified when a VM shuts down\n----------------------------------------\n\nTo get notified when a virtual machine (VM) shuts down, create an\n[uptime check](/monitoring/alerts/uptime-checks) to periodically interrogate the VM and then\ncreate an alerting policy to monitor that uptime check.\nIf you are using a [Virtual Private Cloud (VPC)](/vpc/docs), then you\nmight need to create a [private uptime check](/monitoring/uptime-checks/private-checks).\n\nAn alerting policy that monitors the\n[`compute.googleapis.com/instance/uptime`](/monitoring/api/metrics_gcp_c#compute/instance/uptime) metric or\nwon't notify you when the VM shuts down. For this metric,\nalerting policies only monitor time series for VM instances that are in the\n`RUNNING` state. If a VM is in any other state, such as `STOPPED` or `DELETED`,\nthen they aren't monitored. For information on VM instance states, see\n[VM instance life cycle](/compute/docs/instances/instance-life-cycle).\n\nNotifications for request-count alerting policies aren't received\n-----------------------------------------------------------------\n\nIf you don't receive notifications for an alerting policy that monitors the\n[`serviceruntime.googleapis.com/api/request_count`](/monitoring/api/metrics_gcp_p_z#gcp-serviceruntime) metric,\nthen make sure that the policy's [alignment period](/monitoring/alerts/concepts-indepth#alignment-period) is no more\nthan 7 hours 30 minutes.\n\nSMS notification messages or verification codes aren't received\n---------------------------------------------------------------\n\nIf you don't receive SMS notifications or verification codes, then make sure\nthat you haven't reached the [SMS message limit](/monitoring/quotas#sms_limits). There might be\nlogs that confirm this error. Check your logs for `Denied quota token`.\n\nAs a general recommendation, we discourage relying solely on SMS channels for\nnotifications. SMS notifications are offered on a \"best effort\" basis."]]