Note
You can download this article as a PDF
Inventory plugin
Overview
Features Summary
The Bacula Enterprise inventory plugin provides a framework that can be used to query components information for each Bacula client. The inventory information can be queried at will from bconsole.
Inventory Hooks
Inventory hooks are installed in /opt/bacula/etc/inventory.d
and can be
queried separately.
Basic
Linux
database-mysql.sh
database-postgresql.sh
Queries mysql and postgresql databases informations.
Windows
databases-mssql.ps1
hyperv-inventory.ps1
Queries mssql databases and hyper-V hypervisor information.
Installation
Configuration of the Bacula File Daemon
- The
Plugin Directory
directive of theFile Daemon
resource in /opt/bacula/etc/bacula-fd.conf should point to the location where the
azure-vm-fd.so
plugin is installed. The default directory is: /opt/bacula/plugins
FileDaemon {
Name = bacula-fd
Plugin Directory = /opt/bacula/plugins
...
}
Installation of the Plugin
For more information about plugin installation see Linux: Install File Daemon (Client).
Windows
The Bacula Enterprise inventory plugin is selectable as a component of the File Daemon windows installer.
Example
From bconsole, run the following command:
.query parameter=database* client=localhost-fd plugin="inventory:"
The output provided by the hook is a JSON object with the following information:
{
"result": [
{
"source": "mysql",
"type": "Database",
"info": "mysql Ver 14.14 Distrib 5.7.34, for Linux (x86_64) using EditLine wrapper",
"version": 1,
"runscript": [
{
"name": "clientrunbeforejob",
"run": "systemctl stop mysql"
},
{
"name": "clientrunafterjob",
"run": "systemctl start mysql"
}
],
"status": 1
},
{
"source": "postgresql",
"type": "Database",
"info": "psql (PostgreSQL) 13.9 (Debian 13.9-0+deb11u1)",
"version": 1,
"runscript": [
{
"name": "clientrunbeforejob",
"run": "systemctl stop postgresql"
},
{
"name": "clientrunafterjob",
"run": "systemctl start postgresql"
}
],
"status": 1
}
],
"version": "1",
"request": "*database*",
"type": "inventory_report",
"timesec": 1671718067,
"hostname": "stretch",
"uptime": 13698,
"uname": "Linux stretch 5.10.0-20-amd64 #1 SMP Debian 5.10.158-2 (2022-12-13) x86_64"
}
Option |
Description |
---|---|
source version info error runscript |
(String) Name of the hook (String) Version of the hook program (String) useful information (version, build, etc.) (Int) different from zero to raise an error (Array) suggestions on how to handle the component |
Advanced
Hook Protocol Definition
inventory hooks can be written in any language. Some environment variables are passed to all hooks.
Option |
Default |
Description |
---|---|---|
BACULA_WORKINGDIR BACULA_SYSCONFDIR BACULA_BINDIR |
/opt/bacula/working /opt/bacula/etc /opt/bacula/bin |
Bacula Working directory Bacula Configuration directory Bacula Binary directory |
Limitations
The
restart
command has limitations with plugins, as it initiates the Job from scratch rather than continuing it. Bacula determines whether a Job is restarted or continued, but using therestart
command will result in a new Job.