Google Stackdriver Prometheus Exporter
Download the already existing binaries for your platform:
$ ./stackdriver_exporter <flags>
Using the standard
go install (you must have Go already installed in your local machine):
$ go install github.com/prometheus-community/stackdriver_exporter $ stackdriver_exporter <flags>
To run the stackdriver exporter as a Docker container, run:
$ docker run -p 9255:9255 prometheuscommunity/stackdriver-exporter <flags>
The exporter can be deployed to an already existing Cloud Foundry environment:
$ git clone https://github.com/prometheus-community/stackdriver_exporter.git $ cd stackdriver_exporter
Modify the included application manifest file to include the desired properties. Then you can push the exporter to your Cloud Foundry environment:
$ cf push
This exporter can be deployed using the Prometheus BOSH Release.
Credentials and Permissions
The Google Stackdriver Exporter uses the Google Golang Client Library, which offers a variety of ways to provide credentials. Please refer to the Google Application Default Credentials documentation to see how the credentials can be provided.
If you are using IAM roles, the
monitoring.timeSeries.list IAM permissions are required. The
roles/monitoring.viewer IAM role contains those permissions. See the Access Control Guide for more information.
If you are still using the legacy Access scopes, the
https://www.googleapis.com/auth/monitoring.read scope is required.
|Flag / Environment Variable||Required||Default||Description|
||No||GCloud SDK autodiscovery||Comma seperated list of Google Project IDs|
||Yes||Comma separated Google Stackdriver Monitoring Metric Type prefixes (see example and available metrics)|
||Metric's timestamp interval to request from the Google Stackdriver Monitoring Metrics API. Only the most recent data point is used|
||Offset (into the past) for the metric's timestamp interval to request from the Google Stackdriver Monitoring Metrics API, to handle latency in published metrics|
||Address to listen on for web interface and telemetry|
||Path under which to expose Prometheus metrics|
The exporter returns the following metrics:
||Total number of Google Stackdriver Monitoring API calls made||
||Total number of Google Stackdriver Monitoring metrics scrapes||
||Total number of Google Stackdriver Monitoring metrics scrape errors||
||Whether the last metrics scrape from Google Stackdriver Monitoring resulted in an error (
||Number of seconds since 1970 since last metrics scrape from Google Stackdriver Monitoring||
||Duration of the last metrics scrape from Google Stackdriver Monitoring||
Metrics gathered from Google Stackdriver Monitoring are converted to Prometheus metrics:
- Metric's names are normalized according to the Prometheus specification using the following pattern:
namespaceis a constant prefix (
subsystemis the normalized monitored resource type (ie
nameis the normalized metric type (ie
- Labels attached to each metric are an aggregation of:
- For each timeseries, only the most recent data point is exported.
DELTAmetric kinds are reported as Prometheus
CUMULATIVEmetric kinds are reported as Prometheus
DISTRIBUTIONmetric types are supported, other types (
MONEY) are discarded.
DISTRIBUTIONmetric type is reported as a Prometheus
Histogram, except the
_sumtime series is not supported.
If we want to get all
compute.googleapis.com/instance/disk) metrics for all Google Compute Engine instances, we can run the exporter with the following options:
stackdriver_exporter \ --google.project-id my-test-project \ --monitoring.metrics-type-prefixes "compute.googleapis.com/instance/cpu,compute.googleapis.com/instance/disk"
Filtering enabled collectors
stackdriver_exporter collects all metrics type prefixes by default.
For advanced uses, the collection can be filtered by using a repeatable URL param called
collect. In the Prometheus configuration you can use you can use this syntax under the scrape config.
params: collect: - compute.googleapis.com/instance/cpu - compute.googleapis.com/instance/disk
Refer to the contributing guidelines.
Apache License 2.0, see LICENSE.