This document explains how to use the Cloud Monitoring API to get lists or descriptions of the following:
Before you begin
- For an introduction to metrics and monitored resources, see Metrics, time series, and resources.
List metric descriptors
Metric descriptors are the schemas that define metrics. To find details about the metrics you're interested in, browse the available metric descriptors.For more information on how metric types are named, see Naming conventions.
List metric types
To get a current list of metric descriptors, use the
metricDescriptors.list
method.
To narrow the set of metric types that are returned, use a filter.
For help deciding which metric types to search for, see
Value types and metric kinds.
C#
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Go
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Java
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Node.js
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
PHP
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Python
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Ruby
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
If you have difficulty, see Troubleshooting API calls.
Get metric descriptors
To get information about a single metric type, use the
metricDescriptors.get
method.
This method returns a metric descriptor.
To retrieve a specific metric descriptor, you must provide the full name of the metric to the API. The full name is constructed from two components:
- A prefix consisting of
projects/PROJECT_ID/metricDescriptors
. - The
type
value that identifies the metric descriptor, for example,compute.googleapis.com/firewall/dropped_packets_count
. See the Protocol tab in List metric types for more on thetype
value.
The following is an example of the full name of a metric:
projects/PROJECT_ID/metricDescriptors/compute.googleapis.com/firewall/dropped_packets_count
C#
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Go
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Java
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Node.js
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
PHP
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Python
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Ruby
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
If you have difficulty, see Troubleshooting API calls.
List monitored resources
Monitored resources are cloud entities that can be monitored. To find the kinds of entities that have metrics, browse the list of monitored resource types.
To get information about monitored resources, you can issue API requests to any existing project, or you can use the Monitored resource list documentation.
List resource types
To get a current list of monitored resource types from the
Monitoring API,
use the monitoredResourceDescriptors.list
method and supply your project ID.
C#
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Go
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Java
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Node.js
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
PHP
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Python
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Ruby
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
If you have difficulty, see Troubleshooting API calls.
Getting resource descriptors
To get a specific monitored-resource descriptor, use the
monitoredResourceDescriptors.get
method.
To retrieve a specific monitored-resource descriptor, you must provide the full name of the descriptor to the API. The full name is constructed from two components:
- A prefix consisting of
projects/PROJECT_ID/monitoredResourceDescriptors
. - The
type
value that identifies the monitored-resource descriptor, for example,gce_instance
. See the Protocol tab in List resource types for more on thetype
value.
The following is an example of the full name of a monitored resource:
projects/PROJECT_ID/monitoredResourceDescriptors/gce_instance
C#
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Go
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Java
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Node.js
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
PHP
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Python
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
Ruby
To authenticate to Monitoring, set up Application Default Credentials. For more information, see Set up authentication for a local development environment.
Before running code samples, set the GOOGLE_CLOUD_UNIVERSE_DOMAIN
environment
variable to s3nsapis.fr
.
If you have difficulty, see Troubleshooting API calls.
What's next
- For information about how to use the Cloud Monitoring API to read time-series data, see Retrieve time-series data.