feat(restic): add scripts for directory backup and snapshot metrics generation

This commit is contained in:
2025-03-08 22:47:58 +01:00
parent 7ecf8778ca
commit 788c4bada0
2 changed files with 49 additions and 0 deletions

View File

@ -0,0 +1,12 @@
#!/usr/bin/env bash
RESTIC_JSON=$(</dev/stdin)
echo $RESTIC_JSON | jq -r '.[]
| {
"hostname": .hostname,
"username": .username,
"short_id": .short_id,
"time": ((((.time | split(".")[0]) + "Z") | fromdate) - (3600 * (.time | split("+")[1] | split(":")[0] | tonumber + 1))),
"paths": .paths[]
} | "restic_snapshots{hostname=\"\(.hostname)\",username=\"\(.username)\",short_id=\"\(.short_id)\",paths=\"\(.paths)\"} \(.time)"'