Skip to content

Commit c5e5a5c

Browse files
authored
Merge pull request #235 from nginx/internal/gcp-monitoring-fixups
add variables to cloud monitoring API call
2 parents 0799f34 + e2957a1 commit c5e5a5c

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

content/nginxaas-google/monitoring/enable-monitoring.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,16 +43,18 @@ Refer to the [Google's Metrics Explorer](https://cloud.google.com/monitoring/cha
4343

4444
You can retrieve raw time series metrics from the [Cloud Monitoring API](https://cloud.google.com/monitoring/api/v3).
4545

46-
For example, you can use [`projects.timeSeries.list`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) to list metrics matching filters from a specified time interval.
46+
For example, you can use [`projects.timeSeries.list`](https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.timeSeries/list) to list metrics matching filters from a specified time interval. The following `curl` command lists `nginxaas.ncus.provisioned` metrics from the time interval `start_time` to `end_time` in the given `project_id`.
4747

4848
```bash
4949
curl \
50-
'https://monitoring.googleapis.com/v3/projects/{project_id}/timeSeries?filter=metric.type%20%3D%20%22workload.googleapis.com%2Fnginxaas.ncus.provisioned%22&interval.endTime=2025-08-27T20%3A59%3A41.502Z&interval.startTime=2025-08-27T20%3A50%3A41.502Z&view=FULL&key=[YOUR_API_KEY]' \
51-
--header 'Authorization: Bearer [YOUR_ACCESS_TOKEN]' \
52-
--header 'Accept: application/json' \
50+
"https://monitoring.googleapis.com/v3/projects/{project_id}/timeSeries?filter=metric.type%3D%22workload.googleapis.com%2Fnginxaas.ncus.provisioned%22&interval.endTime={end_time}&interval.startTime={start_time}" \
51+
--header "Authorization: Bearer $(gcloud auth print-access-token)" \
52+
--header "Accept: application/json" \
5353
--compressed
5454
```
5555

56+
See [Google's documentation to authenticate for using REST](https://cloud.google.com/docs/authentication/rest) for more information.
57+
5658
The following JSON shows an example response body:
5759

5860
```json
@@ -77,16 +79,16 @@ The following JSON shows an example response body:
7779
"node_id": "",
7880
"location": "global",
7981
"namespace": "",
80-
"project_id": "test-project"
82+
"project_id": "{project_id}"
8183
}
8284
},
8385
"metricKind": "GAUGE",
8486
"valueType": "INT64",
8587
"points": [
8688
{
8789
"interval": {
88-
"startTime": "2025-08-27T20:56:18.608375Z",
89-
"endTime": "2025-08-27T20:56:18.608375Z"
90+
"startTime": "{start_time}",
91+
"endTime": "{end_time}"
9092
},
9193
"value": {
9294
"int64Value": "10"

0 commit comments

Comments
 (0)