Generating Basic Bacula Backup Email Summary Reports (Updated Version)

In April of 2013, a request was made on the Bacula mailing list for a way to get daily and weekly backup reports. This got me to thinking that such a daily email would be useful.

So, off I went to write a simple bash shell script to generate these reports. Over time, many features were added to this script and it has evolved quite a bit over the past 4 years. The original posting about this script may be found here: http://www.revpol.com/baculasummaryemails-ORIG

The script expects to see one command line parameter which is the number of hours to report on. The following would generate a report going back 24 hours:

$ baculabackupreport.sh 24

The plain text version of this email report would something look like this:

  Jobs Run On Bacula VM in the Past 24 Hours
  ------------------------------------------

  JobId      Job Name          Status         Errors     Type    Level   Files       Bytes         Start Time            End Time        Run Time
  -----   --------------   ---------------  ----------  -------  -----  --------  -----------  -------------------  -------------------  --------
  13975   dns1                 Running               0   Backup   Diff         0      0.00 GB  2017-05-15 10:42:25  --=Still Running=--                    
  13973   Verify                -OK-                 0   Verify   VV2C       114      0.00 GB  2017-05-15 04:24:06  2017-05-15 04:26:31  00:02:25 
* 13974   Verify            Verify Diffs             0   Verify   VD2C         0      0.00 GB  2017-05-15 04:24:06  2017-05-15 04:24:08  00:00:02 
  13972   Catalog               -OK-                 0   Backup   Full       114      8.04 GB  2017-05-15 04:18:36  2017-05-15 04:24:02  00:05:26 
  13971   Zimbra8               -OK-                 0   Backup   Full   660,979     38.95 GB  2017-05-15 03:05:57  2017-05-15 04:12:36  01:06:39 
  13961   helpdesk              -OK-                 0   Backup   Incr     2,140      4.17 GB  2017-05-14 20:30:01  2017-05-14 20:36:29  00:06:28 
  13964   Speedy             OK/Warnings             2   Backup   Incr       367      1.40 GB  2017-05-14 20:00:06  2017-05-14 20:34:51  00:34:45 
  13957   jabber                -OK-                 0   Backup   Incr        40      0.01 GB  2017-05-14 20:00:06  2017-05-14 20:29:50  00:29:44 
  13970   xymon                 -OK-                 0   Backup   Incr       792      2.02 GB  2017-05-14 20:01:10  2017-05-14 20:28:13  00:27:03 
  13968   SpeedyVMs             -OK-                 0   Backup   Incr         0      0.00 GB  2017-05-14 20:25:24  2017-05-14 20:25:25  00:00:01 
  13966   Downloads             -OK-                 0   Backup   Incr       702      0.01 GB  2017-05-14 20:24:49  2017-05-14 20:25:24  00:00:35 
  13965   TheOffice             -OK-                 0   Backup   Incr         0      0.00 GB  2017-05-14 20:00:06  2017-05-14 20:25:22  00:25:16 
  13958   bacula                -OK-                 0   Backup   Incr        63      0.01 GB  2017-05-14 20:01:45  2017-05-14 20:25:17  00:23:32 
  13963   proxmox-a             -OK-                 0   Backup   Incr       159      0.02 GB  2017-05-14 20:01:39  2017-05-14 20:25:16  00:23:37 
  13959   dns1                  -OK-                 0   Backup   Incr        26      0.01 GB  2017-05-14 20:00:06  2017-05-14 20:25:07  00:25:01 
  13969   upsmon                -OK-                 0   Backup   Incr        46      0.00 GB  2017-05-14 20:00:06  2017-05-14 20:25:04  00:24:58 
  13962   Postbooks             -OK-                 0   Backup   Incr        30      0.02 GB  2017-05-14 20:01:43  2017-05-14 20:25:04  00:23:21 
  13967   CDRoms                -OK-                 0   Backup   Incr         0      0.00 GB  2017-05-14 20:00:06  2017-05-14 20:24:46  00:24:40 
  13960   dns2                  -OK-                 0   Backup   Incr        28      0.01 GB  2017-05-14 20:00:06  2017-05-14 20:01:45  00:01:39 
  13956   UpdateSlots           -OK-                 0    Admin   ----         0      0.00 GB  2017-05-14 20:00:06  2017-05-14 20:00:06  00:00:00 
  =================================
  Total Jobs  :              20
  Total Files :         665,600
  Total Bytes :           54.67 GB
  =================================



The HTML version of this email report would look something like this:

AttachmentSize
baculabackupreport-20170515.sh32.21 KB

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <b> <i> <u> <strong> <cite> <code> <pre> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

CAPTCHA
This question is for testing whether you are a human visitor and to prevent automated spam submissions.
9
H
?
b
D
G
Enter the code without spaces and pay attention to upper/lower case.