每当我使用Stackdriver监控和监控代理设置Google Dataproc集群时,我都会注意到,每当Dataproc获得作业时,Stackdriver就会失去连接。在stackdriver UI上,它有一个延迟值,他们说在大多数情况下不应该高于2分钟。对我来说,这个值只是我提交作业以来的时间(通常是几个小时),并且没有在Compute Engine网页中看不到的可用指标。
有没有办法让stackdriver监控和dataproc一起工作?如果可能的话,我希望能够监控作业的RAM使用情况。
Stackdriver监控是由我的组织运行和设置的,但他们似乎可以访问所有功能。我们不使用HTTP代理。监控代理是使用Google's documentation中的命令设置的。我有一个启动脚本(--initialization-actions标志),它同时为主进程和从属进程运行,如下所示:
#!/bin/bash
cd /tmp
curl -O "https://repo.stackdriver.com/stack-install.sh"
bash stack-install.sh --write-gcm
# ... other initialization stuffs编辑:"other initialization stuffs“只是几个gsutil copy命令,用于将一些资源文件复制到本地机器上。
我尝试将代理的安装移到其他命令之后,我只使用/tmp,因为谷歌建议在复制文件时使用绝对路径(忘记了文档在哪里,但它以前对我很有帮助)。
这是我在stackdriver中看到的截图。请注意,CPU使用率以外的所有指标都停在垂直线上。这就是今天提交给spark的作业:
Stackdriver screenshot
grep stackdriver-agent /var/logs/syslog的结果
Sep 2 13:31:53 <cluster-name>-m stackdriver-agent[3609]: Starting Stackdriver metrics collection agent: stackdriver-agentoption = Hostname; value = 3431688934917455875;
Sep 2 13:31:53 <cluster-name>-m stackdriver-agent[3609]: option = Interval; value = 60.000000;
Sep 2 13:31:53 <cluster-name>-m stackdriver-agent[3609]: Created new plugin context.
Sep 2 13:31:53 <cluster-name>-m stackdriver-agent[3609]: option = PIDFile; value = /var/run/stackdriver-agent.pid;
Sep 2 13:31:53 <cluster-name>-m stackdriver-agent[3609]: option = Hostname; value = 3431688934917455875;
Sep 2 13:31:53 <cluster-name>-m stackdriver-agent[3609]: option = Interval; value = 60.000000;
Sep 2 13:31:53 <cluster-name>-m stackdriver-agent[3609]: Created new plugin context.
Sep 2 13:31:53 <cluster-name>-m stackdriver-agent[3609]: .
Sep 2 13:31:56 <cluster-name>-m stackdriver-agent[3823]: Stopping Stackdriver metrics collection agent: stackdriver-agent.
Sep 2 13:31:56 <cluster-name>-m stackdriver-agent[3842]: Starting Stackdriver metrics collection agent: stackdriver-agentoption = Interval; value = 60.000000;
Sep 2 13:31:56 <cluster-name>-m stackdriver-agent[3842]: Created new plugin context.
Sep 2 13:31:56 <cluster-name>-m stackdriver-agent[3842]: option = PIDFile; value = /var/run/stackdriver-agent.pid;
Sep 2 13:31:56 <cluster-name>-m stackdriver-agent[3842]: option = Interval; value = 60.000000;
Sep 2 13:31:56 <cluster-name>-m stackdriver-agent[3842]: Created new plugin context.
Sep 2 13:31:56 <cluster-name>-m stackdriver-agent[3842]: .编辑:完整集群创建命令为:
gcloud dataproc clusters create <cluster-name> --master-machine-type n1-highmem-2 --worker-machine-type n1-highmem-2 --initialization-actions <path-to-script> --master-boot-disk-size 50GB --worker-boot-disk-size 50GB --num-workers 16 --network internal --zone us-east1-c --scopes https://www.googleapis.com/auth/cloud-platform --project <project-name> --tags dataprocdataproc标记在我的组织中的所有端口上打开防火墙。发现internal网络比default工作得更好
sudo systemctl | grep stackdriver-agent的结果
stackdriver-agent.service active running
LSB: start and stop Stackdriver Agentsudo ps wwaux | grep stackdriver-agent的结果
root 3851 0.0 0.0 1004704 9096 ? Ssl 12:50 0:00 /opt/stackdriver/collectd/sbin/stackdriver-collectd -C
/opt/stackdriver/collectd/etc/collectd.conf -P /var/run/stackdriver-agent.pid
7053 0.0 0.0 12732 2068 pts/0 S+ 13:14 0:00 grep stackdriver-agent发布于 2016-09-02 05:40:15
我重现了您的一些步骤,虽然在您提交作业之前,我不能说为什么它看起来像是监视“工作”,但由于这是我在尝试应用指令而不调试Dataproc内部时遇到的第一件事,您应该验证您是否为Dataproc集群提供了正确的作用域,以使stackdriver-agent能够将其度量写入API。也就是说,以下内容似乎对我有效,保持初始化操作不变:
gcloud dataproc clusters create dhuo-stackdriver \
--initialization-actions gs://<my-bucket>/install_stackdriver.sh \
--scopes https://www.googleapis.com/auth/monitoring.write或者,您可以使用Stackdriver documentation中列出的其他作用域,比如更广泛的cloud-platform作用域。请注意,这可能会覆盖其他一些默认的作用域混合,如果没有使用用户指定的作用域,则通常会添加这些混合:
https://www.googleapis.com/auth/bigquery
https://www.googleapis.com/auth/bigtable.admin.table
https://www.googleapis.com/auth/bigtable.data
https://www.googleapis.com/auth/devstorage.full_control我的本地测试只使用您的代码片段作为初始化操作:
#!/bin/bash
cd /tmp
curl -O "https://repo.stackdriver.com/stack-install.sh"
bash stack-install.sh --write-gcm另外,https://www.googleapis.com/auth/monitoring.write在我的测试项目中工作,包括通过作业提交:

https://stackoverflow.com/questions/39207815
复制相似问题