From 65f59b303ed795b12fd4a02b225314ba1bed50cb Mon Sep 17 00:00:00 2001 From: mg Date: Fri, 26 Feb 2021 17:24:14 +0100 Subject: [PATCH] munin: zfs monitoring (#6) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit gitlab-user entfernt typo munin-vms entfernt DNS-Resolver angepasst zfs_list hinzugefĆ¼gt Vars verschoben und extra_plugins eingebaut PR eingebaut: https://github.com/geerlingguy/ansible-role-munin-node/pull/21/files Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/6 Co-Authored-By: mg Co-Committed-By: mg --- group_vars/all.yml | 13 --------- group_vars/docker.yml | 11 -------- group_vars/proxmox.yml | 27 +++++++++++++++++++ inventory | 6 ----- playbooks/on-off/set_dns_resolver.yml | 2 +- roles/geerlingguy.munin-node/README.md | 11 ++++++++ .../geerlingguy.munin-node/defaults/main.yml | 6 +++++ roles/geerlingguy.munin-node/tasks/main.yml | 18 +++++++++++++ 8 files changed, 63 insertions(+), 31 deletions(-) diff --git a/group_vars/all.yml b/group_vars/all.yml index 09f97a5e..884f190b 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -1,19 +1,6 @@ --- ### wird in vielen Rollen verwendet empfaenger_mail: michael.grote@posteo.de - ### geerlingguy.munin-node - munin_node_bind_host: "*" - munin_node_bind_port: "4949" - munin_node_allowed_cidrs: [192.168.2.0/24] - munin_node_plugins: - - name: apc_nis - - name: hddtemp_smartctl - munin_node_config: { - "apc_nis": { - "env.host": "pve2.grote.lan", - "env.port": "3551" - } - } ### mgrote.postfix postfix_absender_mailadresse: info@mgrote.net postfix_absender_passwort: "{{ lookup('keepass', 'postfix_absender_passwort', 'password') }}" diff --git a/group_vars/docker.yml b/group_vars/docker.yml index 145be884..bc9573de 100644 --- a/group_vars/docker.yml +++ b/group_vars/docker.yml @@ -28,17 +28,6 @@ servers: - production - test - - username: gitlab-user - password: "{{ lookup('keepass', 'gitlab_user_linux_password_hash', 'password') }}" - update_password: on_create - ssh_key: "{{ lookup('keepass', 'gitlab_user_ssh_pubkey', 'password') }}" - use_sudo: yes - use_sudo_nopass: yes - user_state: present - groups: ssh, sudo, docker - servers: - - production - - test - username: ansible-user password: "{{ lookup('keepass', 'ansible_user_linux_password_hash', 'password') }}" update_password: on_create diff --git a/group_vars/proxmox.yml b/group_vars/proxmox.yml index def6b36c..7750f7b6 100644 --- a/group_vars/proxmox.yml +++ b/group_vars/proxmox.yml @@ -17,6 +17,33 @@ zfs_extra_max_usage_health: "80" ### mgrote.apcupsd apcupsd_slave_polltime: 10 #in Sekunden + ### geerlingguy.munin-node + munin_node_bind_host: "*" + munin_node_bind_port: "4949" + munin_node_allowed_cidrs: [192.168.2.0/24] + munin_node_plugins: + - name: apc_nis + - name: hddtemp_smartctl + - name: zpool_iostat + - name: zfsonlinux_stats_ + - name: zfsarcstats-counters + - name: zfs_usage_ + - name: zfs_arcstats + - name: zfs_list + munin_node_config: { + "apc_nis": { + "env.host": "pve2.grote.lan", + "env.port": "3551" + } + } + munin_node_install_plugins: + - remote_src: https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/zfs/zfs_arcstats + - remote_src: https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/zfs/zfs_usage_ + - remote_src: https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/zfs/zfsarcstats-counters + - remote_src: https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/zfs/zfsonlinux_stats_ + - remote_src: https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/zfs/zpool_iostat + - remote_src: https://raw.githubusercontent.com/munin-monitoring/contrib/master/plugins/zfs/zfs_list + # Ansible Variablen ### sudo diff --git a/inventory b/inventory index 4d1e0c0d..8fc86c03 100644 --- a/inventory +++ b/inventory @@ -58,10 +58,6 @@ all: hosts: gitea-test.grote.lan: gitea.grote.lan: - munin: - hosts: - munin-test.grote.lan: - munin.grote.lan: production: hosts: @@ -77,7 +73,6 @@ all: pve4.grote.lan: gitea.grote.lan: pihole2.grote.lan: - munin.grote.lan: test: hosts: wireguard-test.grote.lan: @@ -92,4 +87,3 @@ all: pve4-test.grote.lan: gitea-test.grote.lan: pihole2-test.grote.lan: - munin-test.grote.lan: diff --git a/playbooks/on-off/set_dns_resolver.yml b/playbooks/on-off/set_dns_resolver.yml index ce845a9e..78a22bdc 100644 --- a/playbooks/on-off/set_dns_resolver.yml +++ b/playbooks/on-off/set_dns_resolver.yml @@ -6,7 +6,7 @@ - name: Setze DNS-Resolver fuer pihole-* ansible.builtin.lineinfile: path: /etc/resolv.conf.head - line: nameserver 192.168.2.2 + line: nameserver 192.168.2.3 create: yes backrefs: false mode: 0664 diff --git a/roles/geerlingguy.munin-node/README.md b/roles/geerlingguy.munin-node/README.md index e4b4eaa9..1d5f30af 100644 --- a/roles/geerlingguy.munin-node/README.md +++ b/roles/geerlingguy.munin-node/README.md @@ -65,6 +65,17 @@ This configuration will generate a configuration file at `/etc/munin/plugin-conf env.regex bash env.name bash +#### Install external plugins + +You can install external plugins via `munin_node_install_plugins`. +Those plugins can be copied from local files or downloaded. For example: + + munin_node_install_plugins: [] + - src: files/munin/redis_ + - remote_src: https://raw.githubusercontent.com/ohitz/phpfpm-multi-munin-plugin/master/phpfpm-multi + + + ## Dependencies None. diff --git a/roles/geerlingguy.munin-node/defaults/main.yml b/roles/geerlingguy.munin-node/defaults/main.yml index c527b225..9e2ce160 100644 --- a/roles/geerlingguy.munin-node/defaults/main.yml +++ b/roles/geerlingguy.munin-node/defaults/main.yml @@ -24,6 +24,12 @@ munin_node_plugins: [] # - name: ps_test # plugin: ps_ +# List of munin plugins to install. +munin_node_install_plugins: [] + # - src: files/munin/redis_ + # - remote_src: https://raw.githubusercontent.com/ohitz/phpfpm-multi-munin-plugin/master/phpfpm-multi + + # Plugin configuration options (the key is the plugin heading, items within will # be options for the plugin). munin_node_config: { diff --git a/roles/geerlingguy.munin-node/tasks/main.yml b/roles/geerlingguy.munin-node/tasks/main.yml index 024a3efa..5c18e44a 100644 --- a/roles/geerlingguy.munin-node/tasks/main.yml +++ b/roles/geerlingguy.munin-node/tasks/main.yml @@ -28,6 +28,24 @@ mode: 0644 notify: restart munin-node +- name: Install extra plugins. + copy: + src: "{{ item.src }}" + dest: "{{ munin_plugin_src_path }}{{ item.src | basename }}" + mode: '0755' + with_items: "{{ munin_node_install_plugins }}" + when: item.src is defined + notify: restart munin-node + +- name: Install extra remote plugins. + get_url: + url: "{{ item.remote_src }}" + dest: "{{ munin_plugin_src_path }}{{ item.remote_src | basename }}" + mode: '0755' + with_items: "{{ munin_node_install_plugins }}" + when: item.remote_src is defined + notify: restart munin-node + - name: Enable additional plugins. file: # noqa 208 path: "{{ munin_plugin_dest_path }}{{ item.name }}"