munin 2.0: you can (not) rebuild (#202)

Co-authored-by: Michael Grote <michael.grote@posteo.de>
Reviewed-on: mg/ansible#202
Co-authored-by: mg <mg@noreply.git.mgrote.net>
Co-committed-by: mg <mg@noreply.git.mgrote.net>
This commit is contained in:
Michael Grote 2021-09-13 19:26:31 +02:00
parent f0389aaada
commit 7799f2a4fe
17 changed files with 181 additions and 216 deletions

View file

@ -21,15 +21,17 @@
acng_server_auth_user: acngadmin acng_server_auth_user: acngadmin
acng_server_auth_pass: "{{ lookup('keepass', 'acng_webinterface', 'password') }}" acng_server_auth_pass: "{{ lookup('keepass', 'acng_webinterface', 'password') }}"
### geerlingguy.munin-node ### geerlingguy.munin-node
munin_node_additional_plugins: munin_node_plugins:
- name: chrony - name: chrony
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony
- name: systemd_status - name: systemd_status
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/systemd_status src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/systemd_status
- name: lvm_
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/lvm_
config: |
[lvm_*]
user root
- name: acng - name: acng
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/acng src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/acng
munin_node_config: { config: |
"acng": { env.logfile /var/log/apt-cacher-ng/apt-cacher.log
"env.logfile /var/log/apt-cacher-ng/apt-cacher.log"
}
}

View file

@ -12,35 +12,20 @@
munin_node_disabled_plugins: munin_node_disabled_plugins:
- name: meminfo # zu hohe last - name: meminfo # zu hohe last
- name: hddtemp2 # ersetzt durch hddtemp_smartctl - name: hddtemp2 # ersetzt durch hddtemp_smartctl
- name: squid_cache
- name: squid_objectsize
- name: squid_requests
- name: squid_traffic
- name: nfsd
- name: samba
- name: nfsd4
- name: ntp # verursacht zu viele dns ptr request - name: ntp # verursacht zu viele dns ptr request
- name: cronjobs
- name: hddtempd # ersetzt durch hddtemp_smartctl - name: hddtempd # ersetzt durch hddtemp_smartctl
- name: ipmi_power # für pve2, leeres diagramm - name: ipmi_power # für pve2, leeres diagramm
- name: fail2ban munin_node_plugins:
- name: fail2ban_
- name: apcupsd_pct
- name: kvm_io
- name: kvm_cpu
- name: docker_mem
- name: docker_cpu
- name: lvm_
munin_node_additional_plugins:
- name: chrony - name: chrony
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony
- name: systemd_status - name: systemd_status
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/systemd_status src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/systemd_status
munin_node_config: { - name: lvm_
"lvm_": { src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/lvm_
"user munin" config: |
} [lvm_*]
} user root
### mgrote.dotfiles ### mgrote.dotfiles
dotfiles_repo_url: https://git.mgrote.net/mg/dotfiles dotfiles_repo_url: https://git.mgrote.net/mg/dotfiles

View file

@ -2,6 +2,10 @@
### geerlingguy.docker ### geerlingguy.docker
docker_users: docker_users:
- mg - mg
### geerlingguy.pip
pip_package: python3-pip
pip_install_packages:
- name: docker # für munin-plugin docker_
### mgrote.restic ### mgrote.restic
restic_folders_to_backup: /usr/local /etc /root /home /var/lib/docker restic_folders_to_backup: /usr/local /etc /root /home /var/lib/docker
restic_cron_hours: "*/4" restic_cron_hours: "*/4"
@ -17,3 +21,36 @@
/var/lib/docker/volumes/docker-photoprism_pp_smb_bilder***/** /var/lib/docker/volumes/docker-photoprism_pp_smb_bilder***/**
# https://github.com/restic/restic/issues/1005 # https://github.com/restic/restic/issues/1005
# https://forum.restic.net/t/exclude-syntax-confusion/1531/12 # https://forum.restic.net/t/exclude-syntax-confusion/1531/12
### geerlingguy.munin-node
munin_node_plugins:
- name: chrony
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony
- name: systemd_status
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/systemd_status
- name: lvm_
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/lvm_
config: |
[lvm_*]
user root
- name: docker_containers
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_
config: |
[docker_*]
user root
env.DOCKER_HOST unix://run/docker.sock
- name: docker_cpu
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_
- name: docker_images
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_
- name: docker_memory
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_
- name: docker_network
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_
- name: docker_status
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_
- name: docker_volumes
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_
### mgrote.docker-compose-deploy
docker_compose_base_dir: /home/mg/docker

View file

@ -115,7 +115,14 @@
from_ip: 192.168.2.144/24 from_ip: 192.168.2.144/24
### geerlingguy.munin-node ### geerlingguy.munin-node
munin_node_additional_plugins: munin_node_disabled_plugins:
- name: meminfo # zu hohe last
- name: hddtemp2 # ersetzt durch hddtemp_smartctl
- name: ntp # verursacht zu viele dns ptr request
- name: hddtempd # ersetzt durch hddtemp_smartctl
- name: ipmi_power # für pve2, leeres diagramm
- name: lvm_
munin_node_plugins:
- name: chrony - name: chrony
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony
- name: systemd_status - name: systemd_status
@ -124,26 +131,3 @@
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/samba_users src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/samba_users
- name: samba_locked - name: samba_locked
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/samba_locked src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/samba_locked
munin_node_disabled_plugins:
- name: meminfo # zu hohe last
- name: hddtemp2 # ersetzt durch hddtemp_smartctl
- name: squid_cache
- name: squid_objectsize
- name: squid_requests
- name: squid_traffic
- name: nfsd
- name: samba
- name: nfsd4
- name: ntp # verursacht zu viele dns ptr request
- name: cronjobs
- name: hddtempd # ersetzt durch hddtemp_smartctl
- name: ipmi_power # für pve2, leeres diagramm
- name: fail2ban
- name: fail2ban_
- name: apcupsd_pct
- name: kvm_io
- name: kvm_cpu
- name: docker_mem
- name: cpuspeed
- name: acpi
- name: lvm_

View file

@ -10,11 +10,27 @@
### mgrote.zfs_extra # Variablen für mgrote.zfs_health/trim/scrub/zed/arc_mem/ sind zusammengefasst unter zfs_extra_* ### mgrote.zfs_extra # Variablen für mgrote.zfs_health/trim/scrub/zed/arc_mem/ sind zusammengefasst unter zfs_extra_*
zfs_extra_max_usage_health: "80" zfs_extra_max_usage_health: "80"
### geerlingguy.munin-node ### geerlingguy.munin-node
munin_node_additional_plugins: munin_node_disabled_plugins:
- name: meminfo # zu hohe last
- name: hddtemp2 # ersetzt durch hddtemp_smartctl
- name: ntp # verursacht zu viele dns ptr request
- name: hddtempd # ersetzt durch hddtemp_smartctl
- name: ipmi_power # für pve2, leeres diagramm
- name: squid_cache
- name: squid_objectsize
- name: squid_requests
- name: squid_traffic
- name: nfsd4
munin_node_plugins:
- name: chrony - name: chrony
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony
- name: systemd_status - name: systemd_status
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/systemd_status src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/systemd_status
- name: lvm_
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/lvm_
config: |
[lvm_*]
user root
- name: zfs_arcstats - name: zfs_arcstats
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfs_arcstats src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfs_arcstats
- name: zfsonlinux_stats_ - name: zfsonlinux_stats_
@ -29,28 +45,8 @@
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/kvm_mem src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/kvm_mem
- name: kvm_net - name: kvm_net
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/kvm_net src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/kvm_net
munin_node_disabled_plugins:
- name: meminfo # zu hohe last
- name: hddtemp2 # ersetzt durch hddtemp_smartctl
- name: squid_cache
- name: squid_objectsize
- name: squid_requests
- name: squid_traffic
- name: nfsd
- name: samba
- name: nfsd4
- name: ntp # verursacht zu viele dns ptr request
- name: cronjobs
- name: hddtempd # ersetzt durch hddtemp_smartctl
- name: ipmi_power # für pve2, leeres diagramm
- name: fail2ban
- name: fail2ban_
- name: apcupsd_pct
- name: kvm_io
- name: kvm_cpu - name: kvm_cpu
- name: docker_mem src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/kvm_cpu
- name: apc_nis
- name: lvm_
# Ansible Variablen # Ansible Variablen
### sudo ### sudo

View file

@ -1,6 +1,5 @@
--- ---
### mgrote.docker-compose-deploy ### mgrote.docker-compose-deploy
docker_compose_base_dir: /home/mg/docker
docker_compose_projects: docker_compose_projects:
- name: munin-master - name: munin-master
dir_name: docker-munin-master dir_name: docker-munin-master

View file

@ -1,6 +1,5 @@
--- ---
### mgrote.docker-compose-deploy ### mgrote.docker-compose-deploy
docker_compose_base_dir: /home/mg/docker
docker_compose_projects: docker_compose_projects:
- name: miniflux - name: miniflux
dir_name: docker-miniflux dir_name: docker-miniflux

View file

@ -1,6 +1,5 @@
--- ---
### mgrote.docker-compose-deploy ### mgrote.docker-compose-deploy
docker_compose_base_dir: /home/mg/docker
docker_compose_projects: docker_compose_projects:
- name: watchtower - name: watchtower
dir_name: docker-watchtower dir_name: docker-watchtower

View file

@ -170,7 +170,6 @@
cron_day_of_week_zfs_scrub: "*" cron_day_of_week_zfs_scrub: "*"
cron_month_zfs_scrub: "*/2" cron_month_zfs_scrub: "*/2"
### mgrote.zfs_sanoid ### mgrote.zfs_sanoid
sanoid_datasets: sanoid_datasets:
- path: 'hdd_data_raidz/data_crypt' - path: 'hdd_data_raidz/data_crypt'
@ -243,46 +242,3 @@
cv4pve_vmid: all,-127,-158,-112,-100 cv4pve_vmid: all,-127,-158,-112,-100
cv4pve_keep_snapshots: 1 cv4pve_keep_snapshots: 1
cv4pve_dl_link: "https://github.com/Corsinvest/cv4pve-autosnap/releases/download/v1.10.0/cv4pve-autosnap-linux-x64.zip" cv4pve_dl_link: "https://github.com/Corsinvest/cv4pve-autosnap/releases/download/v1.10.0/cv4pve-autosnap-linux-x64.zip"
### geerlingguy.munin-node
munin_node_additional_plugins:
- name: chrony
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony
- name: systemd_status
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/systemd_status
- name: zfs_arcstats
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfs_arcstats
- name: zfsonlinux_stats_
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfsonlinux_stats_
- name: zpool_iostat
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zpool_iostat
- name: zfs_list
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfs_list
- name: zpool_capacity
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zpool_capacity
- name: kvm_mem
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/kvm_mem
- name: kvm_net
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/kvm_net
munin_node_disabled_plugins:
- name: meminfo # zu hohe last
- name: hddtemp2 # ersetzt durch hddtemp_smartctl
- name: squid_cache
- name: squid_objectsize
- name: squid_requests
- name: squid_traffic
- name: nfsd
- name: samba
- name: nfsd4
- name: ntp # verursacht zu viele dns ptr request
- name: cronjobs
- name: hddtempd # ersetzt durch hddtemp_smartctl
- name: ipmi_power # für pve2, leeres diagramm
- name: fail2ban
- name: fail2ban_
- name: apcupsd_pct
- name: apc_nis
- name: kvm_io
- name: kvm_cpu
- name: docker_mem
- name: lvm_

View file

@ -1,5 +1,5 @@
--- ---
- hosts: all,!proxmox - hosts: all
become: yes become: yes
tasks: tasks:

View file

@ -11,24 +11,22 @@
munin_node_denied_cidrs: [] # a list of addresses that are not allowed to connect munin_node_denied_cidrs: [] # a list of addresses that are not allowed to connect
munin_node_bind_host: "0.0.0.0" # bind to interface munin_node_bind_host: "0.0.0.0" # bind to interface
munin_node_bind_port: "4949" # bind to port munin_node_bind_port: "4949" # bind to port
munin_node_log_level: 4 # Loglevel
# Plugin configuration options (the key is the plugin heading, items within will # Plugin configuration options (the key is the plugin heading, items within will
# be options for the plugin). # be options for the plugin).
munin_node_config: {
# "ps_test": {
# "env.regex": "bash",
# "env.name": "bash"
# }
}
# Source and destination of munin plugins. # Source and destination of munin plugins.
munin_plugin_src_path: /usr/share/munin/plugins/ munin_plugin_src_path: /usr/share/munin/plugins/
munin_plugin_dest_path: /etc/munin/plugins/ munin_plugin_dest_path: /etc/munin/plugins/
munin_node_additional_plugins: # must be a textfile munin_plugin_conf_dest_path: /etc/munin/plugin-conf.d/
# - name: chrony # munin_node_plugins: #plugins to install
# src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony # - name: docker_volumes # name
# oder # src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_ #src
# - name: apc_nis # wenn das plugin schon lokal vorhanden ist # config_file_name: /etc/munin/plugin-conf.d/docker # where to put plugin config
munin_node_disabled_plugins: # content of config
# - name: meminfo # zu hohe last # config: |
# user root
# env.DOCKER_HOST unix://run/docker.sock
#aufräum task der plguins einmal leer macht(beide src und dest) # munin_node_disabled_plugins: # remove plugins from running config
# - name: meminfo

View file

@ -0,0 +1,29 @@
---
- name: download additional plugins
get_url:
url: "{{ item.src }}"
dest: "{{ munin_plugin_src_path }}{{ item.name }}"
mode: '0755'
loop: "{{ munin_node_plugins }}"
- name: enable additional plugins
file:
src: "{{ munin_plugin_src_path }}{{ item.name }}"
dest: "{{ munin_plugin_dest_path }}{{ item.name }}"
state: link
notify: restart munin-node
loop: "{{ munin_node_plugins }}"
- name: copy additional plugin-config
copy:
content: "{{ item.config }}"
dest: "{{ munin_plugin_conf_dest_path }}{{ item.name }}"
notify: restart munin-node
loop: "{{ munin_node_plugins }}"
when: item.config is defined
- name: Ensure munin-node is running.
service:
name: munin-node
state: started
enabled: yes

View file

@ -0,0 +1,36 @@
---
- name: install packages
apt:
name: munin-node
state: present
register: install
- name: create directories
file:
path: "{{ item }}"
state: directory
loop:
- /etc/munin
- /etc/munin/plugin-conf.d
- /etc/munin/plugins
- name: Copy munin-node configuration.
template:
src: munin-node.conf.j2
dest: /etc/munin/munin-node.conf
owner: root
group: root
mode: 0644
notify: restart munin-node
- name: munin-node-configure --shell
ansible.builtin.shell: munin-node-configure --shell
register: output_conf
changed_when: "output_conf.rc != 0"
ignore_errors: yes # ignoriere fehler
when: install.changed
- name: munin-node-configure --shell - 2
ansible.builtin.shell: munin-node-configure --shell --families=contrib,auto | sh -x
ignore_errors: yes # ignoriere fehler
when: install.changed

View file

@ -1,71 +1,9 @@
--- ---
- name: install packages - name: include install-tasks
apt: include_tasks: install.yml
name: munin-node - name: include plugin-tasks
state: present include_tasks: additional.yml
register: install when: munin_node_plugins is defined
- name: include remove-tasks
- name: create directories include_tasks: remove.yml
file: when: munin_node_disabled_plugins is defined
path: "{{ item }}"
state: directory
loop:
- /etc/munin
- /etc/munin/plugin-conf.d
- /etc/munin/plugins
- name: Copy munin-node configuration.
template:
src: munin-node.conf.j2
dest: /etc/munin/munin-node.conf
owner: root
group: root
mode: 0644
notify: restart munin-node
- name: Generate plugin configuration.
template:
src: plugin-conf.j2
dest: /etc/munin/plugin-conf.d/ansible.conf
owner: root
group: root
mode: 0644
notify: restart munin-node
- name: munin-node-configure --shell
ansible.builtin.shell: munin-node-configure --shell
register: output_conf
changed_when: "output_conf.rc != 0"
ignore_errors: yes # ignoriere fehler
when: install.changed
- name: Install additional plugins.
get_url:
url: "{{ item.src }}"
dest: "{{ munin_plugin_src_path }}{{ item.name }}"
mode: '0755'
loop: "{{ munin_node_additional_plugins }}"
when: (item.src is defined) and (item.name is defined)
- name: Enable additional plugins.
file:
src: "{{ munin_plugin_src_path }}{{ item.name }}"
dest: "{{ munin_plugin_dest_path }}{{ item.name }}"
state: link
loop: "{{ munin_node_additional_plugins }}"
notify: restart munin-node
when: item.name is defined
- name: disable unwanted plugins
file:
path: "{{ munin_plugin_dest_path }}{{ item.name }}"
state: absent
loop: "{{ munin_node_disabled_plugins }}"
notify: restart munin-node
when: item.name is defined
- name: Ensure munin-node is running.
service:
name: munin-node
state: started
enabled: yes

View file

@ -0,0 +1,16 @@
---
- name: remove unwanted plugins
file:
path: "{{ munin_plugin_dest_path }}{{ item.name }}"
state: absent
loop: "{{ munin_node_disabled_plugins }}"
notify: restart munin-node
when: munin_node_disabled_plugins is defined
- name: remove additional plugin-config
file:
state: absent
dest: "{{ munin_plugin_conf_dest_path }}{{ item.name }}"
notify: restart munin-node
loop: "{{ munin_node_disabled_plugins }}"
when: munin_node_disabled_plugins is defined

View file

@ -1,7 +1,6 @@
{{ file_header | default () }} {{ file_header | default () }}
#
log_level 4 log_level {{ munin_node_log_level }}
log_file {{ munin_node_log }} log_file {{ munin_node_log }}
pid_file {{ munin_node_pid }} pid_file {{ munin_node_pid }}

View file

@ -1,8 +0,0 @@
{{ file_header | default () }}
{% for section,directives in munin_node_config.items() | list %}
[{{section}}]
{% for name,val in directives.items() | list %}
{{ name }} {{ val }}
{% endfor %}
{% endfor %}