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_pass: "{{ lookup('keepass', 'acng_webinterface', 'password') }}"
### geerlingguy.munin-node
munin_node_additional_plugins:
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: acng
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/acng
munin_node_config: {
"acng": {
"env.logfile /var/log/apt-cacher-ng/apt-cacher.log"
}
}
config: |
env.logfile /var/log/apt-cacher-ng/apt-cacher.log

View File

@ -12,35 +12,20 @@
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: docker_cpu
- name: lvm_
munin_node_additional_plugins:
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
munin_node_config: {
"lvm_": {
"user munin"
}
}
- name: lvm_
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/lvm_
config: |
[lvm_*]
user root
### mgrote.dotfiles
dotfiles_repo_url: https://git.mgrote.net/mg/dotfiles

View File

@ -2,6 +2,10 @@
### geerlingguy.docker
docker_users:
- mg
### geerlingguy.pip
pip_package: python3-pip
pip_install_packages:
- name: docker # für munin-plugin docker_
### mgrote.restic
restic_folders_to_backup: /usr/local /etc /root /home /var/lib/docker
restic_cron_hours: "*/4"
@ -17,3 +21,36 @@
/var/lib/docker/volumes/docker-photoprism_pp_smb_bilder***/**
# https://github.com/restic/restic/issues/1005
# 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
### 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
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony
- name: systemd_status
@ -124,26 +131,3 @@
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/samba_users
- name: 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_*
zfs_extra_max_usage_health: "80"
### 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
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: zfs_arcstats
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfs_arcstats
- name: zfsonlinux_stats_
@ -29,28 +45,8 @@
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: kvm_io
- name: kvm_cpu
- name: docker_mem
- name: apc_nis
- name: lvm_
src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/kvm_cpu
# Ansible Variablen
### sudo

View File

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

View File

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

View File

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

View File

@ -170,7 +170,6 @@
cron_day_of_week_zfs_scrub: "*"
cron_month_zfs_scrub: "*/2"
### mgrote.zfs_sanoid
sanoid_datasets:
- path: 'hdd_data_raidz/data_crypt'
@ -243,46 +242,3 @@
cv4pve_vmid: all,-127,-158,-112,-100
cv4pve_keep_snapshots: 1
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
tasks:

View File

@ -11,24 +11,22 @@
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_port: "4949" # bind to port
munin_node_log_level: 4 # Loglevel
# Plugin configuration options (the key is the plugin heading, items within will
# be options for the plugin).
munin_node_config: {
# "ps_test": {
# "env.regex": "bash",
# "env.name": "bash"
# }
}
# Source and destination of munin plugins.
munin_plugin_src_path: /usr/share/munin/plugins/
munin_plugin_dest_path: /etc/munin/plugins/
munin_node_additional_plugins: # must be a textfile
# - name: chrony
# src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/chrony
# oder
# - name: apc_nis # wenn das plugin schon lokal vorhanden ist
munin_node_disabled_plugins:
# - name: meminfo # zu hohe last
munin_plugin_conf_dest_path: /etc/munin/plugin-conf.d/
# munin_node_plugins: #plugins to install
# - name: docker_volumes # name
# src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_ #src
# config_file_name: /etc/munin/plugin-conf.d/docker # where to put plugin config
# content of config
# 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
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: 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
- name: include install-tasks
include_tasks: install.yml
- name: include plugin-tasks
include_tasks: additional.yml
when: munin_node_plugins is defined
- name: include remove-tasks
include_tasks: remove.yml
when: munin_node_disabled_plugins is defined

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 () }}
#
log_level 4
log_level {{ munin_node_log_level }}
log_file {{ munin_node_log }}
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 %}