-
Notifications
You must be signed in to change notification settings - Fork 259
Make tags there own resourced, allow hiera created integrations, setup check_feq #261
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
Merged
Merged
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 73f47e0
Remove unused template
cwood 3694280
Add support for init_config if passed
cwood f422ecf
Update to remove the empty string.
cwood bab5718
Adding logic to handle tags as arrays.
e01e625
Allow support for integrations from hiera
cwood 1135e1f
Fix some typos
cwood d34226c
Add check_freq setting
3a8e7fa
Allow the ability to purge unsued configs
cwood 03cf793
Notify the service
cwood 4cdcd3a
Setup a spec test
cwood a45cb97
Set recurse to true
cwood 90f4927
Set force to true if purge is true
cwood 12972ef
Allow tags to be there own define.
cwood 3b66ddb
Fix name
cwood 7ea03ff
Allow looking up facts to tags
cwood f01c2d2
Fix unless issue
cwood 31aadd3
If a array call itself and add the fragment
cwood f67f196
Check if is_array
cwood 830d4bf
Remove map and use map()
cwood efcbd47
Migrate tags to its own array
cwood a9a3575
Prefix everything with the tag
cwood 7b3926e
Make tags its own thing
cwood 9366747
Only run if not a tag
cwood db3c5a6
Add a begining new line
cwood af0c0bd
Only add if we have a value
cwood 536d17b
[service_discovery][dogstatsd] adding relevant SD and dogstatsd to th…
truthbk 7af675a
[apm] adding apm tests.
truthbk 29d0847
[datadog-agent][spec] check fragment contents instead.
truthbk 32aa16d
[spec] fix ports as integers for new concat templates.
truthbk 53f60df
[templates] removing global template, we now use concat templates.
truthbk 1a18f19
[main] dogstatsd should also allow string and integer ports - like ot…
truthbk 20ea5eb
[init] remove check_freq, undocumented.
truthbk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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 | ||
| # $manage_repo | ||
| # Boolean to indicate whether this module should attempt to manage | ||
| # the package repo. Default true. | ||
|
|
@@ -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, | ||
|
|
@@ -200,6 +204,7 @@ | |
| $statsd_forward_host = '', | ||
| $statsd_forward_port = '', | ||
| $statsd_histogram_percentiles = '0.95', | ||
| $check_freq = '', | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See above |
||
| $proxy_host = '', | ||
| $proxy_port = '', | ||
| $proxy_user = '', | ||
|
|
@@ -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, | ||
|
|
@@ -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}" | ||
|
|
@@ -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) | ||
|
|
@@ -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' } | ||
|
|
@@ -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, | ||
|
|
@@ -383,4 +425,6 @@ | |
| hostname_extraction_regex => $hostname_extraction_regex, | ||
| } | ||
| } | ||
|
|
||
| create_resources('datadog_agent::integration', $local_integrations) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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', | ||
| } | ||
| } | ||
|
|
||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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.There was a problem hiding this comment.
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?