Unauthorized to access the project monitoring records for Compute Engine

445 Views Asked by At

I've worked on setting up a compute engine instance for running a portion of our pipeline, and now I'm confused as to the error I'm getting, so really I'm just looking for clarification on how all of this works and how to get it working properly so I can get things up and running.

Here's the stack trace:

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!

How do I get this working properly? I'm working on a separate project than sample-project, so that may be the problem, so how do I setup the service account in order to get this system working off of both?

0

There are 0 best solutions below