Skip to content

Commit 18f7282

Browse files
authored
Merge pull request #481 from DataDog/alexfouche/improvements
multiple improvements (by @alexfouche)
2 parents 842a03d + dee3469 commit 18f7282

142 files changed

Lines changed: 671 additions & 283 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Gemfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
source "https://rubygems.org"
22

33
group :test do
4+
gem "rb-inotify", '< 0.10.0' if RUBY_VERSION < '2.2.0'
45
gem "public_suffix", "~> 3.0.0"
56
gem "listen", "~> 3.0.0"
67
gem "puppet", ENV['PUPPET_VERSION'] || '~> 4.2.0'

manifests/init.pp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,15 @@
1111
# set to 'datadoghq.eu' to send data to the EU site.
1212
# This option is only available with agent version >= 6.6.0.
1313
# $host:
14+
# Force the hostname to whatever you want. (default: auto-detected)
1415
# $api_key:
1516
# Your DataDog API Key. Please replace with your key value.
1617
# $collect_ec2_tags
1718
# Collect AWS EC2 custom tags as agent tags.
1819
# Boolean. Default: false
20+
# $collect_gce_tags
21+
# Collect Google Cloud Engine metadata as agent tags.
22+
# Boolean. Default: false
1923
# $collect_instance_metadata
2024
# The Agent will try to collect instance metadata for EC2 and GCE instances.
2125
# Boolean. Default: true
@@ -45,6 +49,12 @@
4549
# Instead of reporting the puppet nodename, use this regex to extract the named
4650
# 'hostname' captured group to report the run in Datadog.
4751
# ex.: '^(?<hostname>.*\.datadoghq\.com)(\.i-\w{8}\..*)?$'
52+
# $hostname_fqdn
53+
# Make the agent use "hostname -f" on unix-based systems as a last resort
54+
# way of determining the hostname instead of Golang "os.Hostname()"
55+
# This will be enabled by default in version 6.6
56+
# More information at https://dtdg.co/flag-hostname-fqdn
57+
# Optional: Valid values here are: true or false.
4858
# $log_to_syslog
4959
# Set value of 'log_to_syslog' variable. Default is true -> yes as in dd-agent.
5060
# Valid values here are: true or false.
@@ -212,6 +222,7 @@
212222
$host = '',
213223
$api_key = 'your_API_key',
214224
$collect_ec2_tags = false,
225+
$collect_gce_tags = false,
215226
$collect_instance_metadata = true,
216227
$tags = [],
217228
$integrations = {},
@@ -228,6 +239,7 @@
228239
$service_enable = true,
229240
$manage_repo = true,
230241
$hostname_extraction_regex = nil,
242+
$hostname_fqdn = false,
231243
$dogstatsd_port = 8125,
232244
$dogstatsd_socket = '',
233245
$statsd_forward_host = '',
@@ -315,6 +327,7 @@
315327
validate_legacy(String, 'validate_string', $dd_url)
316328
validate_legacy(String, 'validate_string', $datadog_site)
317329
validate_legacy(String, 'validate_string', $host)
330+
validate_legacy(Boolean, 'validate_bool', $hostname_fqdn)
318331
validate_legacy(String, 'validate_string', $api_key)
319332
validate_legacy(Array, 'validate_array', $tags)
320333
validate_legacy(Boolean, 'validate_bool', $hiera_tags)
@@ -341,6 +354,7 @@
341354
validate_legacy(Boolean, 'validate_bool', $skip_apt_key_trusting)
342355
validate_legacy(Boolean, 'validate_bool', $use_curl_http_client)
343356
validate_legacy(Boolean, 'validate_bool', $collect_ec2_tags)
357+
validate_legacy(Boolean, 'validate_bool', $collect_gce_tags)
344358
validate_legacy(Boolean, 'validate_bool', $collect_instance_metadata)
345359
validate_legacy(String, 'validate_string', $recent_point_threshold)
346360
validate_legacy(String, 'validate_re', $_listen_port, '^\d*$')
@@ -636,7 +650,9 @@
636650
'dd_url' => $dd_url,
637651
'site' => $datadog_site,
638652
'cmd_port' => $cmd_port,
653+
'hostname_fqdn' => $hostname_fqdn,
639654
'collect_ec2_tags' => $collect_ec2_tags,
655+
'collect_gce_tags' => $collect_gce_tags,
640656
'conf_path' => $datadog_agent::params::conf6_dir,
641657
'enable_metadata_collection' => $collect_instance_metadata,
642658
'dogstatsd_port' => $dogstatsd_port,

manifests/integrations/apache.pp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,14 @@
3939
validate_legacy('Array', 'validate_array', $tags)
4040
validate_legacy('Boolean', 'validate_bool', $disable_ssl_validation)
4141

42+
$legacy_dst = "${datadog_agent::conf_dir}/apache.yaml"
4243
if !$::datadog_agent::agent5_enable {
43-
$dst = "${datadog_agent::conf6_dir}/apache.yaml"
44+
$dst = "${datadog_agent::conf6_dir}/apache.d/conf.yaml"
45+
file { $legacy_dst:
46+
ensure => 'absent'
47+
}
4448
} else {
45-
$dst = "${datadog_agent::conf_dir}/apache.yaml"
49+
$dst = $legacy_dst
4650
}
4751

