Puppet Class: nagios::check::postgres

Defined in:
manifests/check/postgres.pp

Overview

Parameters:

  • args (Any) (defaults to: undef)
  • check_period (Any) (defaults to: undef)
  • first_notification_delay (Any) (defaults to: undef)
  • notification_period (Any) (defaults to: undef)
  • modes_enabled (Any) (defaults to: [])
  • modes_disabled (Any) (defaults to: [])
  • pkg (Any) (defaults to: true)
  • ensure (Any) (defaults to: undef)
  • standby_mode (Any) (defaults to: false)
  • privileged_user (Any) (defaults to: 'postgres')
  • plugin (Any) (defaults to: 'check_postgres')
  • custom_queries (Any) (defaults to: {})
  • args_archive_ready (Any) (defaults to: '')
  • args_autovac_freeze (Any) (defaults to: '')
  • args_backends (Any) (defaults to: '')
  • args_bloat (Any) (defaults to: '')
  • args_checkpoint (Any) (defaults to: '-w 300')
  • args_cluster_id (Any) (defaults to: '')
  • args_commitratio (Any) (defaults to: '')
  • args_connection (Any) (defaults to: '')
  • args_database_size (Any) (defaults to: '-w 1t')
  • args_disabled_triggers (Any) (defaults to: '')
  • args_disk_space (Any) (defaults to: '')
  • args_fsm_pages (Any) (defaults to: '')
  • args_fsm_relations (Any) (defaults to: '')
  • args_hitratio (Any) (defaults to: '')
  • args_hot_standby_delay (Any) (defaults to: '-w 10m')
  • args_last_analyze (Any) (defaults to: '')
  • args_last_vacuum (Any) (defaults to: '')
  • args_last_autoanalyze (Any) (defaults to: '')
  • args_last_autovacuum (Any) (defaults to: '')
  • args_listener (Any) (defaults to: '')
  • args_locks (Any) (defaults to: '')
  • args_logfile (Any) (defaults to: '')
  • args_new_version_bc (Any) (defaults to: '')
  • args_new_version_box (Any) (defaults to: '')
  • args_new_version_tnm (Any) (defaults to: '')
  • args_pgb_pool_cl_active (Any) (defaults to: '')
  • args_pgb_pool_cl_waiting (Any) (defaults to: '')
  • args_pgb_pool_sv_active (Any) (defaults to: '')
  • args_pgb_pool_sv_idle (Any) (defaults to: '')
  • args_pgb_pool_sv_used (Any) (defaults to: '')
  • args_pgb_pool_sv_tested (Any) (defaults to: '')
  • args_pgb_pool_sv_login (Any) (defaults to: '')
  • args_pgb_pool_sv_maxwait (Any) (defaults to: '')
  • args_pgbouncer_backends (Any) (defaults to: '')
  • args_pgbouncer_checksum (Any) (defaults to: '')
  • args_pgagent_jobs (Any) (defaults to: '')
  • args_prepared_txns (Any) (defaults to: '')
  • args_query_time (Any) (defaults to: '-w 2m')
  • args_same_schema (Any) (defaults to: '')
  • args_sequence (Any) (defaults to: '')
  • args_settings_checksum (Any) (defaults to: '')
  • args_slony_status (Any) (defaults to: '')
  • args_txn_idle (Any) (defaults to: '-w 15s -c 1m')
  • args_txn_time (Any) (defaults to: '-w 5m -c 10m')
  • args_txn_wraparound (Any) (defaults to: '')
  • args_version (Any) (defaults to: '')
  • args_wal_files (Any) (defaults to: '')


1
2
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
# File 'manifests/check/postgres.pp', line 1

