Skip to content

Commit

Permalink
Add pgbouncer_exporter parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
liger1978 committed May 29, 2020
1 parent ba02c3a commit f111e5e
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 1 deletion.
8 changes: 8 additions & 0 deletions REFERENCE.md
Original file line number Diff line number Diff line change
Expand Up @@ -393,6 +393,14 @@ Hash of 'postgres_exporter' config parameters.

Default value: `undef`

##### `pgbouncer_exporter`

Data type: `Optional[Hash]`

Hash of 'pgbouncer_exporter' config parameters.

Default value: `undef`

##### `gitlab_monitor`

Data type: `Optional[Hash]`
Expand Down
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
# @param node_exporter Hash of 'node_exporter' config parameters.
# @param redis_exporter Hash of 'redis_exporter' config parameters.
# @param postgres_exporter Hash of 'postgres_exporter' config parameters.
# @param pgbouncer_exporter Hash of 'pgbouncer_exporter' config parameters.
# @param gitlab_monitor Deprecated if using Gitlab > 12.3 and < 13.0, unsupported by gitlab omnibus using Gitlab 13+. Hash of 'gitlab_monitor' config parameters.
# @param gitlab_exporter Hash of 'gitlab_exporter' config parameters.
# @param pages_external_url External URL of Gitlab Pages.
Expand Down Expand Up @@ -144,6 +145,7 @@
Enum['absent', 'present'] $pgpass_file_ensure = 'absent',
Stdlib::Absolutepath $pgpass_file_location = '/home/gitlab-consul/.pgpass',
Optional[Hash] $postgres_exporter = undef,
Optional[Hash] $pgbouncer_exporter = undef,
Optional[Hash] $gitlab_monitor = undef,
Optional[Hash] $gitlab_exporter = undef,
Optional[String] $package_name = undef,
Expand Down
2 changes: 1 addition & 1 deletion manifests/omnibus_config.pp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
# @summary This class is used to configure the gitlab omnibus package on a node
#
# @param config_manage Should Puppet manage the config?
# @param config_file Path of the Gitlab Omnibus config file.
Expand Down Expand Up @@ -40,6 +39,7 @@
$node_exporter = $gitlab::node_exporter
$redis_exporter = $gitlab::redis_exporter
$postgres_exporter = $gitlab::postgres_exporter
$pgbouncer_exporter = $gitlab::pgbouncer_exporter
$gitlab_monitor = $gitlab::gitlab_monitor
$gitlab_exporter = $gitlab::gitlab_exporter
$pages_external_url = $gitlab::pages_external_url
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/init_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -420,6 +420,18 @@
with_content(%r{^\s*puma\['worker_timeout'\] = 60$})
}
end
describe 'pgbouncer_exporter' do
let(:params) do
{ pgbouncer_exporter: {
'enable' => true
} }
end

it {
is_expected.to contain_file('/etc/gitlab/gitlab.rb'). \
with_content(%r{^\s*pgbouncer_exporter\['enable'\] = true$})
}
end
end
end
end
Expand Down
9 changes: 9 additions & 0 deletions templates/gitlab.rb.erb
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,15 @@ redis_exporter['<%= k -%>'] = <%= decorate(@redis_exporter[k]) %>
<%- @postgres_exporter.keys.sort.each do |k| -%>
postgres_exporter['<%= k -%>'] = <%= decorate(@postgres_exporter[k]) %>
<%- end end -%>
<%- if @pgbouncer_exporter -%>

################################################################################
## Prometheus PgBouncer exporter (EE only)
##! Docs: https://docs.gitlab.com/ee/administration/monitoring/prometheus/pgbouncer_exporter.html

<%- @pgbouncer_exporter.keys.sort.each do |k| -%>
pgbouncer_exporter['<%= k -%>'] = <%= decorate(@pgbouncer_exporter[k]) %>
<%- end end -%>
<%- if @alertmanager -%>

################################################################################
Expand Down

0 comments on commit f111e5e

Please sign in to comment.