Skip to content
aussendorf edited this page Sep 15, 2014 · 4 revisions

Table of Contents

Some remarks about the classes and sample plugins

File list

  • BareosFdWrapper.py - The BareosFdWrapper module. Here is a global object bareos_fd_plugin_object and wrapper functions, which are directly called out of the bareos-fd. They are intended to pass the call to a method of an object of type BareosFdPluginBaseclass (or derived). Class based plugins import this module to have all function calls passed to their corresponding class-methods.
  • BareosFdPluginBaseclass.py - Implements the plugin Baseclass
  • bareos-fd-mock-test.py - A sample plugin that uses the Baseclass, doing nothing (can be taken as skeleton)
  • BareosFdPluginLocalFileset.py - Contains a derived class that adds files listed in a local file to the backup fileset
  • bareos-fd-local-fileset.py - The plugin that uses BareosFdPluginLocalFileset

Usage

To use the plugin bareos-fd-local-fileset.py,

  • copy it to your plugin directory (usually /usr/lib64/bareos/plugins)
  • you need the directive
   Plugin Directory = /usr/lib64/bareos/plugins

in the FileDaemon Section of the bareos-fd.conf

  • Add a line like
   Plugin = "python:module_path=/usr/lib64/bareos/plugins:module_name=bareos-fd-local-fileset:filename=/etc/bareos/extra-files"

to your fileset definition.

  • Write some filenames into /etc/bareos/extra-files on your backup client. The plugin then adds all files listed in that file to your fileset.
  • Write your own plugins as derived class

Write your own python plugin / class

All you have to do is

  • Derive your plugin class from on of the existing classes
  • Adapt a plugin script like bareos-fd-local-fileset.py to use your own class
  • Use your plugin script in the Plugin call like above

Further Reading

The Python plugin interface is based more or less on the C-plugin interface from Bacula. Therefore this guide explains some backgrounds like what the functions do, which variables and events exist:

http://www.bacula.org/5.2.x-manuals/en/developers/developers/Bacula_FD_Plugin_API.html