Defined Type: mariadb::monitor_backup

Defined in:
modules/mariadb/manifests/monitor_backup.pp

Overview

Checks the metadata database backups of a particular section, datacenter and type, and sets up an icinga alert about it

Parameters:

  • db_host (Any)
  • db_user (Any)
  • db_password (Any)
  • db_database (Any)
  • section (Any)
  • datacenter (Any)
  • type (Any) (defaults to: 'dump')
  • freshness (Any) (defaults to: 691200)
  • min_size (Any) (defaults to: 307200)
  • warn_size_percentage (Any) (defaults to: 5)
  • crit_size_percentage (Any) (defaults to: 15)


3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'modules/mariadb/manifests/monitor_backup.pp', line 3

define mariadb::monitor_backup (
    $db_host,
    $db_user,
    $db_password,
    $db_database,
    $section,
    $datacenter,
    $type                 = 'dump',
    $freshness            = 691200,  # 8 days
    $min_size             = 307200,
    $warn_size_percentage = 5,
    $crit_size_percentage = 15,
) {

    $check_command = "/usr/local/bin/check_mariadb_backups.py \
--host='${db_host}' --user='${db_user}' --password='${db_password}' --database='${db_database}' \
--section='${section}' --datacenter='${datacenter}' \
--type='${type}' --freshness='${freshness}' --min-size='${min_size}' \
--warn-size-percentage='${warn_size_percentage}' --crit-size-percentage='${crit_size_percentage}'"

    nrpe::monitor_service { "mariadb_${type}_${section}_${datacenter}":
        description    => "${type} of ${section} in ${datacenter}",
        nrpe_command   => $check_command,
        critical       => false,
        contact_group  => 'admins',
        check_interval => 30,  # Don't check too often
        require        => File['/usr/local/bin/check_mariadb_backups.py'],
        notes_url      => 'https://wikitech.wikimedia.org/wiki/MariaDB/Backups#Alerting',
    }
}