2016-12-22 16:12:34 +01:00
|
|
|
---
|
2017-05-20 00:23:58 +02:00
|
|
|
- name: Are Munin plugins present in /etc ?
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.stat:
|
2017-05-20 00:23:58 +02:00
|
|
|
path: /etc/munin/plugins
|
|
|
|
register: etc_munin_plugins
|
|
|
|
|
|
|
|
- name: Are Munin plugins present in /usr/share ?
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.stat:
|
2017-05-20 00:23:58 +02:00
|
|
|
path: /usr/share/munin/plugins
|
|
|
|
register: usr_share_munin_plugins
|
|
|
|
|
2016-12-22 16:12:34 +01:00
|
|
|
- name: Add Munin plugins for PostgreSQL
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.file:
|
2016-12-22 16:12:34 +01:00
|
|
|
state: link
|
2022-12-28 09:03:37 +01:00
|
|
|
src: '/usr/share/munin/plugins/{{ item }}'
|
|
|
|
dest: '/etc/munin/plugins/{{ item }}'
|
2021-05-04 14:18:40 +02:00
|
|
|
loop:
|
2021-08-27 11:01:26 +02:00
|
|
|
- postgres_bgwriter
|
|
|
|
- postgres_checkpoints
|
|
|
|
- postgres_connections_db
|
|
|
|
- postgres_users
|
|
|
|
- postgres_xlog
|
2016-12-22 16:12:34 +01:00
|
|
|
notify: restart munin-node
|
2017-05-20 00:23:58 +02:00
|
|
|
when: etc_munin_plugins.stat.exists and usr_share_munin_plugins.stat.exists
|
2016-12-22 16:12:34 +01:00
|
|
|
|
|
|
|
- name: Add Munin plugins for PostgreSQL (for specific databases)
|
2023-03-20 23:33:19 +01:00
|
|
|
ansible.builtin.file:
|
2016-12-22 16:12:34 +01:00
|
|
|
state: link
|
2022-12-28 09:03:37 +01:00
|
|
|
src: '/usr/share/munin/plugins/{{ item[0] }}'
|
|
|
|
dest: '/etc/munin/plugins/{{ item[0] }}{{ item[1] }}'
|
2021-05-04 14:29:50 +02:00
|
|
|
loop: "{{ _plugins | product(_databases) | list }}"
|
|
|
|
vars:
|
2022-06-08 15:39:34 +02:00
|
|
|
_plugins:
|
|
|
|
- 'postgres_cache_'
|
|
|
|
- 'postgres_connections_'
|
|
|
|
- 'postgres_locks_'
|
|
|
|
- 'postgres_querylength_'
|
|
|
|
- 'postgres_scans_'
|
|
|
|
- 'postgres_size_'
|
|
|
|
- 'postgres_transactions_'
|
|
|
|
- 'postgres_tuples_'
|
|
|
|
_databases: "{{ postgresql_databases }}"
|
2016-12-22 16:12:34 +01:00
|
|
|
notify: restart munin-node
|
2017-05-20 00:23:58 +02:00
|
|
|
when: etc_munin_plugins.stat.exists and usr_share_munin_plugins.stat.exists
|