class nagios::check::postgres (
  $args                     = undef,
  $check_period             = undef,
  $first_notification_delay = undef,
  $notification_period      = undef,
  $modes_enabled            = [],
  $modes_disabled           = [],
  $pkg                      = true,
  $ensure                   = undef,
  $standby_mode             = false,
  $privileged_user          = 'postgres',
  $plugin                   = 'check_postgres',
  $custom_queries           = {},
  # Modes
  $args_archive_ready       = '',
  $args_autovac_freeze      = '',
  $args_backends            = '',
  $args_bloat               = '',
  $args_checkpoint          = '-w 300',
  $args_cluster_id          = '',
  $args_commitratio         = '',
  $args_connection          = '',
  $args_database_size       = '-w 1t',
  $args_disabled_triggers   = '',
  $args_disk_space          = '',
  $args_fsm_pages           = '',
  $args_fsm_relations       = '',
  $args_hitratio            = '',
  $args_hot_standby_delay   = '-w 10m',
  $args_last_analyze        = '',
  $args_last_vacuum         = '',
  $args_last_autoanalyze    = '',
  $args_last_autovacuum     = '',
  $args_listener            = '',
  $args_locks               = '',
  $args_logfile             = '',
  $args_new_version_bc      = '',
  $args_new_version_box     = '',
  $args_new_version_tnm     = '',
  $args_pgb_pool_cl_active  = '',
  $args_pgb_pool_cl_waiting = '',
  $args_pgb_pool_sv_active  = '',
  $args_pgb_pool_sv_idle    = '',
  $args_pgb_pool_sv_used    = '',
  $args_pgb_pool_sv_tested  = '',
  $args_pgb_pool_sv_login   = '',
  $args_pgb_pool_sv_maxwait = '',
  $args_pgbouncer_backends  = '',
  $args_pgbouncer_checksum  = '',
  $args_pgagent_jobs        = '',
  $args_prepared_txns       = '',
  $args_query_time          = '-w 2m',
  $args_same_schema         = '',
  $args_sequence            = '',
  $args_settings_checksum   = '',
  $args_slony_status        = '',
  $args_txn_idle            = '-w 15s -c 1m',
  $args_txn_time            = '-w 5m -c 10m',
  $args_txn_wraparound      = '',
  $args_version             = '',
  $args_wal_files           = '',
) {

  # Generic overrides
  if $check_period {
    Nagios_service { check_period => $::nagios_check_postgres_period }
  }
  if $first_notification_delay {
    Nagios_service { first_notification_delay => $::nagios_check_postgres_first_notification_delay }
  }
  if $notification_period {
    Nagios_service { notification_period => $::nagios_check_postgres_notification_period }
  }

  # The check is being executed via sudo
  file { '/etc/sudoers.d/nagios_check_postgres':
    ensure  => $ensure,
    owner   => 'root',
    group   => 'root',
    mode    => '0440',
    # We customize the user, the nagios plugin dir and few other things
    content => template('nagios/plugins/check_postgres-sudoers.erb'),
  }

  # Optional package containing the script
  if $pkg {
    $pkgname = 'nagios-plugins-postgres'
    $pkgensure = $ensure ? {
      'absent' => 'absent',
      default  => 'installed',
    }
    package { $pkgname: ensure => $pkgensure }
  }

  Package <| tag == 'nagios-plugins-perl' |>

  # Modes-specific definition
  nagios::check::postgres::mode { [
    'archive_ready',
    'autovac_freeze',
    'backends',
    'bloat',
    'checkpoint',
    'cluster_id',
    'commitratio',
    'connection',
    'database_size',
    'disabled_triggers',
    'disk_space',
    'fsm_pages',
    'fsm_relations',
    'hitratio',
    'hot_standby_delay',
    'last_analyze',
    'last_vacuum',
    'last_autoanalyze',
    'last_autovacuum',
    'listener',
    'locks',
    'logfile',
    'new_version_bc',
    'new_version_box',
    'new_version_cp',
    'new_version_pg',
    'new_version_tnm',
    'pgb_pool_cl_active',
    'pgb_pool_cl_waiting',
    'pgb_pool_sv_active',
    'pgb_pool_sv_idle',
    'pgb_pool_sv_used',
    'pgb_pool_sv_tested',
    'pgb_pool_sv_login',
    'pgb_pool_sv_maxwait',
    'pgbouncer_backends',
    'pgbouncer_checksum',
    'pgagent_jobs',
    'prepared_txns',
    'query_time',
    'same_schema',
    'sequence',
    'settings_checksum',
    'slony_status',
    'txn_idle',
    'txn_time',
    'txn_wraparound',
    'version',
    'wal_files',
  ]:
  }

  # Custom queries
  nagios::check::postgres::custom_query { keys($custom_queries): }

}