Puppet Class: postgresql::slave::monitoring

Defined in:
modules/postgresql/manifests/slave/monitoring.pp

Overview

check_postgres_hot_standby_delay script relies on values that are only readable by superuser or replication user. This prevents using a dedicated user for monitoring.

Parameters:

  • pg_master (Any)
  • pg_password (Any)
  • pg_user (Any) (defaults to: 'replication')
  • pg_database (Any) (defaults to: 'template1')
  • description (Any) (defaults to: 'Postgres Replication Lag')
  • critical (Any) (defaults to: 16777216)
  • warning (Any) (defaults to: 1048576)
  • retries (Any) (defaults to: 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
# File 'modules/postgresql/manifests/slave/monitoring.pp', line 4

class postgresql::slave::monitoring(
    $pg_master,
    $pg_password,
    $pg_user = 'replication',
    $pg_database = 'template1',
    $description = 'Postgres Replication Lag',
    $critical = 16777216, # 16Mb
    $warning = 1048576, # 1Mb
    $retries = 3, # the default for nrpe::monitor_service
) {

    $icinga_command = "/usr/bin/check_postgres_hot_standby_delay \
--host=${pg_master},localhost --dbuser=${pg_user} \
--dbpass=${pg_password} --dbname=${pg_database} \
--warning=${warning} --critical=${critical}"

    nrpe::monitor_service { 'postgres-rep-lag':
        description  => $description,
        nrpe_command => $icinga_command,
        notes_url    => 'https://wikitech.wikimedia.org/wiki/Postgres#Monitoring',
        retries      => $retries,
    }

}