feat(zfs): add capacity metrics and Grafana dashboard

Deploy an hourly systemd timer that writes pool and dataset capacity to
node_exporter's textfile collector, since --collector.zfs exposes only
ARC/I-O/state. Add a provisioned 'ZFS - Pools & Datasets' dashboard with
per-pool totals, per-dataset used/quota and daily growth panels.
This commit is contained in:
Clément Désiles
2026-09-18 15:25:23 +02:00
parent 501671770f
commit c127336321
10 changed files with 317 additions and 1 deletions
+4
View File
@@ -5,3 +5,7 @@
ansible.builtin.include_tasks: pools.yml
- name: "Setup ZFS datasets: filesystems, snapshots, volumes"
ansible.builtin.include_tasks: datasets.yml
- name: Setup ZFS capacity metrics
ansible.builtin.include_tasks: metrics.yml
when: zfs_metrics_enabled | bool
+43
View File
@@ -0,0 +1,43 @@
---
# ZFS capacity metrics, exposed to Prometheus through node_exporter's textfile
# collector (see roles/node_exporter). Runs hourly as a root system timer.
- name: Deploy ZFS metrics script
ansible.builtin.template:
src: zfs-metrics.sh.j2
dest: "{{ zfs_metrics_script_path }}"
owner: root
group: root
mode: "0755"
- name: Deploy ZFS metrics systemd service
ansible.builtin.template:
src: zfs-metrics.service.j2
dest: /etc/systemd/system/zfs-metrics.service
owner: root
group: root
mode: "0644"
notify: Reload systemd
- name: Deploy ZFS metrics systemd timer
ansible.builtin.template:
src: zfs-metrics.timer.j2
dest: /etc/systemd/system/zfs-metrics.timer
owner: root
group: root
mode: "0644"
notify: Reload systemd
- name: Flush handlers before enabling the timer
ansible.builtin.meta: flush_handlers
- name: Enable and start ZFS metrics timer
ansible.builtin.systemd:
name: zfs-metrics.timer
enabled: true
state: started
- name: Collect ZFS metrics now
ansible.builtin.systemd:
name: zfs-metrics.service
state: started