I write a lot of code, most of it unsuitable for release to the public but this little gem is worth a public release.
After using Bacula to backup all my servers (both Windows and Linux) for some time, the large number of mailings you get when using it on a small server park drove me insane. Even when using filters to sort out new mail, it is hard to see if everything is going as it should be.
Enter Bacula Reports: a mail aggregator for Bacula 2.x and 3.x.
Bacula Reports consists of a faux mail command (which does not send out reports by mail but rather analyses and stores them) and a report generator which aggregates all the stored reports into one mailing with an overview and some HTML styling to make it more readable (if you don’t want HTML, modify the template to generate plain text).
By integrating the scripts into the Bacula configuration at 2 points (a mail command used for sending out reports and a job to send out the combined report), the storm of daily mails changes into one neat report at the end of the backup cycle.
Normal error messages and operator messages are unaffected and will be delivered as they used to be, only the backup reports per job are redirected to Bacula Reports.
Requirements:
- A linux server (32 or 64 bit, tested on CentOS 5.2 and Gentoo 2008)
- A working Bacula 2.x or 3.x installation
- PHP as a command line interpreter (run ‘php –v’ to see if you have it)
- 10 minutes of your time to set everything up
The cool thing of the scripts is that they require only 2 small changes in the director configuration to reroute the status mailings and if you don’t like it or run into trouble, reverting is normally a matter of simply commenting out the modified lines and restoring the old ones.
One drawback for some people: it requires PHP on the command line (as stated before). The reason for this is very simple: I want to use the same code in the future for a web GUI and my unix-scripting skills are virtually non-existing compared to PHP or Java.
Even though its PHP, the scripts have a small footprint and run very fast – they should be easy to add to any existing Bacula environment.
{jd_file file==5} {jd_file file==6}