Coder Social home page Coder Social logo

ackeecz / terraform-gcp-prometheus-to-monitoring Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 15.27 MB

Cloud Functions based translate of prometheus monitoring metrics to Google Cloud Monitoring

Go 59.08% HCL 39.32% Shell 1.60%
prometheus terraform terraform-module gcp stackdriver-monitoring

terraform-gcp-prometheus-to-monitoring's Introduction

Terraform module for pushing Prometheus metrics to Google Cloud Monitoring

Module is based on Cloud Function called by Cloud Scheduler. Each call says which endpoint should be pushed to Google Cloud Monitoring custom metrics.

For further setup, use variable scrape_jobs, e.g.:

module "metrics_push" {
  source     = "../"  # use correct module path
  project_id = var.project
  scrape_jobs = {
    testing : {
      schedule : "* * * * *"
      endpoint : "https://example.com/metrics"
    }
  }
  region = var.region
}

Each key in scrape_jobs can contain following keys:

  • schedule (required) - cronline
  • endpoint (required) - url to metrics endpoint
  • description - used for scheduler description
  • time_zone - time zone, default "Europe/Prague"

Kuddos for https://github.com/google/go-metrics-stackdriver/blob/main/stackdriver.go on how to handle histograms.

Currently supported Prometheus metrics are:

  • Gauge,
  • Counter,
  • Histogram.

Metrics are kept in Google Cloud Monitoring under following path: custom.googleapis.com/<key>/<metric>, e.g. custom.googleapis.com/testing/app_info where testing was given as a key in scrape_jobs variable.

Before you do anything in this module

Install pre-commit hooks by running following commands:

brew install pre-commit terraform-docs
pre-commit install

Requirements

Name Version
terraform >= 0.13

Providers

Name Version
archive n/a
google n/a
random n/a

Modules

No modules.

Resources

Name Type
google_cloud_scheduler_job.scrape_job resource
google_cloudfunctions_function.function resource
google_cloudfunctions_function_iam_member.invoker resource
google_project_iam_member.monitoring resource
google_service_account.sa resource
google_storage_bucket.bucket resource
google_storage_bucket_object.archive resource
random_string.random resource
archive_file.dotfiles data source

Inputs

Name Description Type Default Required
project_id Project ID string n/a yes
region GCP region string n/a yes
scrape_jobs Metrics scraping setup, each item needs key schedule (e.g. * * * * *) and endpoint (https://example.com/metrics) map(map(string)) n/a yes

Outputs

Name Description
sa Service account used for Cloud Function runtime email

terraform-gcp-prometheus-to-monitoring's People

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.