我一直致力于设置一个计算引擎实例来运行我们的管道的一部分,现在我对我得到的错误感到困惑,所以我真的只是想澄清所有这些是如何工作的如何让它正常工作,以便我可以启动并运行。
这是堆栈跟踪:
username@dev-instance-1:/var/local/path/to/pipeline$ python -m path.to.pipeline.file.properties sample-name-of-program-to-run
Setting up code base here...
INFO:urllib3.connectionpool:Starting new HTTPS connection (1): user.sample.com
DEBUG:urllib3.connectionpool:"POST /users/refresh_token.json HTTP/1.1" 401 41
INFO:urllib3.connectionpool:Starting new HTTPS connection (1): user.sample.com
DEBUG:urllib3.connectionpool:"POST /users/sign_in.json HTTP/1.1" 200 156
{'instance_zone': 'us-central1-a', 'project_resource': 'projects/sample-project', 'user': 'username', 'sample_config': '', 'metric_type': '', 'name': None, 'metric_name': '', 'server': None, 'instance': 'dev-instance-1', 'metric_type_base': 'custom.googleapis.com/', 'project_id': 'sample-project', 'metric_kind': 'GAUGE'}
INFO:googleapiclient.discovery:URL being requested: POST https://monitoring.googleapis.com/v3/projects/sample-project/metricDescriptors?alt=json
INFO:oauth2client.transport:Attempting refresh to obtain initial access_token
WARNING:googleapiclient.http:Encountered 403 Forbidden with reason "forbidden"
ERROR:root:CRASH! <HttpError 403 when requesting https://monitoring.googleapis.com/v3/projects/sample-project/metricDescriptors?alt=json returned "User is not authorized to access the project monitoring records.">
ERROR:root:<HttpError 403 when requesting https://monitoring.googleapis.com/v3/projects/sample-project/metricDescriptors?alt=json returned "User is not authorized to access the project monitoring records.">
Traceback (most recent call last):
File "/var/local/path/to/pipeline/file/properties.py", line 396, in <module>
main()
File "/var/local/path/to/pipeline/file/properties.py", line 392, in main
client.launch()
File "/var/local/path/to/pipeline/file/properties.py", line 205, in launch
self.stackdriver()
File "/var/local/path/to/pipeline/file/properties.py", line 104, in stackdriver
"description": "Server the data originates from: (US) Dev or (US) Field"
File "path/to/another/file/stackdriver.py", line 310, in create_metric
name=self.config['project_resource'], body=body).execute()
File "/usr/local/lib/python2.7/dist-packages/oauth2client/util.py", line 137, in positional_wrapper
return wrapped(*args, **kwargs)
File "/usr/local/lib/python2.7/dist-packages/googleapiclient/http.py", line 838, in execute
raise HttpError(resp, content, uri=self.uri)
HttpError: <HttpError 403 when requesting https://monitoring.googleapis.com/v3/projects/sample-project/metricDescriptors?alt=json returned "User is not authorized to access the project monitoring records.">
EXCEPTION!
我怎样才能让它正常工作?我正在开发一个与示例项目不同的项目,所以这可能是问题所在,那么如何设置服务帐户以使该系统同时运行?