Discussion:
[rsnapshot-discuss] Email in case of error
Miguel Almeida
2012-08-30 11:17:44 UTC
Permalink
Hi,

Is there a way to send an email in case something goes wrong in your
backups?

I was looking at the log today and I saw:
[29/Aug/2012:15:28:39] /opt/bin/rsnapshot daily: ERROR: /opt/bin/rsync
returned 255 while processing ***@server.com:/mnt/hdc/snapshots/daily.0/
[29/Aug/2012:15:28:39] Rolling back "dataservicemachine/"
...
[29/Aug/2012:15:35:27] /opt/bin/rsnapshot daily:
ERROR: /opt/bin/rsnapshot daily: completed, but with some errors

Luckily this was caught today, but if I hadn't looked at the log in the
shell I wouldn't have caught it.

How do you guys usually do this? Do you create a script to analyze the
log?

Cheers,

Miguel Almeida
Tapani Tarvainen
2012-08-30 12:03:28 UTC
Permalink
Post by Miguel Almeida
Is there a way to send an email in case something goes wrong in your
backups?
If you run it from cron it should mail error messages
when an error occurs. It's likely they go to root by
default though, check your cron settings.
--
Tapani Tarvainen
Helmut Hullen
2012-08-30 14:40:00 UTC
Permalink
Hallo, Miguel,
Post by Miguel Almeida
Is there a way to send an email in case something goes wrong in your
backups?
As just mentioned a cronjob should send such messages to the "owner" of
this job.
Post by Miguel Almeida
/opt/bin/rsync returned 255 while processing
Rolling back "dataservicemachine/" ....
ERROR: /opt/bin/rsnapshot daily: completed, but with some errors
When I use "rsnapshot" for backups of my Windows clients I get many such
messages. Reason: some files are "in use".

In your case: "rsync returned 255" has to be analyzed.

By the way: "/opt/bin" is no usual directory for "rsync".

