From e25db9f0ff6d3f474b20f5685109dcd527b8e65a Mon Sep 17 00:00:00 2001 From: mg Date: Sat, 27 Feb 2021 17:46:29 +0100 Subject: [PATCH] Munin. weitere Plugins + Umbau (#8) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Plugins in eigenes repo plugin zpool capacity eingefügt Doku Squid + noch ein falsches hddtemp entfernt falsches hddtemp entfernt eneues taskplugins entfernen yaml syntax geerlingguy umgebaut Doku Doku zfs_usage entfernt Bugfix: munin: zfs_arcstats Co-authored-by: Michael Grote Reviewed-on: https://git.mgrote.net/mg/ansible/pulls/8 Co-Authored-By: mg Co-Committed-By: mg --- group_vars/proxmox.yml | 29 +++-- playbooks/base/7_monitoring.yml | 3 +- roles/geerlingguy.munin-node/.ansible-lint | 3 - .../.github/FUNDING.yml | 4 - .../geerlingguy.munin-node/.github/stale.yml | 56 ---------- .../.github/workflows/ci.yml | 72 ------------ .../.github/workflows/release.yml | 38 ------- roles/geerlingguy.munin-node/.gitignore | 5 - roles/geerlingguy.munin-node/.yamllint | 11 -- roles/geerlingguy.munin-node/LICENSE | 20 ---- .../geerlingguy.munin-node/defaults/main.yml | 7 ++ .../geerlingguy.munin-node/handlers/main.yml | 4 +- roles/geerlingguy.munin-node/meta/main.yml | 28 +---- .../molecule/default/converge.yml | 21 ---- .../molecule/default/molecule.yml | 17 --- .../molecule/default/playbook-vars.yml | 36 ------ roles/geerlingguy.munin-node/tasks/main.yml | 105 +++++++++--------- roles/geerlingguy.munin-node/vars/Debian.yml | 3 - roles/geerlingguy.munin-node/vars/RedHat.yml | 3 - 19 files changed, 87 insertions(+), 378 deletions(-) delete mode 100644 roles/geerlingguy.munin-node/.ansible-lint delete mode 100644 roles/geerlingguy.munin-node/.github/FUNDING.yml delete mode 100644 roles/geerlingguy.munin-node/.github/stale.yml delete mode 100644 roles/geerlingguy.munin-node/.github/workflows/ci.yml delete mode 100644 roles/geerlingguy.munin-node/.github/workflows/release.yml delete mode 100644 roles/geerlingguy.munin-node/.gitignore delete mode 100644 roles/geerlingguy.munin-node/.yamllint delete mode 100644 roles/geerlingguy.munin-node/LICENSE delete mode 100644 roles/geerlingguy.munin-node/molecule/default/converge.yml delete mode 100644 roles/geerlingguy.munin-node/molecule/default/molecule.yml delete mode 100644 roles/geerlingguy.munin-node/molecule/default/playbook-vars.yml delete mode 100644 roles/geerlingguy.munin-node/vars/Debian.yml delete mode 100644 roles/geerlingguy.munin-node/vars/RedHat.yml diff --git a/group_vars/proxmox.yml b/group_vars/proxmox.yml index 7750f7b6..8ea146f2 100644 --- a/group_vars/proxmox.yml +++ b/group_vars/proxmox.yml @@ -26,25 +26,32 @@ - name: hddtemp_smartctl - name: zpool_iostat - name: zfsonlinux_stats_ - - name: zfsarcstats-counters - - name: zfs_usage_ - name: zfs_arcstats - name: zfs_list + - name: zpool_capacity 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 - - + munin_node_install_plugins: # in eigenes Repo gesichert + - remote_src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfs_arcstats + - remote_src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfsonlinux_stats_ + - remote_src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zpool_iostat + - remote_src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zfs_list + - remote_src: https://git.mgrote.net/mg/munin-plugins/raw/branch/master/zpool_capacity + munin_node_remove_plugins: + - name: meminfo # zhohe last + - name: hddtemp2 # ersetzt durch hddtemp_smartctl + - name: squid_cache + - name: squid_objectsize + - name: squid_requests + - name: squid_traffic + - name: nfsd + - name: nfsd4 + - name: hddtempd # ersetzt durch hddtemp_smartctl + - name: ipmi_power # für pve2, leeres diagramm # Ansible Variablen ### sudo sudo: false diff --git a/playbooks/base/7_monitoring.yml b/playbooks/base/7_monitoring.yml index 2b13c150..c84b814b 100644 --- a/playbooks/base/7_monitoring.yml +++ b/playbooks/base/7_monitoring.yml @@ -7,4 +7,5 @@ when: "'physical' in group_names" } ### Die Host müssen auch beim Docker-Container: "munin-master eingetragen" werden. - ### wird nur auf physichen Rechnern ausgeführt. + ### wird nur auf physischen Rechnern ausgeführt. + ### Wenn ein Plugin nicht geht: munin-node-configure --shell --families=contrib,auto | sh -x diff --git a/roles/geerlingguy.munin-node/.ansible-lint b/roles/geerlingguy.munin-node/.ansible-lint deleted file mode 100644 index acc82551..00000000 --- a/roles/geerlingguy.munin-node/.ansible-lint +++ /dev/null @@ -1,3 +0,0 @@ -skip_list: - - 'yaml' - - 'role-name' diff --git a/roles/geerlingguy.munin-node/.github/FUNDING.yml b/roles/geerlingguy.munin-node/.github/FUNDING.yml deleted file mode 100644 index 96b49383..00000000 --- a/roles/geerlingguy.munin-node/.github/FUNDING.yml +++ /dev/null @@ -1,4 +0,0 @@ -# These are supported funding model platforms ---- -github: geerlingguy -patreon: geerlingguy diff --git a/roles/geerlingguy.munin-node/.github/stale.yml b/roles/geerlingguy.munin-node/.github/stale.yml deleted file mode 100644 index c7ff1275..00000000 --- a/roles/geerlingguy.munin-node/.github/stale.yml +++ /dev/null @@ -1,56 +0,0 @@ -# Configuration for probot-stale - https://github.com/probot/stale - -# Number of days of inactivity before an Issue or Pull Request becomes stale -daysUntilStale: 90 - -# Number of days of inactivity before an Issue or Pull Request with the stale label is closed. -# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale. -daysUntilClose: 30 - -# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled) -onlyLabels: [] - -# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable -exemptLabels: - - pinned - - security - - planned - -# Set to true to ignore issues in a project (defaults to false) -exemptProjects: false - -# Set to true to ignore issues in a milestone (defaults to false) -exemptMilestones: false - -# Set to true to ignore issues with an assignee (defaults to false) -exemptAssignees: false - -# Label to use when marking as stale -staleLabel: stale - -# Limit the number of actions per hour, from 1-30. Default is 30 -limitPerRun: 30 - -pulls: - markComment: |- - This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution! - - Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale. - - unmarkComment: >- - This pull request is no longer marked for closure. - - closeComment: >- - This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details. - -issues: - markComment: |- - This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution! - - Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale. - - unmarkComment: >- - This issue is no longer marked for closure. - - closeComment: >- - This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details. diff --git a/roles/geerlingguy.munin-node/.github/workflows/ci.yml b/roles/geerlingguy.munin-node/.github/workflows/ci.yml deleted file mode 100644 index 1aa960e8..00000000 --- a/roles/geerlingguy.munin-node/.github/workflows/ci.yml +++ /dev/null @@ -1,72 +0,0 @@ ---- -name: CI -'on': - pull_request: - push: - branches: - - master - schedule: - - cron: "30 2 * * 3" - -defaults: - run: - working-directory: 'geerlingguy.munin-node' - -jobs: - - lint: - name: Lint - runs-on: ubuntu-latest - steps: - - name: Check out the codebase. - uses: actions/checkout@v2 - with: - path: 'geerlingguy.munin-node' - - - name: Set up Python 3. - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install test dependencies. - run: pip3 install yamllint ansible ansible-lint - - - name: Lint code. - run: | - yamllint . - ansible-lint - - molecule: - name: Molecule - runs-on: ubuntu-latest - strategy: - matrix: - include: - - distro: centos7 - playbook: converge.yml - - distro: ubuntu1804 - playbook: converge.yml - - distro: centos7 - playbook: playbook-vars.yml - - steps: - - name: Check out the codebase. - uses: actions/checkout@v2 - with: - path: 'geerlingguy.munin-node' - - - name: Set up Python 3. - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install test dependencies. - run: pip3 install ansible molecule[docker] docker - - - name: Run Molecule tests. - run: molecule test - env: - PY_COLORS: '1' - ANSIBLE_FORCE_COLOR: '1' - MOLECULE_DISTRO: ${{ matrix.distro }} - MOLECULE_PLAYBOOK: ${{ matrix.playbook }} diff --git a/roles/geerlingguy.munin-node/.github/workflows/release.yml b/roles/geerlingguy.munin-node/.github/workflows/release.yml deleted file mode 100644 index 57e9f7a6..00000000 --- a/roles/geerlingguy.munin-node/.github/workflows/release.yml +++ /dev/null @@ -1,38 +0,0 @@ ---- -# This workflow requires a GALAXY_API_KEY secret present in the GitHub -# repository or organization. -# -# See: https://github.com/marketplace/actions/publish-ansible-role-to-galaxy -# See: https://github.com/ansible/galaxy/issues/46 - -name: Release -'on': - push: - tags: - - '*' - -defaults: - run: - working-directory: 'geerlingguy.munin-node' - -jobs: - - release: - name: Release - runs-on: ubuntu-latest - steps: - - name: Check out the codebase. - uses: actions/checkout@v2 - with: - path: 'geerlingguy.munin-node' - - - name: Set up Python 3. - uses: actions/setup-python@v2 - with: - python-version: '3.x' - - - name: Install Ansible. - run: pip3 install ansible-base - - - name: Trigger a new import on Galaxy. - run: ansible-galaxy role import --api-key ${{ secrets.GALAXY_API_KEY }} $(echo ${{ github.repository }} | cut -d/ -f1) $(echo ${{ github.repository }} | cut -d/ -f2) diff --git a/roles/geerlingguy.munin-node/.gitignore b/roles/geerlingguy.munin-node/.gitignore deleted file mode 100644 index 8840c8f0..00000000 --- a/roles/geerlingguy.munin-node/.gitignore +++ /dev/null @@ -1,5 +0,0 @@ -*.retry -*/__pycache__ -*.pyc -.cache - diff --git a/roles/geerlingguy.munin-node/.yamllint b/roles/geerlingguy.munin-node/.yamllint deleted file mode 100644 index f2033dd2..00000000 --- a/roles/geerlingguy.munin-node/.yamllint +++ /dev/null @@ -1,11 +0,0 @@ ---- -extends: default - -rules: - line-length: - max: 120 - level: warning - -ignore: | - .github/stale.yml - .travis.yml diff --git a/roles/geerlingguy.munin-node/LICENSE b/roles/geerlingguy.munin-node/LICENSE deleted file mode 100644 index 4275cf3c..00000000 --- a/roles/geerlingguy.munin-node/LICENSE +++ /dev/null @@ -1,20 +0,0 @@ -The MIT License (MIT) - -Copyright (c) 2017 Jeff Geerling - -Permission is hereby granted, free of charge, to any person obtaining a copy of -this software and associated documentation files (the "Software"), to deal in -the Software without restriction, including without limitation the rights to -use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -the Software, and to permit persons to whom the Software is furnished to do so, -subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/roles/geerlingguy.munin-node/defaults/main.yml b/roles/geerlingguy.munin-node/defaults/main.yml index 9e2ce160..358f9fac 100644 --- a/roles/geerlingguy.munin-node/defaults/main.yml +++ b/roles/geerlingguy.munin-node/defaults/main.yml @@ -38,3 +38,10 @@ munin_node_config: { # "env.name": "bash" # } } + + +munin_node_remove_plugins: + - name: meminfo + +munin_node_log: /var/log/munin/munin-node.log +munin_node_pid: /var/run/munin/munin-node.pid diff --git a/roles/geerlingguy.munin-node/handlers/main.yml b/roles/geerlingguy.munin-node/handlers/main.yml index 7e0530be..648106c1 100644 --- a/roles/geerlingguy.munin-node/handlers/main.yml +++ b/roles/geerlingguy.munin-node/handlers/main.yml @@ -1,3 +1,5 @@ --- - name: restart munin-node - service: name=munin-node state=restarted + service: + name: munin-node + state: restarted diff --git a/roles/geerlingguy.munin-node/meta/main.yml b/roles/geerlingguy.munin-node/meta/main.yml index 828e45b4..c33327ea 100644 --- a/roles/geerlingguy.munin-node/meta/main.yml +++ b/roles/geerlingguy.munin-node/meta/main.yml @@ -1,27 +1,3 @@ --- -dependencies: [] - -galaxy_info: - # See: https://github.com/ansible/galaxy/issues/2393 - # role_name: munin-node - author: geerlingguy - description: Munin node monitoring endpoint for RedHat/CentOS or Debian/Ubuntu. - company: "Midwestern Mac, LLC" - license: "license (BSD, MIT)" - min_ansible_version: 2.4 - platforms: - - name: Debian - versions: - - all - - name: Ubuntu - versions: - - all - - name: EL - versions: - - 7 - - 8 - galaxy_tags: - - monitoring - - system - - munin - - metrics + dependencies: + - role: mgrote.apt_install_packages diff --git a/roles/geerlingguy.munin-node/molecule/default/converge.yml b/roles/geerlingguy.munin-node/molecule/default/converge.yml deleted file mode 100644 index 7c66f4cf..00000000 --- a/roles/geerlingguy.munin-node/molecule/default/converge.yml +++ /dev/null @@ -1,21 +0,0 @@ ---- -- name: Converge - hosts: all - become: true - - pre_tasks: - - name: Update apt cache. - apt: update_cache=true - when: ansible_os_family == 'Debian' - changed_when: false - - - name: Install test dependencies (Debian). - package: name=netcat state=present - when: ansible_os_family == 'Debian' - - - name: Install test dependencies (RedHat). - package: name=nc state=present - when: ansible_os_family == 'RedHat' - - roles: - - role: geerlingguy.munin-node diff --git a/roles/geerlingguy.munin-node/molecule/default/molecule.yml b/roles/geerlingguy.munin-node/molecule/default/molecule.yml deleted file mode 100644 index 74907107..00000000 --- a/roles/geerlingguy.munin-node/molecule/default/molecule.yml +++ /dev/null @@ -1,17 +0,0 @@ ---- -dependency: - name: galaxy -driver: - name: docker -platforms: - - name: instance - image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest" - command: ${MOLECULE_DOCKER_COMMAND:-""} - volumes: - - /sys/fs/cgroup:/sys/fs/cgroup:ro - privileged: true - pre_build_image: true -provisioner: - name: ansible - playbooks: - converge: ${MOLECULE_PLAYBOOK:-converge.yml} diff --git a/roles/geerlingguy.munin-node/molecule/default/playbook-vars.yml b/roles/geerlingguy.munin-node/molecule/default/playbook-vars.yml deleted file mode 100644 index 8156fabc..00000000 --- a/roles/geerlingguy.munin-node/molecule/default/playbook-vars.yml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- name: Converge - hosts: all - become: true - - vars: - munin_node_allowed_cidrs: ['10.0.0.0/8', '2001:db8::/32'] - munin_node_denied_cidrs: ['10.42.0.0/16', '2001:db8:42::/48'] - munin_node_plugins: - - name: uptime - - name: if_eth1 - plugin: if_ - - munin_node_config: { - "ps_test": { - "env.regex": "bash", - "env.name": "bash" - } - } - - pre_tasks: - - name: Update apt cache. - apt: update_cache=true cache_valid_time=600 - when: ansible_os_family == 'Debian' - changed_when: false - - - name: Install test dependencies (Debian). - package: name=netcat state=present - when: ansible_os_family == 'Debian' - - - name: Install test dependencies (RedHat). - package: name=nc state=present - when: ansible_os_family == 'RedHat' - - roles: - - role: geerlingguy.munin-node diff --git a/roles/geerlingguy.munin-node/tasks/main.yml b/roles/geerlingguy.munin-node/tasks/main.yml index 5c18e44a..59eeb80c 100644 --- a/roles/geerlingguy.munin-node/tasks/main.yml +++ b/roles/geerlingguy.munin-node/tasks/main.yml @@ -1,58 +1,63 @@ --- -- name: Include OS-specific variables. - include_vars: "{{ ansible_os_family }}.yml" + - name: Ensure munin-node is installed (Debian). + apt: + name: munin-node + state: present + when: ansible_os_family == 'Debian' -- name: Ensure munin-node is installed (RedHat). - yum: name=munin-node state=present enablerepo=epel - when: ansible_os_family == 'RedHat' + - 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: Ensure munin-node is installed (Debian). - apt: name=munin-node state=present - when: ansible_os_family == 'Debian' + - 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: 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: 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: 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: 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: 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: Enable additional plugins. + file: # noqa 208 + path: "{{ munin_plugin_dest_path }}{{ item.name }}" + src: "{{ munin_plugin_src_path }}{{ item.plugin | default( item.name ) }}" + state: link + with_items: "{{ munin_node_plugins }}" + 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: remove unwanted plugins + file: # noqa 208 + path: "{{ munin_plugin_dest_path }}{{ item.name }}" + state: absent + with_items: "{{ munin_node_remove_plugins }}" + notify: restart munin-node -- name: Enable additional plugins. - file: # noqa 208 - path: "{{ munin_plugin_dest_path }}{{ item.name }}" - src: "{{ munin_plugin_src_path }}{{ item.plugin | default( item.name ) }}" - state: link - with_items: "{{ munin_node_plugins }}" - notify: restart munin-node - -- name: Ensure munin-node is running. - service: name=munin-node state=started enabled=yes + - name: Ensure munin-node is running. + service: + name: munin-node + state: started + enabled: yes diff --git a/roles/geerlingguy.munin-node/vars/Debian.yml b/roles/geerlingguy.munin-node/vars/Debian.yml deleted file mode 100644 index a7d2947a..00000000 --- a/roles/geerlingguy.munin-node/vars/Debian.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -munin_node_log: /var/log/munin/munin-node.log -munin_node_pid: /var/run/munin/munin-node.pid diff --git a/roles/geerlingguy.munin-node/vars/RedHat.yml b/roles/geerlingguy.munin-node/vars/RedHat.yml deleted file mode 100644 index b5f3c433..00000000 --- a/roles/geerlingguy.munin-node/vars/RedHat.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -munin_node_log: /var/log/munin-node/munin-node.log -munin_node_pid: /var/run/munin/munin-node.pid