We have a dashing dashboard to give an overview of our infrastructure. Icinga, jenkins, foreman, web-services, traffic times.. Almost everything is been captured.. Only for bacula I could not find an existing one.
So I decided to write one myself. The first idea was to scrape the bacula-web overview site and use that output in a dashing screen. Mainly because a missing API for bacula or bacula-web. Nevertheless scraping a website isn't the best idea if that layout changes your quite fucked up..
After googling around I came across an exampling of using mysql with ruby. So I decided to use this approach to have an overview of the bacula state since we configured bacula using a mysql database.
In you dashing root directory you have to add those gems into the Gemfile.
gem 'dbi'
gem 'dbd-mysql'
gem 'mysql2'
gem 'mysql'
gem 'pg'
And install them using
$ bundle install
Now copy the bacula.rb into the jobs directory and fill in the database details of your bacula director machine. I created a special db user which only can execute the select command from the dashing server to the mysql database.
Next step is to insert the html code in your dashing file dashingRootDir/dashboards/####.erb
<li data-row="1" data-col="2" data-sizex="1" data-sizey="1">
<div data-id="bacula" data-view="List" data-unordered="true" data-title="Backup state" onclick="window.open('http://your.bacula-web.instance/','Bacula');";></div>
</li>
So now you have an overview of the backup jobs of the last 24hrs in your dashing setup.