Bacula-users

Re: [Bacula-users] Backup status OK, but mysql errors

2011-09-19 09:50:00
Subject: Re: [Bacula-users] Backup status OK, but mysql errors
From: Jeremy Maes <jma AT schaubroeck DOT be>
To: John Drescher <drescherjm AT gmail DOT com>
Date: Mon, 19 Sep 2011 15:47:38 +0200
Op 19/09/2011 15:27, John Drescher schreef:
On Mon, Sep 19, 2011 at 8:58 AM, Oliver Hoffmann <oh AT dom DOT de> wrote:
Hello list,

bacula does a ClientRunBeforeJob which is a mysqldump script. The
script returns an error (problem with Lock Tables) but the email has
the subject "Bacula: Backup OK of myclient-fd Incremental".
Even webacula shows an OK.
This is misleading and this way one would be forced to read every
status mail. Any (nice) ideas how to deal with it? All right, I could
alter my script or something but maybe there is a way to put a keyword
into the subject?

Get your script to return a non zero exit status on database error.

John
In my experience, Bacula will not see a failing script as an 'Error' but rather as a 'Warning'.
The status line at the bottom of your email should say "Termination:            Backup OK -- with warnings" but the subject will still be "Backup OK".
(my mysqldump script does return 1 on failure and bacula reports this, but it's still only a 'warning')

There are a few ways to get this info from what I know. You could have your script parse that specific Termination line in the email (should be pretty straightforward).
Another way is to get the info from the bacula database with an SQL query. An example query the way I use it:

SELECT JobID, Name, Level, Job.JobStatus, JobStatusLong, SchedTime, RealEndTime, JobErrors
FROM Job
INNER JOIN Status
ON (Job.JobStatus = Status.JobStatus)
WHERE ( Type = 'B' OR Type = 'V' )
AND DATE_SUB(NOW(),INTERVAL 18 HOUR) <= SchedTime;
EOFCMD


This runs in a script after all jobs and gets parsed afterwards. The "JobErrors" field will increase for each warning or error, so as soon as it differs from 0 it's worth taking a look at the given job.

There's probably other ways I haven't thought of aswell :)

Kind regards,
Jeremy

**** DISCLAIMER ****
http://www.schaubroeck.be/maildisclaimer.htm

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
Learn about the latest advances in developing for the 
BlackBerry&reg; mobile platform with sessions, labs & more.
See new tools and technologies. Register for BlackBerry&reg; DevCon today!
http://p.sf.net/sfu/rim-devcon-copy1 
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users