Bacula-users

Re: [Bacula-users] FW: Client last backup time report

2013-11-18 12:31:17
Subject: Re: [Bacula-users] FW: Client last backup time report
From: Steven Hammond <shammond AT technicalchemical DOT com>
To: "thomasl AT mtl.mit DOT edu" <thomasl AT mtl.mit DOT edu>, Robyn <rholmes.opubco AT gmail DOT com>, "bacula-users AT lists.sourceforge DOT net" <bacula-users AT lists.sourceforge DOT net>
Date: Mon, 18 Nov 2013 17:28:14 +0000
I'm a newbie and so others can/will probably offer a better way of doing this, 
but I would probably do something like this:

I would create a bash script and run it from crontab with the following line:
psql -d Bacula <Bacula-exceptions.sql|mail -s "Bacula Exception Report" 
sysadmin AT yourcompany DOT com

In the Bacula-exceptions.sql, I would put:

select j.name as "Job Name", c.name as "Client", j.schedtime as "Job Scheduled 
Time" from job j
inner join client c on c.clientid=j.clientid
where j.jobstatus='E' and endtime >= now()-'10 days'::interval

If you just want to see the LAST time a job failed (not every time in the last 
10 days) then use SELECT DISTINCT.

I actually added it to our bconsole query list by appending the query.sql file 
with:

#21
:Backup Exception Report
*Enter # of days to report:
SELECT j.name as "Job Name", c.name as "Client", j.schedtime as "Job Run Date"
 FROM job j
 INNER JOIN client c on c.clientid=j.clientid
 WHERE j.jobstatus='E' and endtime >= now()-'%1 days'::interval;


Steven Hammond
I.T. Manager
Technical Chemical Company

For support, please email us at support AT technicalchemical DOT com.


-----Original Message-----
From: Thomas Lohman [mailto:thomasl AT mtl.mit DOT edu] 
Sent: Monday, November 18, 2013 10:24 AM
To: Robyn; bacula-users AT lists.sourceforge DOT net
Subject: Re: [Bacula-users] FW: Client last backup time report

We do something like this by running a job within Bacula every morning 
that scans all client configuration files, builds a list of expected 
current jobs/clients and then queries the Bacula DB to see when/if 
they've been successfully backed up or not (i.e. marked with a T).  If 
it's been more than the specified number of days, then they are added to 
a list which is then mailed to whatever address is specified (e.g. the 
IT system folks).  The content of the message looks something like this:

WARNING --> Bacula has not backed up:

(1) Job: foobar for Client: foobar-host in the past 10 days
....

I suspect that this utility is fairly specific to our configuration 
structure so not sure if it could be of direct help to you but I figured 
I'd throw it out there as an example that it is pretty straight forward 
to do what you want to do and a lot of ways to implement it. :)


--tom

> I need to create a report with the last time a good backup was run of
> each client.
>
> We are looking for anyone who has not backed up recently, so it would be
> nice if the report could be set for clients that have not had a
> successful backup in 1 week, or even a variable amount of time.
>
> I am assuming this would be SQL. Grepping (or anything else) Bacula's
> 'List Jobs' would not work, since if a client has not even started a
> backup it would not be listed there. (Our backups are kicked off by
> remotely calling a script on each client that starts the FD. We have
> several 'waves' of backups when departments are not here or would be
> least affected by the backup.)
>
> We envision the report being something like:
>
> Name         Last Backup      F/D/I  JobFiles   JobBytes JobStatus
>
> COMPUTER1    2013-11-06 23:59   I          29    129,056     T
>
> LAPTOP2      2013-10-20 10:30   D          17     89,423     T
>
> COMPUTER2    2013-10-19 17:05   I           0          0     E
>
> Anyone else doing something like this, or can point me to some examples?
>
> Thanks in advance
>
>
>
> ------------------------------------------------------------------------------
> DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
> OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
> Free app hosting. Or install the open source package on any LAMP server.
> Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
> http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
>
>
>
> _______________________________________________
> Bacula-users mailing list
> Bacula-users AT lists.sourceforge DOT net
> https://lists.sourceforge.net/lists/listinfo/bacula-users
>


------------------------------------------------------------------------------
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps
OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access
Free app hosting. Or install the open source package on any LAMP server.
Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native!
http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users

------------------------------------------------------------------------------
Shape the Mobile Experience: Free Subscription
Software experts and developers: Be at the forefront of tech innovation.
Intel(R) Software Adrenaline delivers strategic insight and game-changing 
conversations that shape the rapidly evolving mobile landscape. Sign up now. 
http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk
_______________________________________________
Bacula-users mailing list
Bacula-users AT lists.sourceforge DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users