Jump to content

Check bacula.py

From Wikitech
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

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.

Usage

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]
                       [job]

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
                        default.
  --icinga              If set, it prints just a summary for icinga.
                        Otherwise, it prints a detailed output to the command
                        line.
  --backup_config_path BACKUP_CONFIG_PATH
                        Path of the directory with the files where the bacula
                        job configuration is, by default:
                        "/etc/bacula/jobs.d".
  --bconsole_path BCONSOLE_PATH
                        Full path of the "bconsole" executable, by default:
                        "/usr/sbin/bconsole".

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
check_bacula.py
  • 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