The Exporter exports the MaxScale metrics for Prometheus:
- Server connections
- Service session count
- MaxScale instance status
- Event statistics per started thread
The exporter uses exclusively MaxScale REST API
- Install Golang
- Install dep
- Create a new folder in your $GOPATH:
mkdir -p $GOPATH/src/github.com/
- Navigate to that folder:
$GOPATH/src/github.com
- Clone the repository:
git clone https://github.com/Vetal1977/maxctrl_exporter.git
- Change to the project root directory
- Run
dep ensure --update
to update the dependencies - Run
go build
to build the binary for your platform - Build Linux binary:
GOOS=linux GOARCH=amd64 go build -o bin/linux/maxctrl_exporter
- Run
make build
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_ADDRESS. URL of MaxScale server, default is 127.0.0.1
- MAXSCALE_PORT. Exposed MaxScale server port, default is 8989
- MAXSCALE_USERNAME. MaxScale user name for connection to underlying MySQL database
- MAXSCALE_PASSWORD. MaxScale user password for connection to underlying MySQL database
- MAXSCALE_EXPORTER_PORT. Port that the Exporter expose to provide metrics for Prometheus
cd maxscale_docker
docker-compose up -d
docker-compose down
when you are finished
- The REST API of MaxScale is accessible at
localhost:8989
. E.g. http://localhost:8989/v1/servers - The Exporter of MaxScale is accessible at
localhost:8093
. E.g. http://localhost:8093/metrics