: restic munin plugins

This commit is contained in:
VC
2025-02-25 07:56:29 +01:00
parent e7a070d099
commit aa4ff098fc
6 changed files with 91 additions and 2 deletions

View File

@@ -0,0 +1,49 @@
#!/bin/bash
case $1 in
config)
cat << 'EOF'
multigraph restic_file_processed
graph_title Files/dirs processed by restic
graph_vlabel Number of files/dirs processed by restic
graph_args --base 1000 -l 0
graph_category restic
files_new.label files_new
files_changed.label files_changed
files_unmodified.label files_unmodified
dirs_new.label dirs_new
dirs_changed.label dirs_changed
dirs_unmodified.label dirs_unmodified
EOF
cat << 'EOF'
multigraph restic_data_added
graph_title Data added to repo by restic
graph_vlabel Data added in bytes
graph_args --base 1024 -l 0
graph_category restic
data_added.label raw_data_added
data_added_packed.label compressed_data_added
EOF
cat << 'EOF'
multigraph restic_backup_duration
graph_title Restic backup duration
graph_vlabel Duration of restic backup (seconds)
graph_args --base 1000 -l 0
graph_category restic
total_duration.label total_duration
EOF
exit 0;;
esac
echo "multigraph restic_file_processed"
echo "files_new.value $(cat ${RESTIC_SUMMARY_LOG} | jq -r .files_new)"
echo "files_changed.value $(cat ${RESTIC_SUMMARY_LOG} | jq -r .files_changed)"
echo "files_unmodified.value $(cat ${RESTIC_SUMMARY_LOG} | jq -r .files_unmodified)"
echo "dirs_new.value $(cat ${RESTIC_SUMMARY_LOG} | jq -r .dirs_new)"
echo "dirs_changed.value $(cat ${RESTIC_SUMMARY_LOG} | jq -r .dirs_changed)"
echo "dirs_unmodified.value $(cat ${RESTIC_SUMMARY_LOG} | jq -r .dirs_unmodified)"
echo "multigraph restic_data_added"
echo "data_added.value $(cat ${RESTIC_SUMMARY_LOG} | jq -r .data_added)"
echo "data_added_packed.value $(cat ${RESTIC_SUMMARY_LOG} | jq -r .data_added_packed)"
echo "multigraph restic_backup_duration"
echo "total_duration.value $(cat ${RESTIC_SUMMARY_LOG} | jq -r .total_duration)"

View File

@@ -135,3 +135,8 @@
- name: Execute specific garage commands
ansible.builtin.include_tasks: garage.yml
when: "'garageservers' in group_names"
# Specific restic commands
- name: Execute specific restic commands
ansible.builtin.include_tasks: restic.yml
when: "'resticservers' in group_names"

View File

@@ -0,0 +1,28 @@
---
- name: Ensure some packages are installed
ansible.builtin.package:
name:
- jq
state: present
update_cache: true
- name: Put restic plugin configuration
ansible.builtin.template:
src: restic.j2
dest: /etc/munin/plugin-conf.d/restic
owner: root
group: root
mode: "0o640"
notify:
- Restart munin-node
- name: Put restic scripts
ansible.builtin.copy:
src: files/restic_backup
dest: /etc/munin/plugins/restic_backup
owner: root
group: root
mode: "0o755"
notify:
- Restart munin-node

View File

@@ -0,0 +1,3 @@
[restic_backup]
env.RESTIC_SUMMARY_LOG {{ restic_summary_log }}