Stackdriver监控,未授权完全访问范围

cod*_*ped 4 google-compute-engine google-cloud-platform stackdriver

部署具有完整API访问权限并安装Stackdriver代理的全新Google Compute Engine实例后,Monitoring不显示代理的任何指标.

根据" 安装代理"手册,不需要进一步设置(例如手动配置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.
Run Code Online (Sandbox Code Playgroud)

Google Cloud Console显示具有以下内容的实例:

Cloud API access scopes
This instance has full API access to all Google Cloud services.
Run Code Online (Sandbox Code Playgroud)

并在实例中运行以下命令显示:

$ 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
Run Code Online (Sandbox Code Playgroud)

什么出错了?

cod*_*ped 6

我想到了:

您必须启用Google Monitoring APIin API Manager,默认情况下不启用.无需指定API密钥,即可获取默认的应用程序凭据.

有趣的是,我有两个项目,其中也使用为Stackdriver监测自今年年初和那些做要求将启用谷歌监测API.

  • 启用 Google Cloud Monitoring API 也是我的答案。我无法在“API Manager”网络应用程序中浏览到它,我必须搜索它,这将我带到此链接 https://console.cloud.google.com/apis/api/cloudmonitoring.googleapis.com /overview 正如 @Jaap 所说,这只发生在较旧的虚拟机上。不过,此修复比重建虚拟机更好。谢谢你们俩。 (2认同)