具有完整访问权限的 Stackdriver Monitoring 未经授权

Stackdriver Monitoring with full access scope not authorized

部署具有完全 API 访问权限的全新 Google Compute Engine 实例并安装 Stackdriver 代理后,监控未显示来自该代理的任何指标。

根据 Install Agent 手册,不需要进一步的设置(例如手动配置 API 键)。

代理服务状态也显示如下错误:

$ systemctl status stackdriver-agent
Jul 13 10:14:00 host stackdriver-agent[21203]: [  OK  ]
Jul 13 10:14:00 host systemd[1]: Started LSB: start and stop Stackdriver Agent.
Jul 13 10:14:00 host collectd[21226]: Initialization complete, entering read-loop.
Jul 13 10:14:00 host collectd[21226]: match_throttle_metadata_keys: 1 history entries, 1 distinct keys, 46 bytes server memory.
Jul 13 10:14:00 host collectd[21226]: tcpconns plugin: Reading from netlink succeeded. Will use the netlink method from now on.
Jul 13 10:14:00 host collectd[21226]: write_gcm: Asking metadata server for auth token
Jul 13 10:14:01 host collectd[21226]: write_gcm: Unsuccessful HTTP request 403: {
                                               "error": {
                                                 "code": 403,...
Jul 13 10:14:01 host collectd[21226]: write_gcm: Error talking to the endpoint.
Jul 13 10:14:01 host collectd[21226]: write_gcm: wg_transmit_unique_segment failed.
Jul 13 10:14:01 host collectd[21226]: write_gcm: wg_transmit_unique_segments failed. Flushing.

Google Cloud Console 显示实例具有:

Cloud API access scopes
This instance has full API access to all Google Cloud services.

和运行实例中的以下命令显示:

$ curl --silent -f -H "Metadata-Flavor: Google" http://169.254.169.254/computeMetadata/v1/instance/service-accounts/default/scopes
https://www.googleapis.com/auth/cloud-platform

有什么问题吗?

我想通了:

您必须 enable API Manager 中的 Google Monitoring API,默认情况下未启用。无需指定 API 密钥,默认的应用程序凭据已被选取。

有趣的是,我有两个项目从今年年初开始也使用 Stackdriver Monitoring,而那些 不需要 需要启用 Google Monitoring API .