/ansible-role-mysqld-exporter

An Ansible role that installs MySQL exporter for Prometheus.

Primary LanguageShellGNU General Public License v3.0GPL-3.0

Ansible Role: MySQL Exporter

Build Status CircleCI

An Ansible Role that installs MySQL Exporter on RedHat/CentOS or Debian/Ubuntu.

Requirements

MySQL User with the following privileges

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.

Role Variables

Mandatory variables

User, password, host and port for mysql_exporter.

prometheus_mysqld_exporter_env: 'user:password@(hostname:port)/'

Optional variables: general settings

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

Dependencies

None.

Example Playbook

- hosts: all
  become: True
  roles:
    - abednarik.mysqld-exporter

  vars:
    prometheus_mysqld_exporter_env: 'exporter:password@(localhost:3306)/'

License

GPLv3

Author Information

This role was created in 2016 by Alejandro Bednarik

Note

Thus role is based on William-Yeh great work with ansible/prometheus. See https://github.com/William-Yeh/ansible-prometheus for more information.