User Tools

Site Tools


nagios_active_checks

Monitoring Bacula with Nagios (active checks)

Introduction

The goal is to see whether all the backups in Bacula have been successfully completed within some period of time (eg. past 24 hours).

What you need

Assumptions

  • Nagios plugins are installed in /usr/local/lib/nagios/plugins/
  • your backup-server's name in Nagios configuration is “mybackup-srv”
  • backup-job you are monitoring is named “myserv-conf” in Bacula
  • you run the backup once a day
  • you are using MySQL as Bacula database

Configuration

Get the plugin

I assume you've got NRPE up and running. You only need one command to check all backups. The commands will query the Bacula database for backups' info.

First, download the script check_bacula.py (into Nagios plugins' directory) and restrict its permissions:

chown root:nagios check_bacula.py
chmod 750 check_bacula.py

Configure Nagios

I assume you've got Nagios up and running and there are already some services in place for the host we're going to monitor for successful backups.

Define a command for the check_bacula plugin:

define command{
  command_name                         check_bacula
  command_line                         $USER2$/check_bacula -H $HOSTADDRESS$ $ARG1$
}

Assuming you're doing one backup per day, it's enough to check the backup once per day. So let's define a template service for that, basing on already defined generic-service:

define service {
  name                    backup-service
  use                     generic-service
  check_command           check_bacula!-H bacula -U $USER14$ -P $USER15$ -D bacula --warning-severity=15 --critical-severity=25 --days=2
  normal_check_interval   1440 ; 24 hours
  max_check_attempts      2
  register                0
}

Now we need to add the service which actually checks the bacula jobs (substituting the correct bacula job name, of course):

define service {
  use                      backup-service
  host_name                mybackup-srv
  service_description      Bacula-backup
  register                 1
}

Run the nagios pre-flight check and fix any reported errors:

nagios -v

If everything is OK, restart Nagios to apply the changes.

nagios_active_checks.txt · Last modified: 2017/04/08 17:57 by svarco