Skip to content

Commit 6bf71ad

Browse files
com6056truthbk
authored andcommitted
Add SSL parameter for PostgreSQL checks (DataDog#391)
* add ssl parameter for postgres check * properly insert ssl value if enabled
1 parent 347f6aa commit 6bf71ad

2 files changed

Lines changed: 9 additions & 0 deletions

File tree

manifests/integrations/postgres.pp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
# The postgres port number
1414
# $username
1515
# The username for the datadog user
16+
# $ssl
17+
# Boolean to enable SSL
1618
# $use_psycopg2
1719
# Boolean to flag connecting to postgres with psycopg2 instead of pg8000.
1820
# Warning, psycopg2 doesn't support ssl mode.
@@ -36,6 +38,7 @@
3638
# dbname => 'postgres'
3739
# username => 'datadog',
3840
# password => 'some_pass',
41+
# ssl => false,
3942
# custom_metrics => {
4043
# a_custom_query => {
4144
# query => "select tag_column, %s from table",
@@ -57,6 +60,7 @@
5760
$dbname = 'postgres',
5861
$port = '5432',
5962
$username = 'datadog',
63+
$ssl = false,
6064
$use_psycopg2 = false,
6165
$tags = [],
6266
$tables = [],
@@ -82,6 +86,7 @@
8286
'dbname' => $dbname,
8387
'port' => $port,
8488
'username' => $username,
89+
'ssl' => $ssl,
8590
'use_psycopg2' => $use_psycopg2,
8691
'tags' => $tags,
8792
'tables' => $tables,

templates/agent-conf.d/postgres.yaml.erb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ instances:
66
# username: my_username
77
# password: my_password
88
# dbname: db_name
9+
# ssl: false
910
# use_psycopg2: false # Force using psycogp2 instead of pg8000 to connect. WARNING: psycopg2 doesn't support ssl mode.
1011
# tags:
1112
# - optional_tag1
@@ -17,6 +18,9 @@ instances:
1718
username: <%= instance['username'] %>
1819
password: <%= instance['password'] %>
1920
dbname: <%= instance['dbname'] %>
21+
<% if instance['ssl'] == true -%>
22+
ssl: true
23+
<% end -%>
2024
<% if instance['use_psycopg2'] == true -%>
2125
use_psycopg2: true
2226
<% end -%>

0 commit comments

Comments
 (0)