couchdb-prometheus-exporter

command module
v29.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2020 License: MIT Imports: 13 Imported by: 0

README

CouchDB Prometheus Exporter

Build Status

CouchDB metrics exporter for Prometheus

The CouchDB metrics exporter requests the CouchDB stats from the /_stats and /_active_tasks endpoints and exposes them for Prometheus consumption. You can optionally monitor detailed database stats like disk and data size to monitor the storage overhead. The exporter can be configured via program parameters, environment variables, and config file.

Build the binary

You can find pre-build releases for different platforms at our GitHub Releases.

If you prefer to build your own binary or in case you'd like to build from the current master, you'll have to get and install a recent version of Golang for your platform, first. Then, you have to perform the following commands in the cloned repository:

export GO111MODULE=on  # in a Windows shell, please replace `export` with `set`
go get github.com/gesellix/couchdb-prometheus-exporter

Those commands will install the binary in your local GOBIN directory, usually something like $HOME/go/bin. Please ensure that the directory is in your system's PATH. Then the following should work:

couchdb-prometheus-exporter --help

Run the binary

You can get an overview over possible configuration options with their defaults in the help screen:

couchdb-prometheus-exporter --help

Configuration is possible via:

  • environment variables (e.g. COUCHDB_USERNAME=admin)
  • command line parameters (e.g. --couchdb.username admin)
  • configuration file

The configuration file format is the "properties" file format, e.g. like this:

couchdb.username=admin
couchdb.password=a-secret

Run it as container

docker run --rm -p 9984:9984 gesellix/couchdb-prometheus-exporter --couchdb.uri=http://couchdb:5984 --logtostderr

Please note that host names like localhost won't leave the container, so you have to use non-loopback dns names or ip addresses when configuring the CouchDB URI.

Logging

The couchdb-exporter uses the glog library for logging. With the default parameters everything will be logged to /tmp/. Use --logtostderr to enable logging to stderr and --help to see all options.

CouchDB 2+ clusters

For CouchDB 2.x, you should configure the exporter to fetch the stats from one node, to get a complete cluster overview. In contrast to CouchDB 1.x you'll need to configure the admin credentials, e.g. like this:

couchdb-prometheus-exporter --couchdb.uri=http://couchdb:5984 --couchdb.username=root --couchdb.password=a-secret

Database disk usage stats

If you need database disk usage stats, add a comma separated list of database names like this:

couchdb-prometheus-exporter --couchdb.uri=http://couchdb:5984 --databases=db-1,db-2 --couchdb.username=root --couchdb.password=a-secret

Or, if you want to get stats for every database, please use _all_dbs as database name:

couchdb-prometheus-exporter --couchdb.uri=http://couchdb:5984 --databases=_all_dbs --couchdb.username=root --couchdb.password=a-secret

Monitoring CouchDB with Prometheus, Grafana and Docker

For a step-by-step guide, see Monitoring CouchDB with Prometheus, Grafana and Docker

A complete example stack including multiple CouchDB instances, exporters, Prometheus, Grafana, etc. is available at examples/grafana/, and can be deployed locally:

cd examples/grafana
docker swarm init
docker stack deploy --compose-file docker-traefik-stack.yml example

Examples

The examples directory in this repository contains ready-to-run examples for

Credits

Thanks go to the Prometheus team, which is very active and responsive!

I also have to admit that the couchdb-prometheus-exporter code is heavily inspired by the other available exporters, and that some ideas have just been copied from them.

Last but not least, this project wouldn't be possible without users submitting issues, feature requests and adding code contributions. Thanks a lot!

Metrics Overview

The file README_metrics.md gives you an overview on the currently exposed metrics.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

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