Google Monitoring API: Get Values

I am trying to use the Google monitoring API to get indicators about my cloud usage. I am using the Google client library for Python.

The API advertises access to over 900 stack monitoring metrics. I'm interested in accessing some of the Google App Engine metrics, such as number of instances, shared memory, etc. The Google API metrics page has a list of all metrics that I should have access to.

I followed the manuals on the Google Client Library page, but my script that calls the API calls does not print metrics, but simply prints metric descriptions.

How to use the Google monitoring API to access metrics, not descriptions?

My code is:

from oauth2client.service_account import ServiceAccountCredentials
from apiclient.discovery import build
...
response = monitor.projects().metricDescriptors().get(name='projects/{my-project-name}/metricDescriptors/appengine.googleapis.com/system/instance_count').execute()

print(json.dumps(response, sort_keys=True, indent=4))

My way out

. ?

+4
1

, , . , api, .

"timeSeries". , , , (, , , , ..).

, ,

request = monitor.projects().timeSeries().list(name='projects/my-appengine-project',
                                        interval_startTime='2016-05-02T15:01:23.045123456Z',
                                        interval_endTime='2016-06-02T15:01:23.045123456Z', 
                                        filter='metric.type="appengine.googleapis.com/system/memory/usage"')

response = request.execute()

, .

+1

Source: https://habr.com/ru/post/1648562/


All Articles