About mysqld_exporter
mysqld_exporter is used to expose MySQL instance status to Prometheus. dbbot has provided default deployment variables and systemd templates.
##Default value
The default variables are located in mysql_ansible/playbooks/default/var_exporter_install.yml:
mysqld_exporter_install: truemysqld_exporter_install_type: dbbotmysqld_exporter_topology: msmysqld_exporter_port: auto
Description:
- By default, the
mysqld_exporterbinary built into the dbbot repository is used. - Collection items are enabled by default in primary-replica/single-instance scenarios.
- If the target is MGR, explicitly set
mysqld_exporter_topology: mgr. mysqld_exporter_port: autowill automatically derive the exporter listening port according to9104 + (mysql_port - 3306).
Common scenarios
Primary-replica or single instance:
mysqld_exporter_install: true
mysqld_exporter_install_type: dbbot
mysqld_exporter_topology: ms
mysqld_exporter_port: auto
MGR:
mysqld_exporter_install: true
mysqld_exporter_install_type: dbbot
mysqld_exporter_topology: mgr
mysqld_exporter_port: auto
Multi-instance port planning
Default automatic derivation rules:
3306->91043307->91053310->9108
If you prefer to fix it to a custom port, you can also specify it explicitly:
mysqld_exporter_port: 9201
package mode
If you want to use the official release package, you can switch to package mode:
mysqld_exporter_install_type: package
mysqld_exporter_package: mysqld_exporter-0.18.0.linux-amd64.tar.gz
At this time any of the following conditions need to be met:
- Put the installation package into
mysql_ansible/downloads/in advance - Allow dbbot control node to access GitHub Release
Used in conjunction with exporterregistrar
exporterregistrar will also automatically deduce the MySQL exporter port according to --db-port when -P is not explicitly specified.
Example:
./exporterregistrar register -t mysql -H 192.168.199.131 --db-port 3310 -s 192.168.199.161 -p ${prometheus_server_root_password}
Execution entry
cd /usr/local/dbbot/mysql_ansible/playbooks
ansible-playbook exporter_install.yml