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
2 changes: 2 additions & 0 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@
$sd_backend_host = '',
$sd_backend_port = 0,
$sd_template_dir = '',
$sd_jmx_enable = false,
$consul_token = '',
$conf_dir = $datadog_agent::params::conf_dir,
$service_name = $datadog_agent::params::service_name,
Expand Down Expand Up @@ -299,6 +300,7 @@
validate_string($sd_backend_host)
validate_integer($sd_backend_port)
validate_string($sd_template_dir)
validate_bool($sd_jmx_enable)
validate_string($consul_token)

if $hiera_tags {
Expand Down
7 changes: 7 additions & 0 deletions spec/classes/datadog_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,9 @@
it { should contain_file('/etc/dd-agent/datadog.conf').without(
'content' => /^consul_token:\n/,
)}
it { should contain_file('/etc/dd-agent/datadog.conf').with(
'content' => /^# sd_jmx_enable: no\n/,
)}
end
end

Expand Down Expand Up @@ -503,6 +506,7 @@
:sd_config_backend => 'etcd',
:sd_backend_host => 'localhost',
:sd_backend_port => '8080',
:sd_jmx_enable => true,
}}
it { should contain_file('/etc/dd-agent/datadog.conf').with(
'content' => /^service_discovery_backend: docker\n/,
Expand All @@ -516,6 +520,9 @@
it { should contain_file('/etc/dd-agent/datadog.conf').with(
'content' => /^sd_backend_port: 8080\n/,
)}
it { should contain_file('/etc/dd-agent/datadog.conf').with(
'content' => /^sd_jmx_enable: true\n/,
)}
end
end
end
Expand Down
7 changes: 7 additions & 0 deletions templates/datadog.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,13 @@ sd_backend_port: <%= @sd_backend_port %>
sd_template_dir: <%= @sd_template_dir %>
<% end -%>

# Enable JMX checks for service discovery
<% if @sd_jmx_enable -%>
sd_jmx_enable: <%= @sd_jmx_enable %>
<% else -%>
# sd_jmx_enable: no
<% end -%>

# If you Consul store requires token authentication for service discovery, you can define that token here.
<% if @consul_token.empty? -%>
# consul_token: f45cbd0b-5022-samp-le00-4eaa7c1f40f1
Expand Down