Skip to main content

One post tagged with "mariadb collector"

View All Tags

· One min read
Hreniuc Cristian-Alexandru

First, download the prometheus collector from their webpage: https://github.com/prometheus/mysqld_exporter or use docker.

Next you need to add an new user in the database:

CREATE USER 'mysqld_exporter'@'%' IDENTIFIED BY 'password' WITH MAX_USER_CONNECTIONS 3;

GRANT PROCESS, REPLICATION CLIENT, SELECT ON *.* TO 'mysqld_exporter'@'%';

I used % for host of the user, to allow logging in from everywhere. I did this because I encountered some errors when I used localhost: ERRO[0026] Error pinging mysqld: dial tcp :0: connect: connection refused source="exporter.go:119"

export DATA_SOURCE_NAME='mysqld_exporter:password@(127.0.0.1:3306)/' && \
nohup ./mysqld_exporter --no-collect.info_schema.tables --no-collect.slave_status > nohup.out 2>&1 &

Use this dashboard from grafana: https://grafana.com/dashboards/7362