4852
file { $dst:

manifests/integrations/cacti.pp

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
# $host:
77
# The host cacti MySQL db is running on
88
# $user
9-
# The cacti MySQL password
9+
# The cacti MySQL password
1010
# $password
1111
# The cacti MySQL sb port.
1212
# $path
@@ -20,10 +20,14 @@
2020
) inherits datadog_agent::params {
2121
include datadog_agent
2222

23+
$legacy_dst = "${datadog_agent::conf_dir}/cacti.yaml"
2324
if !$::datadog_agent::agent5_enable {
24-
$dst = "${datadog_agent::conf6_dir}/cacti.yaml"
25+
$dst = "${datadog_agent::conf6_dir}/cacti.d/conf.yaml"
26+
file { $legacy_dst:
27+
ensure => 'absent'
28+
}
2529
} else {
26-
$dst = "${datadog_agent::conf_dir}/cacti.yaml"
30+
$dst = $legacy_dst
2731
}
2832

2933
file { $dst:

manifests/integrations/cassandra.pp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,15 @@
3636

3737
validate_legacy(Optional[Hash], 'validate_hash', $tags)
3838

39+
$legacy_dst = "${datadog_agent::conf_dir}/cassandra.yaml"
3940
if !$::datadog_agent::agent5_enable {
40-
$dst = "${datadog_agent::conf6_dir}/cassandra.yaml"
41+
$dst = "${datadog_agent::conf6_dir}/cassandra.d/conf.yaml"
42+
43+
file { $legacy_dst:
44+
ensure => 'absent'
45+
}
4146
} else {
42-
$dst = "${datadog_agent::conf_dir}/cassandra.yaml"
47+
$dst = $legacy_dst
4348
}
4449

4550
file { $dst:

manifests/integrations/ceph.pp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,14 @@
2626
content => "# This file is required for dd ceph \ndd-agent ALL=(ALL) NOPASSWD:/usr/bin/ceph\n"
2727
}
2828

29+
$legacy_dst = "${datadog_agent::conf_dir}/ceph.yaml"
2930
if !$::datadog_agent::agent5_enable {
30-
$dst = "${datadog_agent::conf6_dir}/ceph.yaml"
31+
$dst = "${datadog_agent::conf6_dir}/ceph.d/conf.yaml"
32+
file { $legacy_dst:
33+
ensure => 'absent'
34+
}
3135
} else {
32-
$dst = "${datadog_agent::conf_dir}/ceph.yaml"
36+
$dst = $legacy_dst
3337
}
3438

3539
file { $dst:

manifests/integrations/consul.pp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,14 @@
4040
validate_legacy('Boolean', 'validate_bool', $new_leader_checks)
4141
validate_legacy('Optional[Array]', 'validate_array', $service_whitelist)
4242

43+
$legacy_dst = "${datadog_agent::conf_dir}/consul.yaml"
4344
if !$::datadog_agent::agent5_enable {
44-
$dst = "${datadog_agent::conf6_dir}/consul.yaml"
45+
$dst = "${datadog_agent::conf6_dir}/consul.d/conf.yaml"
46+
file { $legacy_dst:
47+
ensure => 'absent'
48+
}
4549
} else {
46-
$dst = "${datadog_agent::conf_dir}/consul.yaml"
50+
$dst = $legacy_dst
4751
}
4852

4953
file { $dst:

manifests/integrations/directory.pp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,14 @@
9393
$_instances = $instances
9494
}
9595

96+
$legacy_dst = "${datadog_agent::conf_dir}/directory.yaml"
9697
if !$::datadog_agent::agent5_enable {
97-
$dst = "${datadog_agent::conf6_dir}/directory.yaml"
98+
$dst = "${datadog_agent::conf6_dir}/directory.d/conf.yaml"
99+
file { $legacy_dst:
100+
ensure => 'absent'
101+
}
98102
} else {
99-
$dst = "${datadog_agent::conf_dir}/directory.yaml"
103+
$dst = $legacy_dst
100104
}
101105

102106
file { $dst:

manifests/integrations/disk.pp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,14 @@
4848
fail('error during compilation')
4949
}
5050

51+
$legacy_dst = "${datadog_agent::conf_dir}/disk.yaml"
5152
if !$::datadog_agent::agent5_enable {
52-
$dst = "${datadog_agent::conf6_dir}/disk.yaml"
53+
$dst = "${datadog_agent::conf6_dir}/disk.d/conf.yaml"
54+
file { $legacy_dst:
55+
ensure => 'absent'
56+
}
5357
} else {
54-
$dst = "${datadog_agent::conf_dir}/disk.yaml"
58+
$dst = $legacy_dst
5559
}
5660

5761
file { $dst:

manifests/integrations/dns_check.pp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,14 @@
3737

3838
validate_legacy('Array', 'validate_array', $checks)
3939

40+
$legacy_dst = "${datadog_agent::conf_dir}/dns_check.yaml"
4041
if !$::datadog_agent::agent5_enable {
41-
$dst = "${datadog_agent::conf6_dir}/dns_check.yaml"
42+
$dst = "${datadog_agent::conf6_dir}/dns_check.d/conf.yaml"
43+
file { $legacy_dst:
44+
ensure => 'absent'
45+
}
4246
} else {
43-
$dst = "${datadog_agent::conf_dir}/dns_check.yaml"
47+
$dst = $legacy_dst
4448
}
4549

4650
file { $dst:

0 commit comments

Comments
 (0)