ngosang / restic-exporter

Prometheus exporter for the Restic backup system
MIT License
84 stars 18 forks source link

Duplicated snapshots because of paths #16

Closed ferrarimarco closed 1 year ago

ferrarimarco commented 1 year ago

Hi! Thanks for this exporter.

As explained in #8, restic-exporter calculates its own hash: https://github.com/ngosang/restic-exporter/blob/a4e37f87709965fa7ca5686638ca78df5f11d19f/restic-exporter.py#L286-L288

In my setup, using snapshot["paths"] as part of the input to calculate the hash causes a client to appear multiple times if the paths change, even if the rest (hostname and username) stays the same. For example, if you add or remove a path from the ones that restic is backing up for a given host and user, the exporter will report this as two different items.

I was surprised by this behavior because the metrics don't expose the paths for a given snapshot, IIRC.

Thanks for your support!

ngosang commented 1 year ago

If you change the path it counts as a different backup, in Restic CLI and in the Exporter. Furthermore, some users have multiple backups per user and there hostname + username is not enough to distinguish backups. You can remove the old backups (with different path) using the Restic CLI. They will be removed from the exporter too.

https://github.com/ngosang/restic-exporter/issues/11#issuecomment-1484081894