Categorygithub.com/blakelead/couchbase_exporter
modulepackage
0.0.0-20200224113946-b4454dcab9c2
Repository: https://github.com/blakelead/couchbase_exporter.git
Documentation: pkg.go.dev

# README

Couchbase Exporter

Build Status Coverage Status License

Expose metrics from Couchbase cluster for consumption by Prometheus.

News

Couchbase has released an official exporter: couchbase-exporter.

Getting Started

Run from command-line:

./couchbase_exporter [flags]

The exporter supports various configuration ways: command-line arguments takes precedence over environment variables that take precedence over configuration file.

Configuration file can be provided on the command line. It must be written in json or yaml. If none is provided using the command line --config.file option, it will look for a file named config.json or config.yml in the same directory that the exporter binary. You can find complete examples of configuation files in the sources (directory examples).

As for available flags and equivalent environment variables, here is a list:

environment variableargumentdescriptiondefault
-config.fileConfiguration file to load data from
CB_EXPORTER_LISTEN_ADDR-web.listen-addressAddress to listen on for HTTP requests:9191
CB_EXPORTER_TELEMETRY_PATH-web.telemetry-pathPath under which to expose metrics/metrics
CB_EXPORTER_SERVER_TIMEOUT-web.timeoutServer read timeout in seconds10s
CB_EXPORTER_DB_URI-db.uriAddress of Couchbase clusterhttp://127.0.0.1:8091
CB_EXPORTER_DB_TIMEOUT-db.timeoutCouchbase client timeout in seconds10s
CB_EXPORTER_TLS_ENABLED-tls.enabledIf true, enable TLS communication with the clusterfalse
CB_EXPORTER_TLS_SKIP_INSECURE-tls.skip-insecureIf true, certificate won't be verifiedfalse
CB_EXPORTER_TLS_CA_CERT-tls.ca-certRoot certificate of the cluster
CB_EXPORTER_TLS_CLIENT_CERT-tls.client-certClient certificate
CB_EXPORTER_TLS_CLIENT_KEY-tls.client-keyClient private key
CB_EXPORTER_DB_USERnot allowedAdministrator username
CB_EXPORTER_DB_PASSWORDnot allowedAdministrator password
CB_EXPORTER_LOG_LEVEL-log.levelLog level: info,debug,warn,error,fatalerror
CB_EXPORTER_LOG_FORMAT-log.formatLog format: text, jsontext
CB_EXPORTER_SCRAPE_CLUSTER-scrape.clusterIf false, wont scrape cluster metricstrue
CB_EXPORTER_SCRAPE_NODE-scrape.nodeIf false, wont scrape node metricstrue
CB_EXPORTER_SCRAPE_BUCKET-scrape.bucketIf false, wont scrape bucket metricstrue
CB_EXPORTER_SCRAPE_XDCR-scrape.xdcrIf false, wont scrape xdcr metricsfalse
-helpCommand line help

Important: for security reasons credentials cannot be set with command line arguments.

Metrics

All metrics are listed in resources/metrics.md.

Docker

Use it like this:

docker run --name cbexporter -p 9191:9191 -e CB_EXPORTER_DB_USER=admin -e CB_EXPORTER_DB_PASSWORD=complicatedpassword blakelead/couchbase-exporter:latest

Examples

You can find example files in resources directory.

Prometheus

Some simple alerting rules: resources/prometheus-alerts.yaml.

Grafana

Minimal dashboard (resources/grafana-dashboard.json):

Systemd

You can adapt and use the provided service template to run the exporter with systemd (resources/couchbase-exporter.service):

sudo mv couchbase-exporter.service /etc/systemd/system/couchbase-exporter.service
sudo systemctl enable couchbase-exporter.service
sudo systemctl start couchbase-exporter.service

Contributors

Special thanks to:

  • @Berchiche
  • @bitdba88
  • @CharlesRaymond1
  • @pandrieux

# Packages

No description provided by the author

# Functions

FlagPresent returns true if the flag name passed as the function parameter is found in the command-line flags.

# Structs

Options struct regroups runtime parameters.