2016-09-29 16:33:48 +02:00
|
|
|
---
|
|
|
|
|
|
|
|
- name: is Munin present ?
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.stat:
|
2016-09-29 16:33:48 +02:00
|
|
|
path: /etc/munin/plugin-conf.d/munin-node
|
2017-03-24 14:15:09 +01:00
|
|
|
check_mode: no
|
2016-09-29 16:33:48 +02:00
|
|
|
register: munin_node_plugins_config
|
|
|
|
tags:
|
|
|
|
- mysql
|
|
|
|
- munin
|
|
|
|
|
|
|
|
- block:
|
2021-09-30 10:13:11 +02:00
|
|
|
- name: "Install perl libraries for Munin (Debian < 11)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.apt:
|
2019-12-31 15:25:10 +01:00
|
|
|
name:
|
|
|
|
- libdbd-mysql-perl
|
|
|
|
- libcache-cache-perl
|
2016-09-29 16:33:48 +02:00
|
|
|
state: present
|
2021-09-30 10:13:11 +02:00
|
|
|
when: ansible_distribution_major_version is version('11', '<')
|
|
|
|
|
|
|
|
- name: "Install perl libraries for Munin (Debian >= 11)"
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.apt:
|
2021-09-30 10:13:11 +02:00
|
|
|
name:
|
|
|
|
- libcache-cache-perl
|
|
|
|
- libdbd-mariadb-perl
|
|
|
|
when: ansible_distribution_major_version is version('11', '>=')
|
2016-09-29 16:33:48 +02:00
|
|
|
|
|
|
|
- name: Enable core Munin plugins
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.file:
|
2016-09-29 16:33:48 +02:00
|
|
|
src: '/usr/share/munin/plugins/{{ item }}'
|
|
|
|
dest: /etc/munin/plugins/{{ item }}
|
|
|
|
state: link
|
2021-05-04 14:18:40 +02:00
|
|
|
loop:
|
2016-09-29 16:33:48 +02:00
|
|
|
- mysql_bytes
|
|
|
|
- mysql_queries
|
|
|
|
- mysql_slowqueries
|
|
|
|
- mysql_threads
|
|
|
|
notify: restart munin-node
|
|
|
|
|
|
|
|
- name: Enable contributed Munin plugins
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.file:
|
2016-09-29 16:33:48 +02:00
|
|
|
src: /usr/share/munin/plugins/mysql_
|
|
|
|
dest: '/etc/munin/plugins/mysql_{{ item }}'
|
|
|
|
state: link
|
2021-05-04 14:18:40 +02:00
|
|
|
loop:
|
2017-10-20 10:25:34 +02:00
|
|
|
- commands
|
2016-09-29 16:33:48 +02:00
|
|
|
- connections
|
|
|
|
- files_tables
|
|
|
|
- innodb_bpool
|
|
|
|
- innodb_bpool_act
|
2017-10-20 10:25:34 +02:00
|
|
|
- innodb_insert_buf
|
2016-09-29 16:33:48 +02:00
|
|
|
- innodb_io
|
2017-10-20 10:25:34 +02:00
|
|
|
- innodb_io_pend
|
2016-09-29 16:33:48 +02:00
|
|
|
- innodb_log
|
|
|
|
- innodb_rows
|
|
|
|
- innodb_semaphores
|
|
|
|
- myisam_indexes
|
2017-10-20 10:25:34 +02:00
|
|
|
- network_traffic
|
2016-09-29 16:33:48 +02:00
|
|
|
- qcache
|
|
|
|
- qcache_mem
|
2017-10-20 10:25:34 +02:00
|
|
|
- select_types
|
|
|
|
- slow
|
2016-09-29 16:33:48 +02:00
|
|
|
- sorts
|
2017-10-20 10:25:34 +02:00
|
|
|
- table_locks
|
2016-09-29 16:33:48 +02:00
|
|
|
- tmp_tables
|
2021-10-27 10:43:17 +02:00
|
|
|
- replication
|
2016-09-29 16:33:48 +02:00
|
|
|
notify: restart munin-node
|
|
|
|
|
2022-08-29 18:05:57 +02:00
|
|
|
- name: verify Munin configuration for mysql < Debian 11
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.replace:
|
2020-03-08 22:15:06 +01:00
|
|
|
dest: /etc/munin/plugin-conf.d/munin-node
|
|
|
|
after: '\[mysql\*\]'
|
|
|
|
regexp: '^env.mysqluser (.+)$'
|
|
|
|
replace: 'env.mysqluser debian-sys-maint'
|
|
|
|
notify: restart munin-node
|
2022-08-29 18:05:57 +02:00
|
|
|
when: ansible_distribution_major_version is version_compare('11', '<')
|
|
|
|
|
|
|
|
- name: set Munin env.mysqluser option for mysql >= Debian 11
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.replace:
|
2022-08-29 18:05:57 +02:00
|
|
|
dest: /etc/munin/plugin-conf.d/munin-node
|
|
|
|
after: '\[mysql\*\]'
|
|
|
|
regexp: '^env.mysqluser (.+)$'
|
|
|
|
replace: 'env.mysqluser root'
|
|
|
|
notify: restart munin-node
|
|
|
|
when: ansible_distribution_major_version is version_compare('11', '>=')
|
|
|
|
|
|
|
|
- name: set Munin env.mysqlopts option for mysql >= Debian 11
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.replace:
|
2022-08-29 18:05:57 +02:00
|
|
|
dest: /etc/munin/plugin-conf.d/munin-node
|
|
|
|
after: '\[mysql\*\]'
|
|
|
|
regexp: '^env.mysqlopts (.+)$'
|
|
|
|
replace: 'env.mysqlopts --defaults-file=/root/.my.cnf'
|
|
|
|
notify: restart munin-node
|
|
|
|
when: ansible_distribution_major_version is version_compare('11', '>=')
|
|
|
|
|
|
|
|
- name: set Munin env.mysqlconnection option for mysql >= Debian 11
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.replace:
|
2022-08-29 18:05:57 +02:00
|
|
|
dest: /etc/munin/plugin-conf.d/munin-node
|
|
|
|
after: '\[mysql\*\]'
|
|
|
|
regexp: '^env.mysqlconnection (.+)$'
|
|
|
|
replace: 'env.mysqlconnection DBI:mysql:mysql;mysql_read_default_file=/root/.my.cnf'
|
|
|
|
notify: restart munin-node
|
|
|
|
when: ansible_distribution_major_version is version_compare('11', '>=')
|
|
|
|
|
2020-03-08 22:15:06 +01:00
|
|
|
|
2016-12-16 01:19:31 +01:00
|
|
|
when: munin_node_plugins_config.stat.exists
|
2016-09-29 16:33:48 +02:00
|
|
|
tags:
|
|
|
|
- mysql
|
|
|
|
- munin
|