Skip to content
Merged
Show file tree
Hide file tree
Changes from 32 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
0f19c83
Make a generic define for creating modules
cwood Nov 8, 2015
73f47e0
Remove unused template
cwood Nov 8, 2015
3694280
Add support for init_config if passed
cwood Nov 8, 2015
f422ecf
Update to remove the empty string.
cwood Dec 7, 2015
bab5718
Adding logic to handle tags as arrays.
Mar 14, 2016
e01e625
Allow support for integrations from hiera
cwood Mar 24, 2016
1135e1f
Fix some typos
cwood Mar 24, 2016
d34226c
Add check_freq setting
May 18, 2016
3a8e7fa
Allow the ability to purge unsued configs
cwood May 18, 2016
03cf793
Notify the service
cwood May 18, 2016
4cdcd3a
Setup a spec test
cwood May 18, 2016
a45cb97
Set recurse to true
cwood May 18, 2016
90f4927
Set force to true if purge is true
cwood Jul 14, 2016
12972ef
Allow tags to be there own define.
cwood Jul 21, 2016
3b66ddb
Fix name
cwood Jul 21, 2016
7ea03ff
Allow looking up facts to tags
cwood Jul 21, 2016
f01c2d2
Fix unless issue
cwood Jul 21, 2016
31aadd3
If a array call itself and add the fragment
cwood Jul 21, 2016
f67f196
Check if is_array
cwood Jul 21, 2016
830d4bf
Remove map and use map()
cwood Jul 21, 2016
efcbd47
Migrate tags to its own array
cwood Jul 21, 2016
a9a3575
Prefix everything with the tag
cwood Jul 21, 2016
7b3926e
Make tags its own thing
cwood Jul 21, 2016
9366747
Only run if not a tag
cwood Jul 21, 2016
db3c5a6
Add a begining new line
cwood Jul 21, 2016
af0c0bd
Only add if we have a value
cwood Jul 21, 2016
536d17b
[service_discovery][dogstatsd] adding relevant SD and dogstatsd to th…
truthbk Mar 21, 2017
7af675a
[apm] adding apm tests.
truthbk Mar 21, 2017
29d0847
[datadog-agent][spec] check fragment contents instead.
truthbk Mar 21, 2017
32aa16d
[spec] fix ports as integers for new concat templates.
truthbk Mar 23, 2017
53f60df
[templates] removing global template, we now use concat templates.
truthbk Mar 23, 2017
1a18f19
[main] dogstatsd should also allow string and integer ports - like ot…
truthbk Mar 23, 2017
20ea5eb
[init] remove check_freq, undocumented.
truthbk Mar 23, 2017
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
1 change: 1 addition & 0 deletions .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ fixtures:
stdlib:
repo: "git://github.com/puppetlabs/puppetlabs-stdlib.git"
ref: "4.12.0"
concat: "git://github.com/puppetlabs/puppetlabs-concat.git"
ruby: "git://github.com/puppetlabs/puppetlabs-ruby.git"
remote_file: "git://github.com/lwf/puppet-remote_file.git"
symlinks:
Expand Down
70 changes: 57 additions & 13 deletions manifests/init.pp
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@
# $statsd_forward_port
# Set the value of the statsd_forward_port varable. Used to forward all
# statsd metrics to another host.
# $check_freq
# Sets how often checks should be run. By default, set to 15s
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While this is valid, we don't recommend changing the check_freq. I think we should remove this parameter.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will break us if we dont have that. If its exposed by the dd-agent and documented why cant it be set by the module?

# $manage_repo
# Boolean to indicate whether this module should attempt to manage
# the package repo. Default true.
Expand Down Expand Up @@ -183,6 +185,8 @@
$collect_ec2_tags = false,
$collect_instance_metadata = true,
$tags = [],
$integrations = {},
$hiera_integrations = false,
$hiera_tags = false,
$facts_to_tags = [],
$puppet_run_reports = false,
Expand All @@ -200,6 +204,7 @@
$statsd_forward_host = '',
$statsd_forward_port = '',
$statsd_histogram_percentiles = '0.95',
$check_freq = '',
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above

$proxy_host = '',
$proxy_port = '',
$proxy_user = '',
Expand Down Expand Up @@ -239,6 +244,7 @@
$sd_jmx_enable = false,
$consul_token = '',
$conf_dir = $datadog_agent::params::conf_dir,
$conf_dir_purge = $datadog_agent::params::conf_dir_purge,
$service_name = $datadog_agent::params::service_name,
$package_name = $datadog_agent::params::package_name,
$dd_user = $datadog_agent::params::dd_user,
Expand All @@ -249,6 +255,7 @@

