YunoHost-Apps / borg_ynh

An experimental Borg implementation for YunoHost
https://www.borgbackup.org/
GNU Affero General Public License v3.0
19 stars 23 forks source link

Send a mail if backup fails #48

Closed supermamie closed 3 years ago

supermamie commented 4 years ago

It could be really helpful to be notified when a backup failed. Some services send mails when succeed/failed

JocelynDelalande commented 3 years ago

At least when it fails.

supermamie commented 3 years ago

It seems that there are now mails when the backup succeed, but even if it fails, the mail says it succeeded. (I made many tests yesterday and today, I have not checked the mails specifically on time, so I am not 100% sure, but I had one error mail, due to a password error while accessing borg, and 2 success mails, even if I am pretty sure one of them is linked to a failed backup due to a repo path change)

About the success mail, there are a few things that can be improved : Title : [borg] Backup succeed from myserver.fr onto There is something missing. (That's why I can not be sure if I had a success mail for an error or if it is a success for another backup on the wrong path)

In the content : size: 314902911805 Is it possible to have something more readable ? (maybe readable and exact ?)

slowphil commented 3 years ago

I would really prefer an email ONLY when the backup fails (i.e. there should be an option to not receive success e-mail).

In my experience, after the initial setup phase, automated backups usually work reliably for months or years in a row. If you receive an e-mail whether the result is good or bad you unavoidably get bored and stop reading these reports, meaning you won't react when something goes wrong.

Also I suggest that these messages concerning backups eventually get integrated in yunohost's diagnosis.

zamentur commented 3 years ago

About the success mail, there are a few things that can be improved : Title : [borg] Backup succeed from myserver.fr onto There is something missing. (That's why I can not be sure if I had a success mail for an error or if it is a success for another backup on the wrong path)

This one has been fixed

In the content : size: 314902911805 Is it possible to have something more readable ? (maybe readable and exact ?)

I think this size has been improve in 4.2. It's a core issue anyway.

(I made many tests yesterday and today, I have not checked the mails specifically on time, so I am not 100% sure, but I had one error mail, due to a password error while accessing borg, and 2 success mails, even if I am pretty sure one of them is linked to a failed backup due to a repo path change)

I think this commit should fix this issue : https://github.com/YunoHost-Apps/borg_ynh/commit/6b253039a9ac58d295b517346b82173121efb68f

In my experience, after the initial setup phase, automated backups usually work reliably for months or years in a row. If you receive an e-mail whether the result is good or bad you unavoidably get bored and stop reading these reports, meaning you won't react when something goes wrong.

I suggest you to use filters. And to not treat success and failure in the same way (i personally move success in a dir with a read status, and failed message are in a separated dir or in inbox directly). What if it doesn't work at all anymore ? You won't get failure email... So you need to know the last backup status.

Also I suggest that these messages concerning backups eventually get integrated in yunohost's diagnosis.

As all backup logic could be in core too ^^

zamentur commented 3 years ago

I close this topic as notifs are available now (oin both side borgserver_ynh and borg)