gcp-exporter

command module
v0.1.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 29, 2018 License: MIT Imports: 6 Imported by: 0

README

Google Cloud Platform - Prometheus exporter

pipeline status coverage report

gcp-exporter is a Prometheus exporter for Google Cloud Platform resources.

This tool looks for defined GCP resources and exports metrics about them

Usage

First, you need to create a Service Account for the exporter. Notice, that regarding to chosen collectors, you will need to assign proper permissions to the Service Account.

Having the Service Account, download the JSON file with its credentials.

Command line options

The general syntax of command line parameters is as following:

gcp-exporter [global-options] command [command-options] [arguments]
General command line options
Name Type Required? Description
--debug bool no Show debug runtime information
--no-color bool no Disable logs coloring
--help or -h bool no Show help and exit
--version or -v bool no Show version info and exit
Commands
help

Shows general help (similar to --help flag). It can be used also together with command name. In that case it will show usage information about the selected command.

start

Starts the exporter.

start command options

Name Type Required? Description
--listen string yes Listen address for metrics and debug HTTP server (e.g. "0.0.0.0:1234")
--interval integer no Number of seconds between requesting data from GCP (default: 60)
--service-account-file string no Path to GCP Service Account JSON file (default: ~/.google-service-account.json)
--instances-collector-enable bool no Enables instances collector
--project string no Count instances that belong to selected project; may be used multiple times
--zone string no Count instances that belong to selected zone; may be used multiple times
--match-tag string no Count instances that are matching selected tag; may be used multiple times
  1. Instances collector will look for instances for all defined project+zone pairs.
  2. If match-tag is used, then an instance will be counted if it matches any of specified tags.

Example usage

$ /opt/prometheus/gcp-exporter/gcp-exporter start \
    --listen :9393 \
    --interval 15 \
    --service-account-file /opt/prometheus/gcp-exporter/service-account-file.json \
    --instances-collector-enable \
    --project project-id-1 \
    --project project-id-2 \
    --zone us-east1-c \
    --zone us-east1-d \
    --match-tag docker-machine

Using Docker container

Prepared Docker image is configured to run the start command. To make it working you should remember about passing the Service Account JSON file to the container. It can be done with volumes feature.

If you want to access the exporter from a remote Prometheus server, you should also remember about exposing the port.

Example

$ docker run -d \
         --restart always \
         --name gcp_exporter \
         --log-driver=syslog \
         --log-opt tag=gcp_exporter \
         -e NO_COLOR=true \
         -v /opt/prometheus/gcp-exporter/service-account-file.json:/service-account-file.json \
         -p 9393:9393 \
         registry.gitlab.com/gitlab-org/ci-cd/gcp-exporter:0.1 \
            --listen :9393 \
            --interval 15 \
            --service-account-file /service-account-file.json \
            --instances-collector-enable \
            --project project-id-1 \
            --project project-id-2 \
            --zone us-east1-c \
            --zone us-east1-d \
            --match-tag docker-machine

Author

Tomasz Maczukin, 2018, GitLab

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL