Skip to content

disc/maxctrl_exporter

 
 

Repository files navigation

MaxScale Exporter

The Exporter exports the MaxScale metrics for Prometheus:

  • Server connections
  • Service session count
  • MaxScale instance status
  • Event statistics per started thread

MaxScale requirements

The exporter uses exclusively MaxScale REST API

Installation

  1. Install Golang
  2. Create a new folder in your $GOPATH: mkdir -p $GOPATH/src/github.com/
  3. Navigate to that folder: $GOPATH/src/github.com
  4. Clone the repository: git clone https://github.com/Vetal1977/maxctrl_exporter.git

Docker

The latest Docker image of maxctrl_exporter is available here

Build

Manually

  1. Change to the project root directory
  2. Run go build to build the binary for your platform
  3. Build Linux binary: GOOS=linux GOARCH=amd64 go build -o bin/linux/maxctrl_exporter

With Makefile

  1. Run make build

Run and test locally

We have prepared a Docker-compose file for a local try. Upon start, you get running MySQL, MaxScale and Exporter containers. Note that the Exported does not use command line arguments rather relies on environment variables:

  • MAXSCALE_URL. URL of MaxScale server, default is https://127.0.0.1:8989
  • MAXSCALE_USERNAME. MaxScale user name for connection to underlying MySQL database
  • MAXSCALE_PASSWORD. MaxScale user password for connection to underlying MySQL database
  • MAXSCALE_CA_CERTIFICATE. Certificate to use to verify a secure connection
  • MAXSCALE_EXPORTER_PORT. Port that the Exporter expose to provide metrics for Prometheus

Run

  1. cd maxscale_docker
  2. docker-compose up -d
  3. docker-compose down when you are finished

Test

  1. The REST API of MaxScale is accessible at localhost:8989. E.g. https://localhost:8989/v1/servers
  2. The Exporter of MaxScale is accessible at localhost:8093. E.g. https://localhost:8093/metrics

Contribution

  1. Create a new branch
  2. Make changes
  3. Run MaxScale and maxctrl_exporter locally, e.g. in Docker
  4. Check that you can access them and see reasonable output
  5. Commit and push the branch
  6. Create a PR
  7. Request a review from Vitaly Bezgachev, vitaly.bezgachev [the_at_symbol] gmail.com, Kadir Tugan, kadir.tugan [the_at_symbol] gmail.com

About

MaxScale metrics exporter for Prometheus

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Go 93.6%
  • Makefile 3.5%
  • Dockerfile 2.3%
  • Shell 0.6%