From 9b3e5a664baf6dc9aa8fd9f9320b361cb3b42b36 Mon Sep 17 00:00:00 2001 From: mg Date: Fri, 24 Sep 2021 10:11:54 +0200 Subject: [PATCH] =?UTF-8?q?munin:=203.33=20=E2=80=93=20You=20Can=20(Not)?= =?UTF-8?q?=20Redo.=20(#203)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/203 Co-authored-by: mg Co-committed-by: mg --- group_vars/acng.yml | 8 +- group_vars/all.yml | 9 +- group_vars/docker.yml | 20 ++-- group_vars/fileserver.yml | 8 +- group_vars/pihole.yml | 23 ++++ group_vars/proxmox.yml | 38 ++++-- host_vars/docker-test.grote.lan.yml | 21 ++++ host_vars/docker2.grote.lan.yml | 111 +++++++++++++++++- .../meta/main.yml | 3 - roles/mgrote.munin-node/defaults/main.yml | 2 +- roles/mgrote.munin-node/tasks/additional.yml | 1 + 11 files changed, 203 insertions(+), 41 deletions(-) delete mode 100644 roles/mgrote.docker-compose-deploy/meta/main.yml diff --git a/group_vars/acng.yml b/group_vars/acng.yml index f9588e6f..9966eb09 100644 --- a/group_vars/acng.yml +++ b/group_vars/acng.yml @@ -23,15 +23,15 @@ ### geerlingguy.munin-node munin_node_plugins: - 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/extern/chrony - 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/extern/systemd_status - name: lvm_ - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/lvm_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/lvm_ config: | [lvm_*] user root - 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/extern/acng config: | env.logfile /var/log/apt-cacher-ng/apt-cacher.log diff --git a/group_vars/all.yml b/group_vars/all.yml index af255844..8b5dfb15 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -15,18 +15,21 @@ - name: ntp # verursacht zu viele dns ptr request - name: hddtempd # ersetzt durch hddtemp_smartctl - name: ipmi_power # für pve2, leeres diagramm + - name: docker_images + - name: docker_status munin_node_plugins: - 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/extern/chrony - 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/extern/systemd_status - name: lvm_ - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/lvm_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/lvm_ config: | [lvm_*] user root + ### mgrote.dotfiles dotfiles_repo_url: https://git.mgrote.net/mg/dotfiles dotfiles_repo_path: /home/mg/dotfiles diff --git a/group_vars/docker.yml b/group_vars/docker.yml index 216150bc..303f4f21 100644 --- a/group_vars/docker.yml +++ b/group_vars/docker.yml @@ -25,32 +25,28 @@ ### geerlingguy.munin-node munin_node_plugins: - 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/extern/chrony - 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/extern/systemd_status - name: lvm_ - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/lvm_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/lvm_ config: | [lvm_*] user root - name: docker_containers - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/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_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/docker_ - name: docker_memory - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/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_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/docker_ - name: docker_volumes - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/docker_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/docker_ ### mgrote.docker-compose-deploy docker_compose_base_dir: /home/mg/docker diff --git a/group_vars/fileserver.yml b/group_vars/fileserver.yml index 51e04d3a..1dd9db06 100644 --- a/group_vars/fileserver.yml +++ b/group_vars/fileserver.yml @@ -124,10 +124,10 @@ - name: lvm_ munin_node_plugins: - 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/extern/chrony - 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/extern/systemd_status - name: samba_users - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/samba_users + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/samba_users - 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/extern/samba_locked diff --git a/group_vars/pihole.yml b/group_vars/pihole.yml index cec0ab02..6f27aac1 100644 --- a/group_vars/pihole.yml +++ b/group_vars/pihole.yml @@ -29,3 +29,26 @@ ### mgrote.apt_manage_sources manage_sources_apt_proxy_server: "" manage_sources_apt_proxy_port: "" + ### geerlingguy.munin-node + munin_node_plugins: + - name: chrony + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/chrony + - name: systemd_status + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/systemd_status + - name: lvm_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/lvm_ + config: | + [lvm_*] + user root + - name: pihole_cache + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/pihole/pihole_cache + config: | + [pihole_*] + user root + env.host 127.0.0.1 + env.port 80 + env.api /admin/api.php + - name: pihole_clients + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/pihole/pihole_clients + - name: pihole_queries + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/pihole/pihole_queries diff --git a/group_vars/proxmox.yml b/group_vars/proxmox.yml index 7f4ea150..ed35ce18 100644 --- a/group_vars/proxmox.yml +++ b/group_vars/proxmox.yml @@ -21,32 +21,48 @@ - name: squid_requests - name: squid_traffic - name: nfsd4 + - name: nfsd + - name: kvm_vm_count + - name: proxmox_lxc_count + - name: proxmox_vm_count + - name: zfs_usage_rpool # liest falsch ein + - name: zfs_usage_hdd_data_raidz # liest falsch ein munin_node_plugins: - 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/extern/chrony - 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/extern/systemd_status - name: lvm_ - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/lvm_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/lvm_ config: | [lvm_*] user root - 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/extern/zfs_arcstats - name: zfsonlinux_stats_ - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfsonlinux_stats_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/zfsonlinux_stats_ - name: zpool_iostat - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zpool_iostat + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/zpool_iostat - name: zfs_list - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfs_list + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/zfs_list - name: zpool_capacity - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zpool_capacity + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/zpool_capacity - name: kvm_mem - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/kvm_mem + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/kvm_mem - 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/extern/kvm_net - name: kvm_cpu - src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/kvm_cpu + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/kvm_cpu + - name: zpool_fragmentation + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zpool_fragmentation + - name: proxmox_count + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/proxmox_count + config: | + [proxmox_count] + user root + group root + - name: zfs_count + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfs_count # Ansible Variablen ### sudo diff --git a/host_vars/docker-test.grote.lan.yml b/host_vars/docker-test.grote.lan.yml index a8639f9e..8de1d0b1 100644 --- a/host_vars/docker-test.grote.lan.yml +++ b/host_vars/docker-test.grote.lan.yml @@ -23,3 +23,24 @@ dir_name: docker-lazydocker repository_url: git.mgrote.net/mg/docker-lazydocker state: absent # danach löschen + - name: munin-master-test + dir_name: docker-munin-master-test + repository_url: git.mgrote.net/mg/docker-munin-master_test + state: present + ### geerlingguy.munin-node + munin_node_allowed_cidrs: [0.0.0.0/0] # weil der munin-server aus einem anderen subnet zugreift + munin_node_allowed_ips: # weil der munin-server aus einem anderen subnet zugreift + - '^127\.0\.0\.1$' + - '^::1$' + - ^0\.0\.0\.0$ + ### oefenweb.ufw + ufw_rules: # ist extra weil bei munin kein subnet angegeben ist + - rule: allow + to_port: 22 + protocol: tcp + comment: 'ssh' + from_ip: 192.168.2.0/24 + - rule: allow + to_port: 4949 + protocol: tcp + comment: 'munin' diff --git a/host_vars/docker2.grote.lan.yml b/host_vars/docker2.grote.lan.yml index 5f9a1f73..4bf50639 100644 --- a/host_vars/docker2.grote.lan.yml +++ b/host_vars/docker2.grote.lan.yml @@ -3,9 +3,7 @@ docker_compose_projects: - name: munin-master dir_name: docker-munin-master - repository_url: git.mgrote.net/mg/docker-munin-master - repository_user: mg - repository_user_password: "{{ lookup('keepass', 'gitea_mg_https_password', 'password') }}" + repository_url: git.mgrote.net/mg/docker-munin-master_production state: present - name: watchtower dir_name: docker-watchtower @@ -38,3 +36,110 @@ to_port: 4949 protocol: tcp comment: 'munin' + ### mgrote.apt_install_packages + programs_extra: + - libwww-curl-perl # für munin-plugin: unifi + - libjson-perl # für munin-plugin: unifi + ### geerlingguy.munin-node + munin_node_plugins: + - name: chrony + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/chrony + - name: systemd_status + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/systemd_status + - name: lvm_ + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/lvm_ + config: | + [lvm_*] + user root + - name: docker_containers + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/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/extern/docker_ + - name: docker_memory + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/docker_ + - name: docker_network + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/docker_ + - name: docker_volumes + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/docker_ + - name: mt_system_hex + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/mikrotik/mt_system + config: | + [mt_system_hex] + user root + env.ssh_user munin + env.ssh_password hallowelt + env.ssh_host 192.168.2.1 + - name: mt_system_crs309 + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/mikrotik/mt_system + config: | + [mt_system_crs309] + user root + env.ssh_user munin + env.ssh_password hallowelt + env.ssh_host 192.168.2.223 + - name: unifi + src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/unifi + config: | + [unifi*] + # User name to login to unifi controller API. Default is "ubnt". Ideally, this should + # point to a read-only account. + env.user munin + # Password to login to unifi controller API. Default is "ubnt" + env.pass hallowelt + # URL of the API, with port if needed. No trailing slash. + env.api_url https://docker2.grote.lan:8443 + # Verify SSL certificate name against host. + # Note: if using a default cloudkey certificate, this will fail unless you manually add it + # to the local keystore. + # Default is "yes" + env.ssl_verify_host no + # Verify Peer's SSL vertiicate. + # Note: if using a default cloudkey certificate, this will fail + # Default is "yes" + env.ssl_verify_peer no + # The human readable name of the unifi site - used for graph titles + env.name Unifi + # By default, Use standard munin well know categories - + env.force_category unifi + #--- + # Show device CPU utilization + env.enable_device_cpu yes + # Show device memory usage + env.enable_device_mem yes + # Show device load average (switches and APs only) + env.enable_device_load yes + # Show device uptime + env.enable_device_uptime yes + # Show number of clients connected to each device + env.enable_clients_device yes + # Show detailed graphs for each device (per device graphs) + env.enable_detail_clients_device yes + # Show number of clients connected to each network type + env.enable_clients_type yes + # Show detailed graphs for each client type (per type graphs) + env.enable_detail_clients_type yes + # Show unauthorized / authorized client list + # if you are not using the guest portal, this is useless + env.show_authorized_clients_type yes + # Show transfer statistics on switch ports + env.enable_xfer_port yes + # Show detailed graphs per switch port + env.enable_detail_xfer_port yes + # Hide ports that have no link (When set to no, unplugged ports will transfer 0, not be undefined) + env.hide_empty_xfer_port no + # Show transfer statistics per device + env.enable_xfer_device no + # Show detailed graphs for each device + env.enable_detail_xfer_device yes + # Show transfer statistics per named network + env.enable_xfer_network no + # Show detailed graphs for each named network + env.enable_detail_xfer_network no + # Show transfer statistics per radio + env.enable_xfer_radio no + # Show detailed graphs for each radio + env.enable_detail_xfer_radio no diff --git a/roles/mgrote.docker-compose-deploy/meta/main.yml b/roles/mgrote.docker-compose-deploy/meta/main.yml deleted file mode 100644 index bfb3fb7b..00000000 --- a/roles/mgrote.docker-compose-deploy/meta/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- - dependencies: - - role: geerlingguy.docker diff --git a/roles/mgrote.munin-node/defaults/main.yml b/roles/mgrote.munin-node/defaults/main.yml index 88ab1dc0..62cd3028 100644 --- a/roles/mgrote.munin-node/defaults/main.yml +++ b/roles/mgrote.munin-node/defaults/main.yml @@ -21,7 +21,7 @@ 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 +# src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/extern/docker_ #src # config_file_name: /etc/munin/plugin-conf.d/docker # where to put plugin config # content of config # config: | diff --git a/roles/mgrote.munin-node/tasks/additional.yml b/roles/mgrote.munin-node/tasks/additional.yml index 5386d726..0390072b 100644 --- a/roles/mgrote.munin-node/tasks/additional.yml +++ b/roles/mgrote.munin-node/tasks/additional.yml @@ -5,6 +5,7 @@ dest: "{{ munin_plugin_src_path }}{{ item.name }}" mode: '0755' loop: "{{ munin_node_plugins }}" + notify: restart munin-node - name: enable additional plugins file: