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.
44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
---
|
|
# 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
|