Skip to content
Merged
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
39 changes: 38 additions & 1 deletion manifests/integrations/mongo.pp
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
#
# This class will install the necessary configuration for the mongo integration
#
# NOTE: In newer versions of the Datadog Agent, the ssl parameters will be deprecated in favor the tls variants
#
# Parameters:
# $additional_metrics
# Optional array of additional metrics
Expand All @@ -23,12 +25,20 @@
# Optionally specify path to SSL certificate for connection
# $ssl_keyfile
# Optionally specify path to SSL private key for connection
# $tls
# Optionally enable TLS for connection
# $tls_ca_file
# Optionally specify path to SSL/TLS Certificate Authority certificates
# $tls_allow_invalid_certificates
# Optionally require SSL/TLS client certificate for connection
# $tls_certificate_key_file
# Optionally specify path to combined SSL/TLS key and certificate for connection
# $tags
# Optional array of tags
# $username
# Optionally specify username for connection
#
# Sample Usage:
# Sample Usage (Older Agent Versions):
#
# class { 'datadog_agent::integrations::mongo' :
# servers => [
Expand Down Expand Up @@ -56,6 +66,33 @@
# ]
# }
#
# Sample Usage (Newer Agent Versions):
#
# class { 'datadog_agent::integrations::mongo' :
# servers => [
# {
# 'additional_metrics' => ['top'],
# 'database' => 'database_name',
# 'host' => 'localhost',
# 'password' => 'mongo_password',
# 'port' => '27017',
# 'tls' => true,
# 'tls_ca_file' => '/path/to/ca.pem',
# 'tls_allow_invalid_certificates' => false,
# 'tls_certificate_key_file' => '/path/to/combined.pem',
# 'tags' => ['optional_tag1', 'optional_tag2'],
# 'username' => 'mongo_username',
# },
# {
# 'host' => 'localhost',
# 'port' => '27018',
# 'tags' => [],
# 'additional_metrics' => [],
# 'collections' => [],
# },
# ]
# }
#
class datadog_agent::integrations::mongo(
Array $servers = [{'host' => 'localhost', 'port' => '27017'}]
) inherits datadog_agent::params {
Expand Down
12 changes: 12 additions & 0 deletions templates/agent-conf.d/mongo.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,18 @@ instances:
ssl_ca_certs: <%= server['ssl_ca_certs'] %>
<%- end -%>
<%- end -%>
<%- if !server['tls'].nil? -%>
tls: <%= server['tls'] %>
<%- if !server['tls_certificate_key_file'].nil? -%>
tls_certificate_key_file: <%= server['tls_certificate_key_file'] %>
<%- end -%>
<%- if !server['tls_allow_invalid_certificates'].nil? -%>
tls_allow_invalid_certificates: <%= server['tls_allow_invalid_certificates'] %>
<%- end -%>
<%- if !server['tls_ca_file'].nil? -%>
tls_ca_file: <%= server['tls_ca_file'] %>
<%- end -%>
<%- end -%>
<%- if !server['additional_metrics'].nil? && server['additional_metrics'].any? -%>
additional_metrics:
<%- server['additional_metrics'].each do |additional_metric| -%>
Expand Down