Base Function
Basics
BGuardian needs to be able to connect to bdirjson tools, bconsole and the catalog.
BConsole and bdirjson commands are expected to be inside the /opt/bacula/bin directory. If the installation was done using custom paths, it will be needed to create symlinks to this location.
BGuardian uses the same kind of connection to the catalog that Bacula instance is using in the same host. Therefore, it will use the same credentials and database name that is configured int he ‘Catalog’ resource of the Director configuration.
BGuardian may be executed manually from the command line by running the script. Normally, if the connection to the database is using ‘peer’ mode it should be run by the bacula user:
sudo -u bacula /bin/bash /opt/bacula/bin/bguardian
Note that /bin/bash may not be required if the bacula user can find the bash binary regularly.
It is recommended to run it from a Bacula Admin Job and schedule it once a day:
Admin Job example:
Job {
Name = "BGuardian"
Type = Admin
Schedule = Daily0100
JobDefs = JobDefault
Runscript {
RunsWhen = Before
RunsOnClient = no
Command = "sudo -u bacula /bin/bash /opt/bacula/bin/bguardian"
}
}
Daily Schedule example:
Schedule {
Name = "Daily0100"
Run = Level=Full daily at 01:00
}
BGuardian will run an analysis of all the configured services and produce some reports by default, as well as the corresponding alerts, that are stored as individual files. However, it also has a mode where it is possible to interact with the existing alerts in the system in order to show them, remove them or mark them to be ignored.
In general there is no need to change any parameter of BGuardian as it will work out of the box. However, it is possible to tune it in order to adjust the tests which are run and the results based on the specific environment it is being run in.
The daemon can receive parameters in 3 different forms:
Daemon parameters
The format is:
--parameter_name parameter_value
Note the ‘–’ before parameter name and the space in between to put the value.
Example:
sudo -u bacula /bin/bash /opt/bacula/bin/bguardian --dev_min_executions 10 --max_days_copy 30
Parameters in a file
It’s needed to use the special parameter:
--config_file "/opt/bacula/etc/bguardian.conf"
Then, the file may contain the parameters using:
par1=val1
par2=val2
par3=val3
...
Example:
reports_keep_number=10
disable_events=true
configuration_checks_exclude=restore,verify,copy
services_exclude=successratio,restorefrequency
success_factor=0.7
Special alert commands
There are some commands regarding the alerts that have some shortcuts which may be invoked directly as:
# List active alerts in json format
sudo -u bacula /bin/bash /opt/bacula/bin/bguardian list
# List ignore alerts in json format
sudo -u bacula /bin/bash /opt/bacula/bin/bguardian list_ignore
# List active alerts in text format
sudo -u bacula /bin/bash /opt/bacula/bin/bguardian list_text
# List ignore alerts in text format
sudo -u bacula /bin/bash /opt/bacula/bin/bguardian list_ignore_text
# Add ignore
sudo -u bacula /bin/bash /opt/bacula/bin/bguardian ignore "code"
# Remove ignore
sudo -u bacula /bin/bash /opt/bacula/bin/bguardian remove_ignore "code"
# Remove alert
sudo -u bacula /bin/bash /opt/bacula/bin/bguardian remove_alert "code"
BGuardian can send events regarding the alerts that it generates, which is recommended. To benefit from this feature, it is necessary to enable events in the proper message resource, adding the special ‘events’ keyword to the configuration:
Events configuration example:
Messages {
Name = Standard
mailcommand = "/tmp/regress/bin/bsmtp -h localhost -f \"\(Bacula regression\) %r\" -s \"Regression: %t %e of %c %l\" %r"
operatorcommand = "/tmp/regress/bin/bsmtp -h localhost -f \"\(Bacula regression\) %r\" -s \"Regression: Intervention needed for %j\" %r"
console = all, !skipped, !terminate, !restored, events
append = "/tmp/regress/working/log" = all, !skipped, events
catalog = all, !skipped, events
}
Go back to the main configuration page.