Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Include Restic client version in the snapshot information #4188

Closed
ngosang opened this issue Feb 2, 2023 · 7 comments · Fixed by #4378
Closed

Include Restic client version in the snapshot information #4188

ngosang opened this issue Feb 2, 2023 · 7 comments · Fixed by #4378
Labels

Comments

@ngosang
Copy link

ngosang commented Feb 2, 2023

Include Restic client version in the snapshot information.
In the output of this command restic -r /data --verbose -p secret.txt --json snapshots

I'm using Restic to backup all the devices at home. That includes 3 smartphones, 3 Windows laptops and 2 Linux servers.
Since I want to keep Restic updated, it will be very useful for me to see the Restic client version used for the last snapshot.
After the version is added to the command output, I can make the integration with my Prometheus exporter to see the outdated versions in the Dashboard.
https://github.com/ngosang/restic-exporter#grafana-dashboard

@rawtaz
Copy link
Contributor

rawtaz commented Feb 2, 2023

This is what tags are for, adding your own custom metadata. Just add a tag or two using the --tag option to backup, e.g. restic backup --tag $(restic version | cut -d' ' -f2) mystuff. It's quite specific of a use case as everyone wants their special metadata, so just using the tags is the way to go.

@ngosang
Copy link
Author

ngosang commented Feb 2, 2023

Certainly I can do this in Linux. With a little more effort it could be archived in Windows too. In Android it's a bit more complicate because I will have to build the app from source code.
Anyway, this could work for me but it won't be useful to add it to the Prometheus exporter if it's not enabled by default in all clients.
Feel free to close the issue if you think it's not useful for most users. I have worked with other backups solutions in the past like UrBackup and you always have a control panel with the list of clients and some information about them like the OS, the client version, last backup...

@aawsome
Copy link
Contributor

aawsome commented Feb 16, 2023

I support this extension. Having the correct program version adds a huge benefit for many use cases. Not only the one depicted here, but also think about errors in snapshots which are introduced by some specific versions only, etc..

Note that rustic already adds its version to the snapshot in the (optional) program_version field.

      {
        "time": "2023-02-15T22:31:55.962044751+01:00",
        "program_version": "rustic v0.4.3-36-g50f926d",
        "tree": "16fe5617dd3ea25d45e4af85fc6f6657efc818707b4057cef141432535b614a2",
        "paths": [
          "test"
        ],
        ...
      }

Another use case, of course, is to differentiate snapshots that have been created by other clients implementing the same repo format like restic/rustic,...

@MichaelEischer
Copy link
Member

A program_version field for snapshots is definitely useful for debugging purposes, I plan to add it as part of #693. As the output of snapshots --json includes the raw snapshot data, that would also solve this issue.

@ngosang
Copy link
Author

ngosang commented Oct 14, 2023

Included in Restic Exporter for Prometheus => https://github.com/ngosang/restic-exporter

@Peronia
Copy link

Peronia commented Feb 6, 2024

This change broke my script because this attribute is the only one with a space in it. I solved it for me but maybe you should take a look if this is necessary or rename it to "program_version": "rustic_v0.4.3-36-g50f926d",

@MichaelEischer
Copy link
Member

This change broke my script because this attribute is the only one with a space in it.

There are several fields in the Snapshot struct that can contain spaces. Any JSON parser must be able to handle that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants