zfs_host: zed and pool capacity and scrub metrics for the node exporter textfile collector

This commit is contained in:
2026-10-25 15:09:50 +00:00
parent f91a9b8fc9
commit 89821b479b
5 changed files with 110 additions and 0 deletions
+41
View File
@@ -0,0 +1,41 @@
---
# ZFS event daemon and pool metrics for the node exporter. zed keeps its default zed.rc and
# logs to the journal, which journal_upload ships.
- name: Install the ZFS event daemon
ansible.builtin.apt:
name: zfs-zed
install_recommends: false
state: present
- name: Enable the ZFS event daemon
ansible.builtin.systemd:
name: zfs-zed
enabled: true
state: started
# Check mode does not install the package.
ignore_errors: "{{ ansible_check_mode }}"
- name: Install the pool metrics script
ansible.builtin.template:
src: zfs-pool-metrics.j2
dest: /usr/local/sbin/zfs-pool-metrics
mode: "0755"
- name: Install the pool metrics units
ansible.builtin.template:
src: "{{ item }}.j2"
dest: /etc/systemd/system/{{ item }}
mode: "0644"
loop:
- zfs-pool-metrics.service
- zfs-pool-metrics.timer
register: zfs_host_units
- name: Enable the pool metrics timer
ansible.builtin.systemd:
name: zfs-pool-metrics.timer
enabled: true
state: started
daemon_reload: "{{ zfs_host_units.changed }}"
# Check mode does not write the units.
ignore_errors: "{{ ansible_check_mode }}"