ngosang / restic-exporter

Prometheus exporter for the Restic backup system
MIT License
79 stars 17 forks source link

Extract correct sizes #29

Open Janhouse opened 5 months ago

Janhouse commented 5 months ago

Would it be possible to extract correct bytes-added and size-on-disk for the backups? Restic does deduplication and compression and this exporter doesn't seem to take any of that into account. It appears to look at each backup separately and then sum all of that.

Here is a screenshot from Backrest making the actual backups: image

While this exporter just doubles it. :shrug: image

ngosang commented 1 month ago

I don't know how to improve that. I accept suggestions. The exporter does this:

  1. List the latest snapshot for each client. restic snapshots --latest 1 --json
  2. Get the stats for each snapshot. restic stats --json f0ba7d59
    {
    "total_size": 51319171233,
    "total_file_count": 24066,
    "snapshots_count": 1
    }

That's all.

cz3k commented 1 week ago

At repo level you could achieve this with restic stats --json --mode raw-data. Restic docs > Getting information about repository data.

{
  "total_size":5858775049,
  "total_uncompressed_size":7243990758,
  "compression_ratio":1.2364343565702245,
  "compression_progress":100,
  "compression_space_saving":19.122273278306135,
  "total_blob_count":12455,
  "snapshots_count":101
}

@ngosang Thanks for creating the project! It has helped me a lot to get up and running quickly.