Send email on backup failure #6

Closed
opened 2018-01-05 05:33:30 +00:00 by import_bot · 6 comments
Collaborator

As you are aware, the 'cron' system sends whatever appears on the output screen to the owner of the cron process. So right now, if borgmatic is written the way it seems to be, the only time you get an email from cron would be if there is an error.

However, there's an alternate setup where verbosity and stats are turned on so that you get a daily email from cron. This provides tracking information such as "how much did I backup today", "how much churn is there", "I want to check that things are actually working by looking at an email".

In that particular use-case, you have to write server-side mail rules to flag cron messages which indicate failures.

My suggested approach is to have a "mailinglist:" argument in the configuration file, along with a "subjectprefix" (defaults to hostname) which will send an email if the borg/attic commands fail, or some other failure occurs.


Imported from Taiga issue 5 (won't fix). Created on 2015-07-26T14:20:47+0000 by Thomas Harold.

As you are aware, the 'cron' system sends whatever appears on the output screen to the owner of the cron process. So right now, if borgmatic is written the way it seems to be, the only time you get an email from cron would be if there is an error. However, there's an alternate setup where verbosity and stats are turned on so that you get a daily email from cron. This provides tracking information such as "how much did I backup today", "how much churn is there", "I want to check that things are actually working by looking at an email". In that particular use-case, you have to write server-side mail rules to flag cron messages which indicate failures. My suggested approach is to have a "mailinglist:" argument in the configuration file, along with a "subjectprefix" (defaults to hostname) which will send an email if the borg/attic commands fail, or some other failure occurs. --- Imported from Taiga issue 5 (won't fix). Created on 2015-07-26T14:20:47+0000 by Thomas Harold.
Author
Collaborator

I followed everything up until your last paragraph. Assuming that "mailinglist"/"subjectprefix" configuration arguments were in place, how would that help with cron's interpretation of the script output? Or are you suggesting that atticmatic instead sends its own emails separately from cron?


Comment on 2015-07-26T15:06:31+0000 by Dan Helfman.

I followed everything up until your last paragraph. Assuming that "mailinglist"/"subjectprefix" configuration arguments were in place, how would that help with cron's interpretation of the script output? Or are you suggesting that atticmatic instead sends its own emails separately from cron? --- Comment on 2015-07-26T15:06:31+0000 by Dan Helfman.
Author
Collaborator

Yes, I'm suggesting that atticmatic send its own emails when errors occur, separate from cron.


Comment on 2015-07-27T10:03:45+0000 by Thomas Harold.

Yes, I'm suggesting that atticmatic send its own emails when errors occur, separate from cron. --- Comment on 2015-07-27T10:03:45+0000 by Thomas Harold.
Author
Collaborator

This does get a bit more complex on systems without a local mail server such as a Cygwin environment. On most Linux/Unix/BSD systems you can just rely on the local mail server to send the mail. But in a Cygwin environment, you may need to support authenticated SMTP where the user specifies a servername, serverport, smtpusername, smtppassword in the config file.


Comment on 2015-07-28T11:02:31+0000 by Thomas Harold.

This does get a bit more complex on systems without a local mail server such as a Cygwin environment. On most Linux/Unix/BSD systems you can just rely on the local mail server to send the mail. But in a Cygwin environment, you may need to support authenticated SMTP where the user specifies a servername, serverport, smtpusername, smtppassword in the config file. --- Comment on 2015-07-28T11:02:31+0000 by Thomas Harold.
Author
Collaborator

Got it. So then is the idea that you'd configure cron to send email to something like backup-errors@example.com, and you'd configure atticmatic to send emails to backup-tracking@example.com? What I'm getting at is: What's your ideal email experience for seeing backup failures vs. mere tracking success emails?

Alternatively, would wrapping atticmatic with something like Cronic make setting up mail rules easier?


Comment on 2015-07-30T02:19:55+0000 by Dan Helfman.

Got it. So then is the idea that you'd configure cron to send email to something like backup-errors@example.com, and you'd configure atticmatic to send emails to backup-tracking@example.com? What I'm getting at is: What's your ideal email experience for seeing backup failures vs. mere tracking success emails? Alternatively, would wrapping atticmatic with something like [Cronic](http://habilis.net/cronic/) make setting up mail rules easier? --- Comment on 2015-07-30T02:19:55+0000 by Dan Helfman.
Author
Collaborator

My initial objection was "does Cronic run under Cygwin", but then I remembered that I usually use Windows' built-in scheduler to handle running of Cygwin scripts anyway. So I'd just write or use a simple Cygwin-specific wrapper around borgmatic to catch errors and email them.

So yeah, I think saying "use Cronic" for better email reports is a better idea rather then baking it into Borgmatic.


Comment on 2015-08-03T10:43:52+0000 by Thomas Harold.

My initial objection was "does Cronic run under Cygwin", but then I remembered that I usually use Windows' built-in scheduler to handle running of Cygwin scripts anyway. So I'd just write or use a simple Cygwin-specific wrapper around borgmatic to catch errors and email them. So yeah, I think saying "use Cronic" for better email reports is a better idea rather then baking it into Borgmatic. --- Comment on 2015-08-03T10:43:52+0000 by Thomas Harold.
Author
Collaborator

Cool. In that case, I'll close this for now. Please feel free to update this ticket or open a new one if the need resurfaces.


Comment on 2015-08-04T01:58:59+0000 by Dan Helfman.

Cool. In that case, I'll close this for now. Please feel free to update this ticket or open a new one if the need resurfaces. --- Comment on 2015-08-04T01:58:59+0000 by Dan Helfman.
Sign in to join this conversation.
No Milestone
No Assignees
1 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: borgmatic-collective/borgmatic#6
No description provided.