update mysqld exporter config

This commit is contained in:
Ludovic Cartier 2021-05-31 16:59:06 +02:00
parent e51e4ce7a0
commit c24529d657
3 changed files with 9 additions and 17 deletions

View File

@ -42,25 +42,13 @@
enabled: yes enabled: yes
name: prometheus-mysqld-exporter.service name: prometheus-mysqld-exporter.service
- name: 'prometheus | mysqld exporter | create configuration directory'
file:
path: /var/lib/prometheus
state: directory
mode: '0755'
tags:
- prometheus
- name: 'prometheus | mysqld exporter | configuration' - name: 'prometheus | mysqld exporter | configuration'
copy: template:
dest: '/var/lib/prometheus/.my.cnf' src: conf/prometheus-mysqld-exporter.j2
dest: /etc/default/prometheus-mysqld-exporter
owner: root owner: root
group: root group: root
mode: 0644 mode: 0600
backup: yes
content: |
[client]
user={{ prometheus_mysqld_exporter_user }}
password={{ prometheus_mysqld_exporter_password }}
when: when:
- prometheus_mysqld_exporter_user is defined - prometheus_mysqld_exporter_user is defined
register: prometheus_mysqld_exporter_configuration register: prometheus_mysqld_exporter_configuration

View File

@ -0,0 +1,4 @@
# {{ ansible_managed }}
[client]
user={{ prometheus_mysqld_exporter_user }}
password={{ prometheus_mysqld_exporter_password }}

View File

@ -5,7 +5,7 @@ After=network.target
[Service] [Service]
Type=simple Type=simple
ExecStart=/usr/local/bin/prometheus-mysqld-exporter \ ExecStart=/usr/local/bin/prometheus-mysqld-exporter \
--config.my-cnf /var/lib/prometheus/.my.cnf \ --config.my-cnf /etc/default/prometheus-mysqld-exporter \
--collect.global_status \ --collect.global_status \
--collect.info_schema.innodb_metrics \ --collect.info_schema.innodb_metrics \
--collect.auto_increment.columns \ --collect.auto_increment.columns \