- New borgmatic_metrics ansible role: - Collects borg repository and archive stats hourly - Exports to Prometheus via textfile collector - Metrics: repo size, dedup ratio, archive count, last backup stats - New Grafana dashboard "Borgmatic Backups": - Repository status and disk usage - Backup size trends over time - New data per backup (bar chart) - Deduplication ratio - Time since last backup with alerting thresholds Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
43 lines
1.3 KiB
YAML
43 lines
1.3 KiB
YAML
---
|
|
- name: Ensure metrics directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ borgmatic_metrics_dir }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Ensure log directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ borgmatic_metrics_log_dir }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Ensure bin directory exists
|
|
ansible.builtin.file:
|
|
path: "{{ borgmatic_metrics_script | dirname }}"
|
|
state: directory
|
|
mode: '0755'
|
|
|
|
- name: Deploy borgmatic-metrics script
|
|
ansible.builtin.template:
|
|
src: borgmatic-metrics.sh.j2
|
|
dest: "{{ borgmatic_metrics_script }}"
|
|
mode: '0755'
|
|
|
|
- name: Deploy borgmatic-metrics LaunchAgent plist
|
|
ansible.builtin.template:
|
|
src: borgmatic-metrics.plist.j2
|
|
dest: ~/Library/LaunchAgents/mcquack.eblume.borgmatic-metrics.plist
|
|
mode: '0644'
|
|
notify: Reload borgmatic-metrics
|
|
|
|
- name: Check if borgmatic-metrics LaunchAgent is loaded
|
|
ansible.builtin.command: launchctl list mcquack.eblume.borgmatic-metrics
|
|
register: borgmatic_metrics_launchctl_check
|
|
changed_when: false
|
|
failed_when: false
|
|
|
|
- name: Load borgmatic-metrics LaunchAgent if not loaded
|
|
ansible.builtin.command: launchctl load ~/Library/LaunchAgents/mcquack.eblume.borgmatic-metrics.plist
|
|
when: borgmatic_metrics_launchctl_check.rc != 0
|
|
changed_when: true
|
|
failed_when: false
|