Jump to content

Check bacula.py

From Wikitech

Check bacula is a wrapper for bconsole that is able to produce output to be used by icinga and prometheus, as well as used interactively to debug backup job errors/misses, useful for monitoring of backups generated by Bacula in the WMF production.


check_bacula.py --help
usage: check_bacula.py [-h] [--list-jobs] [--prometheus] [--port PORT]
                       [--icinga] [--backup_config_path BACKUP_CONFIG_PATH]
                       [--bconsole_path BCONSOLE_PATH]

Checks bacula backup freshness status and prints it on standard output (or
starts the bacula prometheus exporter).

positional arguments:
  job                   If set, check only the status of this job. Otherwise,
                       check all jobs.

optional arguments:
  -h, --help            show this help message and exit
  --list-jobs           When used, it just prints the list of configured
                        backup jobs and returns without any check.
  --prometheus          If set, instead of outputing information to the
                        command line, it waits in a loop listening for an HTTP
                        request and returns metrics in the typical prometheus
                        exporter format.
  --port PORT           When using the prometheus mode, it binds and listens
                        on this port. If no one is given, 9133 is used by
  --icinga              If set, it prints just a summary for icinga.
                        Otherwise, it prints a detailed output to the command
  --backup_config_path BACKUP_CONFIG_PATH
                        Path of the directory with the files where the bacula
                        job configuration is, by default:
  --bconsole_path BCONSOLE_PATH
                        Full path of the "bconsole" executable, by default:

Examples of interactive usage

  • No parameters run will do the full list of configured backups, classified by freshness (See Bacula#Monitoring for the categories). Similar to the icinga output but without sumarizing
  • To list jobs, one per line, without checking or classifying:
check_bacula.py --list-jobs
  • To give the available list of past jobs for a particular job (including its id, timestamp, level, finishing status and total size), one can run:
check_bacula.py <full-job-name>

See also