An Ansible Role that installs MySQL Exporter on RedHat/CentOS or Debian/Ubuntu.
CREATE USER 'exporter'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT PROCESS, REPLICATION CLIENT,
SELECT ON *.* TO 'exporter'@'localhost' WITH MAX_USER_CONNECTIONS 3;
FLUSH PRIVILEGES;
NOTE: It is recommended to set a max connection limit for the user to avoid overloading the server with monitoring scrapes under heavy load.
User, password, host and port for mysql_exporter.
prometheus_mysqld_exporter_env: 'user:password@(hostname:port)/'
User-configurable defaults:
prometheus_user: prometheus
prometheus_group: prometheus
prometheus_mysqld_exporter_version: 0.9.0
gosu_version: '1.10'
prometheus_install_path: /opt/prometheus
prometheus_log_path: /var/log/prometheus
prometheus_pid_path: /var/run/prometheus
None.
- hosts: all
become: True
roles:
- abednarik.mysqld-exporter
vars:
prometheus_mysqld_exporter_env: 'exporter:password@(localhost:3306)/'
This role was created in 2016 by Alejandro Bednarik
Thus role is based on William-Yeh great work with ansible/prometheus. See https://github.com/William-Yeh/ansible-prometheus for more information.