Skip to content

Commit 240f7ad

Browse files
committed
Merge pull request #228 from GoogleCloudPlatform/mondocs
Monitoring Doc Fixups
2 parents 0d19fdb + 65a34f0 commit 240f7ad

File tree

1 file changed

+34
-10
lines changed

1 file changed

+34
-10
lines changed

monitoring/api/v3/README.md

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,28 +14,52 @@ value to it.
1414

1515
Go to the [Google Cloud Console](https://console.cloud.google.com).
1616

17-
* Go to API Manager -> Credentials
18-
* Click 'New Credentials', and create a Service Account or [click here](https://console.cloud.google
19-
.com/project/_/apiui/credential/serviceaccount)
20-
Download the JSON for this service account, and set the `GOOGLE_APPLICATION_CREDENTIALS`
21-
environment variable to point to the file containing the JSON credentials.
22-
23-
24-
export GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/<project-id>-0123456789abcdef.json
25-
2617

2718
# Set Up Your Local Dev Environment
2819
To install, run the following commands. If you want to use [virtualenv](https://virtualenv.readthedocs.org/en/latest/)
2920
(recommended), run the commands within a virtualenv.
3021

3122
* pip install -r requirements.txt
3223

33-
To run locally:
24+
Create local credentials by running the following command and following the oauth2 flow:
25+
26+
gcloud beta auth application-default login
27+
28+
To run:
3429

3530
python list_resources.py --project_id=<YOUR-PROJECT-ID>
3631
python custom_metric.py --project_id=<YOUR-PROJECT-ID
3732

3833

34+
## Running on GCE, GAE, or other environments
35+
36+
On Google App Engine, the credentials should be found automatically.
37+
38+
On Google Compute Engine, the credentials should be found automatically, but require that
39+
you create the instance with the correct scopes.
40+
41+
gcloud compute instances create --scopes="https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/compute,https://www.googleapis.com/auth/compute.readonly" test-instance
42+
43+
If you did not create the instance with the right scopes, you can still upload a JSON service
44+
account and set GOOGLE_APPLICATION_CREDENTIALS as described below.
45+
46+
47+
## Using a Service Account
48+
49+
In non-Google Cloud environments, GCE instances created without the correct scopes, or local
50+
workstations if the `gcloud beta auth application-default login` command fails, use a Service
51+
Account by doing the following:
52+
53+
* Go to API Manager -> Credentials
54+
* Click 'New Credentials', and create a Service Account or [click here](https://console.cloud.google
55+
.com/project/_/apiui/credential/serviceaccount)
56+
Download the JSON for this service account, and set the `GOOGLE_APPLICATION_CREDENTIALS`
57+
environment variable to point to the file containing the JSON credentials.
58+
59+
60+
export GOOGLE_APPLICATION_CREDENTIALS=~/Downloads/<project-id>-0123456789abcdef.json
61+
62+
3963
## Contributing changes
4064

4165
* See [CONTRIBUTING.md](CONTRIBUTING.md)

0 commit comments

Comments
 (0)