Sunday, 14 November 2010

Configuring Bacula Tray Monitor on Ubuntu

I use Bacula to back up my servers and desktop/laptop computers. It's always bugged me that I didn't have a little icon on my Ubuntu desktop showing the status of the backup: whether it was running or not and some indication of progress. Most backup systems have this. In Bacula it's called the tray monitor. The configuration file documentation seemed straightforward, but it took a lot of fiddling to get it right.

I think I have a fairly typical situation:
  • A backup server with a direct attached backup storage device (in my case, two: a USB-connected 1 TB hard drive, and a DAT-72 tape drive)
  • Several clients being backed up on a regular schedule
  • One client is the laptop I use as my normal workstation. This is the one I want to put the tray monitor on
  • I'm already successfully backing up this configuration, so all my passwords in my Bacula configuration files are correct, and all my firewalls are configured to allow the backup to work
  • The laptop and the backup server are both running Ubuntu 10.04
Here's what I did to get the tray monitor to work (read my notes below before you start cutting and pasting the following into your configuration):
  1. I installed the tray monitor software on my laptop:
  2. sudo apt-get install bacula-traymonitor
    
  3. On my laptop I changed the tray monitor configuration file (/etc/bacula/tray-monitor.conf) to look like this:
  4. Monitor {
      Name = backup02-mon
      Password = "Monitor-Password"
      RefreshInterval = 5 seconds
    }
    
    Client {
      Name = pacal-mon
      Address = pacal.pender.jadesystems.ca
      FDPort = 9102
      Password = "Monitor-Password"
    }
  5. Still on the laptop, I added the following to the file daemon, aka backup client, configuration file (/etc/bacula/bacula-fd.conf):
  6. # Restricted Director, used by tray-monitor to get the
    #   status of the file daemon
    
    Director {
      Name = backup02-mon
      Password = "Monitor-Password"
      Monitor = yes
    }
  7. I restarted the file daemon on the laptop (don't forget this or you'll confuse yourself horribly):
  8. sudo service bacula-fd restart
    
  9. On the backup server, I added the following to the director configuration file (/etc/bacula/bacula-dir.conf):
  10. # Restricted console used by tray-monitor to get the status of the director
    Console {
      Name = backup02-mon
      Password = "Monitor-Password"
      CommandACL = status, .status
    }
  11. Finally, I reloaded the configuration file on the backup server:
  12. sudo bconsole 
    reload 
    exit 
    
  13. Now all I had to do is start the tray monitor. The command line is:
  14. bacula-tray-monitor -c /etc/bacula/tray-monitor.conf
Then I made a menu item for it. I put it in Applications-> System Tools.
  1. Select System-> Preferences-> Main Menu
  2. Select "System Tools" on the left side of the window
  3. Click on the "New Item" button on the right side of the window
  4. Fill in the "Name:" box with "Bacula Tray Monitor" and the "Command:" box with the command line above
  5. Click "OK"
  6. Click "Close" in the "Main Menu" window
Notes:
  • I used a separate password specifically for the monitor. The tray monitor's configuration file has to be readable by an ordinary user without special privileges. So anyone can see the password. Don't use the same password for the monitor as you use for the director or the file daemons, or you'll be making it easy for anyone who gets access to your computer to read all the files on your network.
  • You have to change to above bits of configuration file to match your particular configuration. Change: "laptop.example.com" to the fully qualified domain name of the computer on which you're installing the tray monitor. Change "Monitor-Password" to something else more secure that everyone who reads this blog doesn't know about. 
  • "backup02-mon" and "laptop-mon" are both names you can change to be anything you want them to be. In my case, "backup02-mon" means the monitor on the backup server (hostname: backup02), and "laptop-mon" means the monitor on the laptop (hostname: laptop)

2 comments:

sabrina974 said...

Hello,



I have gota server Debian Squeeze 6.0.2, updated.

I’veinstalled mysql-server. Then I’ve installed Bacula, using command “apt-getinstall”. Installation’s good.

I’ve donesome tests :

- I’veput a debian squeeze client : Backup ok

- SomeWindows Seven clients, on which I’ve put the lastest version of Bacula.



I’ve gotproblems with the Windows Seven clients.

I’ve got oneclient (PC-inf-03), works properly for save, but unable to start BAT,and I’ve got this message:



"bat:ABORTING due to ERROR in console/console.cpp:155
Failes to connect to SRVTLX01-dir for populateLists."



I’ve gotsome errors reported in Windows Events :



Nom de l’application défaillante bat.exe,version : 0.0.0.0, horodatage : 0x4bd743cf

Nom du module défaillant : bacula.dll,version : 0.0.0.0, horodatage : 0x4bd74377

Code d’exception : 0xc0000005

Décalage d’erreur : 0x00032f45

ID du processus défaillant : 0x16a0

Heure de début de l’applicationdéfaillante : 0x01cc57347e9d42a5

Chemin d’accès de l’applicationdéfaillante : C:\Program Files\Bacula\bat.exe

Chemin d’accès du module défaillant:C:\Program Files\Bacula\bacula.dll

ID de rapport : df66dc12-c327-11e0-af8e-14feb5e22837



The Baculaservice start only manually.



Otherclients :unable to start BAT, unable to start the Bacula service too. And there’s anerror 1067 when trying to start bacula service.

The ServerBacula : unable to join them.



So I wishyou’ll help me.

Thanks alot,

Larry Reid said...

I haven't used BAT, so I can't really help you much. One thing I can suggest is to make sure that you have a version of Bacula that works on Windows 7. Also, make sure that the version on your backup server is compatible with the version on your Windows 7 clients.

Sorry I can't be of more help.