On 14/11/05, Andrew J. Millar <[EMAIL PROTECTED]> wrote: > Hi all > > I just thought I'd share this with you as you may find it useful. My > managers wanted to receive a summary email of the previous nights > backups which contained only basic information of the status of the > backups, and they wanted this all in one email. As far as I can tell, > there is no way to get just a summary report from bacula its self > (forgive me if I am wrong), so I wrote a little script to produce the > summary.
Good work! I''ve been meaning to sort out something like this myself but hadn't got round to it. I was considering building my daily report from /var/log/bacula (or /var/bacula/log depending on how you look at it). You prompted me to get this far... BEGIN { print "Client Status Type StartTime EndTime Files Bytes" } /Client:/ { CLIENT=$NF; sub(/"/, "", CLIENT) ; sub(/".*$/, "", CLIENT) } /Backup Level:/ { TYPE=$NF ; sub(/,.*$/, "", TYPE) } /Start time:/ { STARTTIME=$NF; sub(/.*-.*-.* /, "", STARTTIME) } /End time:/ { ENDTIME=$NF; sub(/.*-.*-.* /, "", ENDTIME) } /SD Files Written:/ { SDFILES=$NF } /SD Bytes Written:/ { SDBYTES=$NF } /Termination:/ { TERMINATION=$NF ; sub(/Backup/, "", TERMINATION) ; printf "%s %s %s %s %s %s %s \n", CLIENT,TERMINATION,TYPE,STARTTIME,ENDTIME,SDFILES,SDBYTES } ... which would work (for Bacula 1.36.3-1 at least) on the log for all jobs. If your log is rotated daily, say after this was run each time then it'd provide each day's results. Or narrow down the dates with some branching and awk's strftime()/systime() functions. Then I got to thinking, would it be easier and less error prone to just grab this info from the database with something like... mysql> select Name,Level,JobStatus,JobBytes from Job where StartTime > date_sub(curdate(),interval 12 hour) order by StartTime; +---------------+-------+-----------+------------+ | Name | Level | JobStatus | JobBytes | +---------------+-------+-----------+------------+ | client1 | D | T | 28768855 | | client2 | D | E | 0 | | client3 | F | f | 0 | | client4 | D | T | 321428405 | | client5 | D | T | 3208729638 | | client6 | D | T | 1644424569 | | client7 | D | T | 23956056 | | client8 | D | T | 336052240 | | client9 | D | T | 494055507 | | client10 | D | T | 103612351 | | client11 | F | A | 0 | | BackupCatalog | F | T | 1211608502 | +---------------+-------+-----------+------------+ 12 rows in set (0.00 sec) And then perform a bit of substitution and formatting on that? Is there a definitive list of JobStatus codes anywhere? Will. ------------------------------------------------------- This SF.Net email is sponsored by the JBoss Inc. Get Certified Today Register for a JBoss Training Course. Free Certification Exam for All Training Attendees Through End of 2005. For more info visit: http://ads.osdn.com/?ad_idv28&alloc_id845&op=click _______________________________________________ Bacula-users mailing list Bacula-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/bacula-users