creativeprojects / resticprofile

Configuration profiles manager and scheduler for restic backup
https://creativeprojects.github.io/resticprofile/
GNU General Public License v3.0
732 stars 33 forks source link

Backup Status is 2 if backup fails because of lock #162

Closed tschoesi closed 1 year ago

tschoesi commented 1 year ago

If the backup fails because of a lock that was left over from the process getting killed during a backup, the statusfile (for prometheus) shows a status of 2 for resticprofile_backup_status.

I think it would be clearer if this was set to 0 or at the very least to 1

creativeprojects commented 1 year ago

I had a look at it, and I think the problem is slightly different: A status file is not generated so prometheus only shows the latest one which was successful.

I think we should generate an empty file with a failed status (all the other metrics will be zero)

tschoesi commented 1 year ago

I am pretty sure that a status file was generated. Almost all metrics were set to 0 except for the duration metrics. Also the status file timestamp (ls -l) was updated to the time of the failed backup.

creativeprojects commented 1 year ago

🤔 right I was trying with resticprofile locks but I suppose it should have been a restic lock in that case. I'll try to replicate the problem

tschoesi commented 1 year ago

I checked again, and I think the problem is something else. The status file gets created, but all the gauges are set to zero (even when there is no error with locks...) I have enabled extended-status

default:
  repository: "/var/backups/restic"
  password-file: "key"
  prometheus-save-to-file: "prometheus/backup.prom"

  retention:
    after-backup: true
    prune: true
    keep-last: 5
    keep-weekly: 4
    keep-monthly: 3

  backup:
    extended-status: true
    one-file-system: true 
    source:
      - "/my/path"

Any ideas on what I'm doing wrong?

tschoesi commented 1 year ago

The problem was that my distros restic version was very old (0.9.4). I updated to 0.15.0 and it now works as inteded.