peixian / golang-gcp-monitoring

Golang example for crawling timeseries data in google cloud monitoring

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Google Cloud Platform Monitoring API - Golang Example

__THIS WILL PROBABLY CHARGE ($$$) YOUR GOOGLE ACCOUNT IF YOU RUN IT A BUNCH, I’M NOT RESPONSIBLE FOR THAT__

An example of the usage of the golang GCP monitoring API, meant to show a real example of it’s usage rather than Google’s examples, which are far too simple.

Info

The code runs through the provided project and lists all available metrics, then calls to get 3 GCP compute CPU metrics in parallel, using a sync.WaitGroup to wait on the goroutines.

Usage

Clone, go build, and run with:

golang-gcp-monitoring --service-account=<YOUR_SERVICE_ACCOUNT_PATH> --project-id=<YOUR_PROJECT_NAME>

or

go get -u github.com/peixian/golang-gcp-monitoring
golang-gcp-monitoring --service-account=<YOUR_SERVICE_ACCOUNT_PATH> --project-id=<YOUR_PROJECT_NAME>

About

Golang example for crawling timeseries data in google cloud monitoring


Languages

Language:Go 100.0%