Skip to content

massdriver-cloud/cloud_monitoring_exporter

Repository files navigation

Cloud Monitoring Exporter

A Prometheus Exporter for Google Cloud Monitoring metrics.

Features

  • Export metrics from GCP Cloud Monitoring to Prometheus
  • Simple configuration of metrics using metric type prefixes
  • Auto discovery of resources via tags
  • Adds any available dimension labels to metrics

Configuration

Authentication

The exporter is configured to use Google Application Default Credentials to authenticate with Google Cloud Monitoring.

Configuration

The exporter is configured using a YAML file. The following options are available:

Required

Option Description
project_id The Google Cloud project ID to export metrics from.
metric_type_prefixes A list of metric type prefixes to export.

Optional

Option Description
user_labels User-defined labels to filter on.

Example

project_id: "massdriver"
metric_type_prefixes:
- "cloudsql.googleapis.com/database/cpu"
user_labels:
  environment: "prod"

Scraping

By default, the exporter is exposed on port 9090, path /metrics.

Metrics are queried at the time of scraping and are not cached.

To adhere to the Prometheus data model, metric names are converted to snake case and all non-alphanumeric characters are replaced with underscores.

For example, the metric cloudsql.googleapis.com/database/cpu/utilization will be exported as cloudsql_googleapis_com_database_cpu_utilization.

All metrics are exported as gauges, and the #HELP comment is set to the metric's description as supplied by the GCP Cloud Monitoring API.

Deployment

Images for the exporter are available on Docker Hub.

An example docker-compose file is included in this repository. It requires a config.yml and GCP credentials.json in the directory.

After starting the exporter with docker-compose up, metrics will be available at http://localhost:9090/metrics.

The docker file can be used to deploy the exporter to any container runtime - we use Kubernetes.

Missing Features

  • Currently no support for Distributions.

Questions?

If you have any questions or suggestions, please open an issue! We'd love to hear from you.

About

Prometheus Exporter for GCP Cloud Monitoring

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 3

  •  
  •  
  •