Viele Gruesse!
Helmut
Miguel Almeida
2012-08-30 17:26:51 UTC
Permalink
Thank you all for the input.
Post by Helmut Hullen
Hallo, Miguel,
Post by Miguel Almeida
Is there a way to send an email in case something goes wrong in your
backups?
As just mentioned a cronjob should send such messages to the "owner" of
this job.
I was actually wondering if such error (the 255 return one) would be
considered as an error by the job (as it said it "completed, but with
errors").
Post by Helmut Hullen
Post by Miguel Almeida
/opt/bin/rsync returned 255 while processing
Rolling back "dataservicemachine/" ....
ERROR: /opt/bin/rsnapshot daily: completed, but with some errors
When I use "rsnapshot" for backups of my Windows clients I get many such
messages. Reason: some files are "in use".
In your case: "rsync returned 255" has to be analyzed.
By the way: "/opt/bin" is no usual directory for "rsync".
I know. This is because the machine running the rsnapshot job is a QNAP
NAS. You should see the topic (and pdf) at
http://forum.qnap.com/viewtopic.php?t=13025 . It's a really interesting
use of rsnapshot!

Miguel Almeida
David Cantrell
2012-09-03 15:51:14 UTC
Permalink
Post by Helmut Hullen
In your case: "rsync returned 255" has to be analyzed.
I'd guess that it means a network timeout, ssh auth failure, or possibly
something like running out of inodes.
Post by Helmut Hullen
By the way: "/opt/bin" is no usual directory for "rsync".
/opt is a fairly common place for installing applications when you want
to keep them nicely self-contained and easily uninstallable. Admittedly
/opt/bin is a bit unusual - /opt/applicationname/{bin,lib,...} is more
common - but /opt on some platforms performs the same role as /usr/local
on typical Linux boxes.

The most common places to see /opt are on small embedded systems and on
Solaris.

And /opt/bin doesn't causing the problem here, as rsnapshot can find and
run rsync.
--
David Cantrell | top google result for "topless karaoke murders"

Are you feeling bored? depressed? slowed down? Evil Scientists may
be manipulating the speed of light in your vicinity. Buy our patented
instructional video to find out how, and maybe YOU can stop THEM
c***@ccs.covici.com
2012-08-30 17:10:34 UTC
Permalink
The cron job always emails me if there are errors -- I have the standard
output of rsync redirected to a file, but not the standard error, so I
see if there is any rsync errors. Other errors, cron tells me very
nicely.
Post by Miguel Almeida
Hi,
Is there a way to send an email in case something goes wrong in your
backups?
[29/Aug/2012:15:28:39] /opt/bin/rsnapshot daily: ERROR: /opt/bin/rsync
[29/Aug/2012:15:28:39] Rolling back "dataservicemachine/"
...
ERROR: /opt/bin/rsnapshot daily: completed, but with some errors
Luckily this was caught today, but if I hadn't looked at the log in the
shell I wouldn't have caught it.
How do you guys usually do this? Do you create a script to analyze the
log?
Cheers,
Miguel Almeida
----------------------------------------------------
----------------------------------------------------
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
rsnapshot-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss
--
Your life is like a penny. You're going to lose it. The question is:
How do
you spend it?

John Covici
***@ccs.covici.com
Miguel Almeida
2013-02-07 12:58:57 UTC
Permalink
Post by c***@ccs.covici.com
The cron job always emails me if there are errors -- I have the standard
output of rsync redirected to a file, but not the standard error, so I
see if there is any rsync errors. Other errors, cron tells me very
nicely.
How is this set up? My current set-up has the following cron entry:
30 05 * * * /opt/bin/rsnapshot daily

On rsnapshot's config I have the logfile parameter defined:
logfile /opt/var/log/rnapshot.log


I'm having some errors which culminate in:
[07/Feb/2013:11:46:58] /opt/bin/rsnapshot daily: ERROR: /opt/bin/rsync
returned 12 while processing ***@domain.com:/mnt/dataservices/daily.0/
[07/Feb/2013:11:46:58] Rolling back "dataservices/"
(...)
[07/Feb/2013:11:54:37] /opt/bin/rsnapshot daily: ERROR:
/opt/bin/rsnapshot daily: completed, but with some errors

My doubts:
1. Would this be caught if I redirected stderr to the mail?
2. If so, how would one do that - I assume it'd be done at the crontab
level, but I'm not sure if setting the logfile parameter in rsnapshot
would prevent it


Cheers!

Miguel Almeida
Post by c***@ccs.covici.com
Post by Miguel Almeida
Hi,
Is there a way to send an email in case something goes wrong in your
backups?
[29/Aug/2012:15:28:39] /opt/bin/rsnapshot daily: ERROR: /opt/bin/rsync
[29/Aug/2012:15:28:39] Rolling back "dataservicemachine/"
...
ERROR: /opt/bin/rsnapshot daily: completed, but with some errors
Luckily this was caught today, but if I hadn't looked at the log in the
shell I wouldn't have caught it.
How do you guys usually do this? Do you create a script to analyze the
log?
Cheers,
Miguel Almeida
----------------------------------------------------
----------------------------------------------------
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
rsnapshot-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss
c***@ccs.covici.com
2013-02-07 14:09:25 UTC
Permalink
I do not run the rsnapshot hourly, daily, directly out of cron, but use
an ssh script so I can do whatever is necessary. Here is my hourly
script in case this helps.
#!/bin/bash
mount -L offsite /mnt/offsite
ret=$?
if [ $ret -ne 0 ]; then
exit
fi
date >>/var/log/rsnapshot_sync.log
rsnapshot sync >>/var/log/rsnapshot_sync.log
ret=$?
if [ $ret -eq 0 -o $ret -eq 24 ]; then
rsnapshot hourly
fi
umount /mnt/offsite
Post by Miguel Almeida
Post by c***@ccs.covici.com
The cron job always emails me if there are errors -- I have the standard
output of rsync redirected to a file, but not the standard error, so I
see if there is any rsync errors. Other errors, cron tells me very
nicely.
30 05 * * * /opt/bin/rsnapshot daily
logfile /opt/var/log/rnapshot.log
[07/Feb/2013:11:46:58] /opt/bin/rsnapshot daily: ERROR: /opt/bin/rsync
returned 12 while processing
[07/Feb/2013:11:46:58] Rolling back "dataservices/"
(...)
/opt/bin/rsnapshot daily: completed, but with some errors
1. Would this be caught if I redirected stderr to the mail?
2. If so, how would one do that - I assume it'd be done at the crontab
level, but I'm not sure if setting the logfile parameter in rsnapshot
would prevent it
Cheers!
Miguel Almeida
Post by c***@ccs.covici.com
Post by Miguel Almeida
Hi,
Is there a way to send an email in case something goes wrong in your
backups?
[29/Aug/2012:15:28:39] /opt/bin/rsnapshot daily: ERROR: /opt/bin/rsync
[29/Aug/2012:15:28:39] Rolling back "dataservicemachine/"
...
ERROR: /opt/bin/rsnapshot daily: completed, but with some errors
Luckily this was caught today, but if I hadn't looked at the log in the
shell I wouldn't have caught it.
How do you guys usually do this? Do you create a script to analyze the
log?
Cheers,
Miguel Almeida
----------------------------------------------------
----------------------------------------------------
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and
threat landscape has changed and how IT managers can respond. Discussions
will include endpoint security, mobile security and the latest in malware
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/_______________________________________________
rsnapshot-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss
--
Your life is like a penny. You're going to lose it. The question is:
How do
you spend it?

John Covici
***@ccs.covici.com
Helmut Hullen
2013-02-07 14:15:00 UTC
Permalink
Hallo, Miguel,
/opt/bin/rsync returned 12 while processing
Rolling back "dataservices/" (...)
/opt/bin/rsnapshot daily: completed, but with some errors
That is a pure rsync problem, no rsnapshot problem.
May be related to the rsync version, or on the rsync implementation on
your machine.

Viele Gruesse!
Helmut
Miguel Almeida
2013-02-07 15:42:37 UTC
Permalink
Thanks Helmut!

I will definitely try to figure out what's wrong. But what I'm most
worried about is the fact that I have no good warning system - aka
"email on error".

This rsnapshot has been running for more than a year, and I noticed
today that one of the machines has been having errors for 3 weeks!
So the main question is really: if you run rsnapshot daily on crontab,
how can you make sur you get an email when you get

ERROR:
/opt/bin/rsnapshot daily: completed, but with some errors


Would you need a wrapper script for it?

Miguel
Post by Helmut Hullen
Hallo, Miguel,
/opt/bin/rsync returned 12 while processing
Rolling back "dataservices/" (...)
/opt/bin/rsnapshot daily: completed, but with some errors
That is a pure rsync problem, no rsnapshot problem.
May be related to the rsync version, or on the rsync implementation on
your machine.
Viele Gruesse!
Helmut
------------------------------------------------------------------------------
Free Next-Gen Firewall Hardware Offer
Buy your Sophos next-gen firewall before the end March 2013
and get the hardware for free! Learn more.
http://p.sf.net/sfu/sophos-d2d-feb
_______________________________________________
rsnapshot-discuss mailing list
https://lists.sourceforge.net/lists/listinfo/rsnapshot-discuss
Ruediger Meier
2013-02-07 15:52:31 UTC
Permalink
Post by Miguel Almeida
Thanks Helmut!
I will definitely try to figure out what's wrong. But what I'm most
worried about is the fact that I have no good warning system - aka
"email on error".
This rsnapshot has been running for more than a year, and I noticed
today that one of the machines has been having errors for 3 weeks!
So the main question is really: if you run rsnapshot daily on
crontab, how can you make sur you get an email when you get
/opt/bin/rsnapshot daily: completed, but with some errors
Would you need a wrapper script for it?
Configure your cron daemon to write you an email if there is any output.
This should be the default BTW. So maybe you should just read your
emails!? Or forward the local emails to your public email adress.

cu,
Rudi
David Cantrell
2013-02-11 13:18:02 UTC
Permalink
Post by Ruediger Meier
Configure your cron daemon to write you an email if there is any output.
This should be the default BTW. So maybe you should just read your
emails!? Or forward the local emails to your public email adress.
I bet the emails are going to ***@localhost. I have this as
the first line of all my crontabs:

MAILTO=***@cantrell.org.uk
--
David Cantrell | http://www.cantrell.org.uk/david

Guns aren't the problem. People who deserve to die are the problem.
Helmut Hullen
2013-02-07 15:55:00 UTC
Permalink
Hallo, Miguel,
Post by Miguel Almeida
I will definitely try to figure out what's wrong. But what I'm most
worried about is the fact that I have no good warning system - aka
"email on error".
This rsnapshot has been running for more than a year, and I noticed
today that one of the machines has been having errors for 3 weeks!
So the main question is really: if you run rsnapshot daily on
crontab, how can you make sur you get an email when you get
/opt/bin/rsnapshot daily: completed, but with some errors
Would you need a wrapper script for it?
No - I use cronjobs for this work, and my "cron" sends e-mail to root in
case of errors (for every cronjob, not only for rsnapshot cronjobs).

Most distributions use Vixie cron, and there you can define

MAIL=root

as the recipient for such mail.

Viele Gruesse!
Helmut
Loading...