Puppet Class: pgpool::monitor

Defined in:
manifests/monitor.pp

Overview

Class: pgpol::monitor

This is a class to pull in the custom pgpool monitoring for monitoring pgpool instances. You should specify the connection information for the database and to talk to pgpool via pcp. The db test will attempt to create and write to a temp table to ensure that write connections work as well as doing a “SELECT 1” to test read connections. The pcp monitoring will return the total number of backends, number available and number of processes.

See github.com/rackerlabs/pgpool-monitor

Parameters

ensure

This is one of present, latest, or absent. Defaults to latest.

db_host

String. The host to connect to pgpool on for postgresql connectons. Defaults to localhost

db_port

Integer. The port to connect to pgpool on for the postgresql connections. Defaults to 9999.

db_database

String. The database to connect to and try to read/write. Defaults to postgres.

db_user

String. The user to connect to pgpool as for postgresql queries. Defaults to zabbix.

db_password

String. The password use to connect to pgpool as for postgresql queries. Defaults to .

pcp_timeout

Integer. The timeout used to connect to the pcp port of pgpool. Defaults to 9898.

pcp_host

String. The host used to connect to the pcp. Defaults to localhost.

pcp_port

Integer. The port used to connect to pcp. Defaults to 9898.

pcp_user

String. The user used to connect to pcp. Defaults to zabbix.

pcp_password

String. The password used to connect to pcp. Defaults to zabbix.

Examples

include pgpool::monitor

class { ‘pgpool::monitor’:

ensure => absent

}

Authors

Parameters:

  • ensure (Any) (defaults to: latest)
  • db_host (Any) (defaults to: 'localhost')
  • db_port (Any) (defaults to: 9999)
  • db_database (Any) (defaults to: 'postgres')
  • db_user (Any) (defaults to: 'zabbix')
  • db_password (Any) (defaults to: '')
  • pcp_timeout (Any) (defaults to: 10)
  • pcp_host (Any) (defaults to: 'localhost')
  • pcp_port (Any) (defaults to: 9898)
  • pcp_user (Any) (defaults to: 'zabbix')
  • pcp_password (Any) (defaults to: 'zabbix')


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
155
156
157
158
159
160
161
162
163
164
# File 'manifests/monitor.pp', line 70

class pgpool::monitor (
  $ensure           = latest,
  $db_host          = 'localhost',
  $db_port          = 9999,
  $db_database      = 'postgres',
  $db_user          = 'zabbix',
  $db_password      = '',
  $pcp_timeout      = 10,
  $pcp_host         = 'localhost',
  $pcp_port         = 9898,
  $pcp_user         = 'zabbix',
  $pcp_password     = 'zabbix',
) {

  if $ensure == absent {
    $file_ensure = absent
    $ini_ensure = absent
  } else {
    $file_ensure = file
    $ini_ensure = present
  }

  package { 'pgpool_monitor':
    ensure => $ensure,
  }

  $config_file = '/etc/pgpool_monitor.cfg'
  file { $config_file:
    ensure  => $file_ensure,
    owner   => 'zabbix',
    group   => 'zabbix',
    require => Package['pgpool_monitor'],
  }

  $config_defaults = {
    'ensure' => $ini_ensure,
    'path'   => $config_file
  }

  $config_settings = {
    'db_host' => {
      section => 'db',
      setting => 'host',
      value   => $db_host
    },
    'db_port' => {
      section => 'db',
      setting => 'port',
      value   => $db_port
    },
    'db_database' => {
      section => 'db',
      setting => 'database',
      value   => $db_database
    },
    'db_user' => {
      section => 'db',
      setting => 'user',
      value   => $db_user
    },
    'db_password' => {
      section => 'db',
      setting => 'password',
      value   => $db_password
    },
    'pcp_timeout' => {
      section => 'pcp',
      setting => 'timeout',
      value   => $pcp_timeout
    },
    'pcp_host' => {
      section => 'pcp',
      setting => 'host',
      value   => $pcp_host
    },
    'pcp_port' => {
      section => 'pcp',
      setting => 'port',
      value   => $pcp_port
    },
    'pcp_user' => {
      section => 'pcp',
      setting => 'user',
      value   => $pcp_user
    },
    'pcp_password' => {
      section => 'pcp',
      setting => 'password',
      value   => $pcp_password
    },
  }
  if $file_ensure == file {
    create_resources(ini_setting, $config_settings, $config_defaults)
  }
}