Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add manifest for the pgbouncer integration #175

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions manifests/integrations/pgbouncer.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Class: datadog_agent::integrations::pgbouncer
#
# This class will install the necessary configuration for the pgbouncer integration
#
# Parameters:
# $host:
# The host pgbouncer is listening on
# $port
# The pgbouncer port number
# $username
# The username for the datadog user
# $password
# The password for the datadog user
# $tags
# Optional array of tags
#
# Sample Usage:
#
# class { 'datadog_agent::integrations::pgbouncer' :
# host => 'localhost',
# username => 'datadog',
# port => '6432',
# password => 'some_pass',
# }
#
#
class datadog_agent::integrations::pgbouncer(
$host = 'localhost',
$port = '6432',
$username = 'datadog',
$password,
$tags = [],
) inherits datadog_agent::params {

validate_array($tags)

file { "${datadog_agent::params::conf_dir}/pgbouncer.yaml":
ensure => file,
owner => $datadog_agent::params::dd_user,
group => $datadog_agent::params::dd_group,
mode => '0600',
content => template('datadog_agent/agent-conf.d/pgbouncer.yaml.erb'),
require => Package[$datadog_agent::params::package_name],
notify => Service[$datadog_agent::params::service_name],
}
}
23 changes: 23 additions & 0 deletions templates/agent-conf.d/pgbouncer.yaml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
init_config:

instances:
# - host: localhost
# port: 6432
# username: my_username
# password: my_password
# tags:
# - optional_tag1
# - optional_tag2
#
- host: <%= @host %>
port: <%= @port %>
username: <%= @username %>
password: <%= @password %>
<% if @tags and ! @tags.empty? -%>
tags:
<%- Array(@tags).each do |tag| -%>
<%- if tag != '' -%>
- <%= tag %>
<%- end -%>
<%- end -%>
<% end -%>