# Allow ports to be passed as integers or strings.
# lint:ignore:only_variable_string
$_dogstatsd_port = "${dogstatsd_port}"
$_statsd_forward_port = "${statsd_forward_port}"
$_proxy_port = "${proxy_port}"
$_graphite_listen_port = "${graphite_listen_port}"
Expand All @@ -271,9 +278,10 @@
validate_bool($log_to_syslog)
validate_bool($manage_repo)
validate_string($log_level)
validate_integer($dogstatsd_port)
validate_re($_dogstatsd_port, '^\d*$')
validate_string($statsd_histogram_percentiles)
validate_re($_statsd_forward_port, '^\d*$')
validate_string($check_freq)
validate_string($proxy_host)
validate_re($_proxy_port, '^\d*$')
validate_string($proxy_user)
Expand Down Expand Up @@ -324,6 +332,17 @@
$local_tags = $tags
}

if $hiera_integrations {
$local_integrations = hiera_hash('datadog_agent::integrations')
} else {
$local_integrations = $integrations
}

datadog_agent::tag{$local_tags: }
datadog_agent::tag{$facts_to_tags:
lookup_fact => true,
}

include datadog_agent::params
case upcase($log_level) {
'CRITICAL': { $_loglevel = 'CRITICAL' }
Expand Down Expand Up @@ -354,26 +373,49 @@
require => Package['datadog-agent'],
}

# main agent config file
# content
if ($extra_template != '') {
$agent_conf_content = template(
'datadog_agent/datadog.conf.erb',
$extra_template
)
} else {
$agent_conf_content = template('datadog_agent/datadog.conf.erb')
file { $conf_dir:
ensure => directory,
purge => $conf_dir_purge,
recurse => true,
force => $conf_dir_purge,
owner => $dd_user,
group => $dd_group,
notify => Service['datadog-agent']
}
file { '/etc/dd-agent/datadog.conf':
ensure => file,
content => $agent_conf_content,

concat {'/etc/dd-agent/datadog.conf':
owner => $datadog_agent::params::dd_user,
group => $datadog_agent::params::dd_group,
mode => '0640',
notify => Service[$datadog_agent::params::service_name],
require => File['/etc/dd-agent'],
}

concat::fragment{ 'datadog header':
target => '/etc/dd-agent/datadog.conf',
content => template('datadog_agent/datadog_header.conf.erb'),
order => '01',
}

concat::fragment{ 'datadog tags':
target => '/etc/dd-agent/datadog.conf',
content => 'tags: ',
order => '02',
}

concat::fragment{ 'datadog footer':
target => '/etc/dd-agent/datadog.conf',
content => template('datadog_agent/datadog_footer.conf.erb'),
order => '05',
}

concat::fragment{ 'datadog apm footer':
target => '/etc/dd-agent/datadog.conf',
content => template('datadog_agent/datadog_apm_footer.conf.erb'),
order => '06',
}


if $puppet_run_reports {
class { 'datadog_agent::reports':
api_key => $api_key,
Expand All @@ -383,4 +425,6 @@
hostname_extraction_regex => $hostname_extraction_regex,
}
}

create_resources('datadog_agent::integration', $local_integrations)
}
1 change: 1 addition & 0 deletions manifests/params.pp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
$package_name = 'datadog-agent'
$service_name = 'datadog-agent'
$dogapi_version = 'installed'
$conf_dir_purge = false

case $::operatingsystem {
'Ubuntu','Debian' : {
Expand Down
30 changes: 30 additions & 0 deletions manifests/tag.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# Allow custom tags via a define
define datadog_agent::tag(
$tag = $name,
$lookup_fact = false,
){

if $lookup_fact{
$value = getvar($tag)

if is_array($value){
$tags = prefix($value, "${tag}:")
datadog_agent::tag{$tags: }
} else {
if $value {
concat::fragment{ "datadog tag ${tag}:${value}":
target => '/etc/dd-agent/datadog.conf',
content => "${tag}:${value}, ",
order => '03',
}
}
}
} else {
concat::fragment{ "datadog tag ${tag}":
target => '/etc/dd-agent/datadog.conf',
content => "${tag}, ",
order => '03',
}
}

}
Loading