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

Activity or status information's about all snapshot profiles (in machine readable JSON format) #1018

Open
buhtz opened this issue Jul 14, 2019 · 7 comments · May be fixed by #2019
Open

Activity or status information's about all snapshot profiles (in machine readable JSON format) #1018

buhtz opened this issue Jul 14, 2019 · 7 comments · May be fixed by #2019
Assignees
Labels
Feature requests a new feature Medium

Comments

@buhtz
Copy link
Member

buhtz commented Jul 14, 2019

This was on my own todo-List but I am far away from implementing this myself. So just for documentation (not for hurring it up!) I describe this feature here.

The problem
I don't know if my BackInTime (BIT) does a backup job or not even I don't know when it did it.

From time to time I open BIT and open each profile and checking the left list-view with the snapshot dates. Also for this I have to boot my backup-NAS because BIT won't show my anything without a backup destination available.

Solution
I want to aks BIT with one click or one command about the last successfull backup of all exiting jobs. There could be a .get_last_snapshot_dates() resulting in this

{'music_backup': time_struct<>,
 'other_backup_profile': time_struct<>}

This could be used by another methode pretty printing it to stdout (for command-line access) or by the GUI or by the plugin-API. There could be plugins showing the result in systray or sending an email about it or generating an RSS feed or make a robot dance the result.

@buhtz
Copy link
Member Author

buhtz commented Sep 26, 2022

@emtiu My first impulse was to ask for "still relevant?" and tag this. Then I saw my own face. 😆

This feature is still in my mind. Just do something like backintime --status and BIT gives you (in json format!) the last dates for each snapshot profile and maybe some more information. You can write your own daily running checker script just to check if one of the profiles get outdated because of unknown and uncaught errors.

Tag: Feature

@buhtz buhtz changed the title FeatureRequest: Activity log Feature Request: Activity or status information's about all snapshot profiles (in machine readable JSON format) Sep 26, 2022
@emtiu emtiu added the Feature requests a new feature label Oct 9, 2022
@buhtz buhtz added this to the 1.3.5 / 1.4.0 milestone Mar 19, 2023
@buhtz buhtz added GOOD FIRST ISSUE Used by 24pullrequests.com to suggest issues HELP-WANTED Used by 24pullrequests.com to suggest issues Medium labels Dec 14, 2023
@buhtz
Copy link
Member Author

buhtz commented Dec 14, 2023

This feature give users the opportunity to ask BIT (on command line) about the status of all existing profiles in a machine readable way. This can be used in (e.g. via cron executed) scripts to monitor BIT and start something (e.g. send mail or flash a big red light) when something is wrong.

@aryoda
Copy link
Contributor

aryoda commented Dec 14, 2023

This feature request looks similar to "log aggregator" functionality.

I think a centralized summary of all result states is very helpful.

Still it requires a functionality in BiT (or outside) to inform the user based on this file and this currently the pain point IMHO.

We have user-callback scripts for that to trigger actions per snapshot directly to

  1. send emails in case of problems (I don't like emails for privacy reasons if they contain paths and file names):
    https://github.com/bit-team/user-callback/blob/master/user-callback.sendmail

  2. send a desktop notification (works only on desktop systems I guess):
    https://github.com/bit-team/user-callback/blob/master/user-callback.notify

We could "lift" this functionality into a BiT config + GUI for normal users but configuring a sendmail or smtp profile could be overkill.

@s4moore
Copy link
Contributor

s4moore commented Jan 19, 2025

Hello Christian,

I have started working on this and have a few questions.

  1. How do you want to access the summary from the gui? For testing, I have just added a button to the "Last Log View" dialog which opens another dialog with the summary (please see attached screenshot).
  2. How do you want to access the summary from the comand line (I'm assuming something like --summary or similar)?
  3. Do you want any other information apart from the profile name and snapshot date (as per your example above)? I have included changes and errors just for testing but happy to remove those if not necessary.

Image

@buhtz buhtz removed GOOD FIRST ISSUE Used by 24pullrequests.com to suggest issues HELP-WANTED Used by 24pullrequests.com to suggest issues labels Jan 19, 2025
@buhtz buhtz changed the title Feature Request: Activity or status information's about all snapshot profiles (in machine readable JSON format) Activity or status information's about all snapshot profiles (in machine readable JSON format) Jan 19, 2025
@buhtz
Copy link
Member Author

buhtz commented Jan 19, 2025

Hi Samuel,

thank you for working on this. A snapshot specific summary is nice to have, too. But what I had in mind is an overview of all snapshots.

  • Last run
  • Run successful or with errors
  • In case of errors: Last successful run
1. How do you want to access the summary from the gui? For testing, I have just added a button to the "Last Log View" dialog which opens another dialog with the summary (please see attached screenshot).

I would suggest first to stick to the json output on command line. I am assuming this is tricky enough. We can think about a nice visualization in the GUI later.

2. How do you want to access the summary from the comand line (I'm assuming something like --summary or similar)?

Never thought about it. BIT is a bit special with its "commands" (backup, shutdown, smart-remove, snapshots-path, ...). I would suggest to stick to it.

# All snapshot summary
backintime summary

# Profile specific summary (with more details maybe)
backintime summary --profile NAME

This should output nice formatted and human readable output.

But add another switch to it, to make it JSON

backintime summary --json

Or we could make json the default and add --human-readable / -r (-h is reserved) to it. Not sure about it.

Maybe status is a better command than summary? I often ask such question on the mailing list to get opinions from users.

3. Do you want any other information apart from the profile name and snapshot date (as per your example above)? I have included changes and errors just for testing but happy to remove those if not necessary.

The use case is to give users the opportunity to be informed about their current "backup status". It often happen to me and others that BIT produce errors for several weeks and no one notice them. Of course there are several approaches to take this into account. But having a machine readable answer to "how are my backups" would be very nice. This can be used by other tools (and BIT itself) to track the backup status and warn if something goes wrong.

EDIT: To add the new command you need to modify the argparse related code. That code is bit message. Feel free to refactor it and maybe move it to its own module (e.g. common/args.py). But when you refactor please do this in a separate PR. And this won't get merged in the upcoming release. This is because I would like to keep the next release as stable as possible.

@s4moore
Copy link
Contributor

s4moore commented Jan 25, 2025

Hi Christian,

I have made a start on this but after reading your edit, I'm not sure that I'm going about this correctly. Should I submit a pr so you can see what I've done so far and let me know if my approach makes sense or if I need to make changes? (I have the overall status working but have not yet implemented profile specific status)

@buhtz
Copy link
Member Author

buhtz commented Jan 25, 2025

Just open the PR and try to explain the feature you have added.

@buhtz buhtz linked a pull request Feb 9, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature requests a new feature Medium
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants