• Getting Bacula to send daily summery emails with MariaDB

    I was looking for a way to get a summery report of the last backup jobs ran in the last 24 hours and I ran across this article here http://www.revpol.com/baculasummaryemails.  When I tried to get it working with my installations using MariaDB, it wouldn’t work.  I found that the Mysql query code had to be tweaked a little in order to work with MariaDB and was able to get it to work.

    Converted to HTML, Color coded status and added Time Taken.

    I also didn’t like how the text in the email body just ran together so I added HTML formatting to lay the data out into a table and also added color coding to the status area to give quick visual indications of the job status.  I really wanted to know the run time of the jobs too so I added that as well.  I also added a logo to the header to simply tweak it out a bit.

    This works great on my systems running Centos 7, Bacula 7.0.5 and MariaDB.

    Here is a screenshot of the email:

     

    Here is the modified code I used which includes the query for MariaDB and the HTML code.  There are some CSS styles you can modify if you want larger text or a different font.  I have not tested with MySQL or PgSQL but did add the additional field to pull in Run Time.

    Click Here to Download

     

    To run, set up as a cron job like this with the time period you wish to report on (i.e. 24 for last 24 hours)

    /dirtofile/baculabackupreport.sh 24

    Special thanks to http://www.revpol.com/baculasummaryemails for publishing the script!

Comments are closed.