|
69 | 69 | # $log_to_syslog |
70 | 70 | # Set value of 'log_to_syslog' variable. Default is true -> yes as in dd-agent. |
71 | 71 | # Valid values here are: true or false. |
72 | | -# $dogstatsd_port |
73 | | -# Set value of the 'dogstatsd_port' variable. Defaultis 8125. |
74 | 72 | # $report_fact_tags |
75 | 73 | # Sets tags for report events sent to Datadog from specified facts |
76 | 74 | # $report_trusted_fact_tags |
77 | 75 | # Sets tags for report events sent to Datadog from specified trusted facts |
78 | 76 | # $statsd_forward_host |
79 | 77 | # Set the value of the statsd_forward_host varable. Used to forward all |
80 | 78 | # statsd metrics to another host. |
81 | | -# $statsd_forward_port |
82 | | -# Set the value of the statsd_forward_port varable. Used to forward all |
83 | | -# statsd metrics to another host. |
84 | 79 | # $manage_repo |
85 | 80 | # Deprecated. Only works for RPM. Install datadog-agent manually and then set |
86 | 81 | # manage_install=false to achieve the same behaviour as setting this to false. |
|
131 | 126 | # String. Default: empty |
132 | 127 | # $dogstatsd_port |
133 | 128 | # Specifies the port to be used by dogstatsd. Must have use_dogstatsd set |
134 | | -# String. Default: empty |
| 129 | +# String. Default: 8125 |
135 | 130 | # $dogstatsd_target |
136 | 131 | # Change the target to be used by dogstatsd. Must have use_dogstatsd set |
137 | 132 | # set |
|
146 | 141 | # Enables forwarding of statsd packetsto host. Must have use_dogstatsd set |
147 | 142 | # String. Default: empty |
148 | 143 | # $statsd_forward_port |
149 | | -# Specifis port for $statsd_forward_host. Must have use_dogstatsd set |
150 | | -# String. Default: empty |
| 144 | +# Specifies port for $statsd_forward_host. Must have use_dogstatsd set String. |
| 145 | +# Used to forward all statsd metrics to another host. |
| 146 | +# Default: empty |
151 | 147 | # $device_blacklist_re |
152 | 148 | # Specifies pattern for device blacklisting. |
153 | 149 | # String. Default: empty |
|
238 | 234 | # To use NPM features it is necessary to enable install through this flag, as well as |
239 | 235 | # configuring NPM through the datadog::system_probe class. |
240 | 236 | # Boolean. Default: false |
| 237 | +# $windows_ddagentuser_name |
| 238 | +# (Windows only) The name of Windows user to use, in the format `<domain>\<user>`. |
| 239 | +# |
| 240 | +# $windows_ddagentuser_password |
| 241 | +# (Windows only) The password used to register the service`. |
241 | 242 | # |
242 | 243 | # Sample Usage: |
243 | 244 | # |
|
283 | 284 | Boolean $manage_install = true, |
284 | 285 | $hostname_extraction_regex = undef, |
285 | 286 | Boolean $hostname_fqdn = false, |
286 | | - $dogstatsd_port = 8125, |
| 287 | + Variant[Stdlib::Port, Pattern[/^\d*$/]] $dogstatsd_port = 8125, |
287 | 288 | $dogstatsd_socket = '', |
288 | 289 | Array $report_fact_tags = [], |
289 | 290 | Array $report_trusted_fact_tags = [], |
290 | 291 | String $statsd_forward_host = '', |
291 | | - $statsd_forward_port = '', |
| 292 | + Variant[Stdlib::Port, Pattern[/^\d*$/]] $statsd_forward_port = '', |
292 | 293 | String $statsd_histogram_percentiles = '0.95', |
293 | 294 | Optional[String] $proxy_host = undef, |
294 | 295 | Optional[Variant[Integer, Pattern[/^\d*$/]]] $proxy_port = undef, |
295 | 296 | Optional[String] $proxy_user = undef, |
296 | 297 | Optional[String] $proxy_password = undef, |
297 | | - $graphite_listen_port = '', |
| 298 | + Variant[Stdlib::Port, Pattern[/^\d*$/]] $graphite_listen_port = '', |
298 | 299 | String $extra_template = '', |
299 | 300 | String $ganglia_host = '', |
300 | 301 | $ganglia_port = 8651, |
301 | 302 | Boolean $skip_ssl_validation = false, |
302 | 303 | Boolean $skip_apt_key_trusting = false, |
303 | 304 | Boolean $use_curl_http_client = false, |
304 | 305 | String $recent_point_threshold = '', |
305 | | - $listen_port = '', |
| 306 | + Variant[Stdlib::Port, Pattern[/^\d*$/]] $listen_port = '', |
306 | 307 | Optional[String] $additional_checksd = undef, |
307 | 308 | String $bind_host = '', |
308 | 309 | Boolean $use_pup = false, |
309 | | - $pup_port = '', |
| 310 | + Variant[Stdlib::Port, Pattern[/^\d*$/]] $pup_port = '', |
310 | 311 | String $pup_interface = '', |
311 | 312 | String $pup_url = '', |
312 | 313 | Boolean $use_dogstatsd = true, |
|
321 | 322 | String $dogstatsd_log_file = '', |
322 | 323 | String $pup_log_file = '', |
323 | 324 | String $syslog_host = '', |
324 | | - $syslog_port = '', |
| 325 | + Variant[Stdlib::Port, Pattern[/^\d*$/]] $syslog_port = '', |
325 | 326 | String $service_discovery_backend = '', |
326 | 327 | String $sd_config_backend = '', |
327 | 328 | String $sd_backend_host = '', |
|
333 | 334 | Optional[Integer] $agent_major_version = undef, |
334 | 335 | Optional[String] $conf_dir = undef, |
335 | 336 | Boolean $conf_dir_purge = $datadog_agent::params::conf_dir_purge, |
336 | | - $dd_user = $datadog_agent::params::dd_user, |
337 | 337 | $dd_group = $datadog_agent::params::dd_group, |
338 | 338 | $dd_groups = $datadog_agent::params::dd_groups, |
339 | 339 | Boolean $apm_enabled = $datadog_agent::params::apm_default_enabled, |
|
361 | 361 | Optional[String] $service_provider = undef, |
362 | 362 | Optional[String] $agent_version = $datadog_agent::params::agent_version, |
363 | 363 | Boolean $windows_npm_install = false, |
| 364 | + Optional[String] $windows_ddagentuser_name = undef, |
| 365 | + Optional[String] $windows_ddagentuser_password = undef, |
364 | 366 | ) inherits datadog_agent::params { |
365 | 367 |
|
366 | 368 | #In this regex, version '1:6.15.0~rc.1-1' would match as $1='1:', $2='6', $3='15', $4='0', $5='~rc.1', $6='1' |
|
379 | 381 | fail("agent_major_version must be either 5, 6 or 7, not ${_agent_major_version}") |
380 | 382 | } |
381 | 383 |
|
382 | | - # Allow ports to be passed as integers or strings. |
383 | | - # lint:ignore:only_variable_string |
384 | | - $_dogstatsd_port = "${dogstatsd_port}" |
385 | | - $_statsd_forward_port = "${statsd_forward_port}" |
386 | | - $_graphite_listen_port = "${graphite_listen_port}" |
387 | | - $_listen_port = "${listen_port}" |
388 | | - $_pup_port = "${pup_port}" |
389 | | - $_syslog_port = "${syslog_port}" |
390 | | - # lint:endignore |
391 | | - |
392 | | - validate_legacy(String, 'validate_re', $_dogstatsd_port, '^\d*$') |
393 | | - validate_legacy(String, 'validate_re', $_statsd_forward_port, '^\d*$') |
394 | | - validate_legacy(String, 'validate_re', $_graphite_listen_port, '^\d*$') |
395 | | - validate_legacy(String, 'validate_re', $_listen_port, '^\d*$') |
396 | | - validate_legacy(String, 'validate_re', $_pup_port, '^\d*$') |
397 | | - validate_legacy(String, 'validate_re', $_syslog_port, '^\d*$') |
| 384 | + if ($::operatingsystem == 'Windows' and $windows_ddagentuser_name != undef) { |
| 385 | + $dd_user = $windows_ddagentuser_name |
| 386 | + } else { |
| 387 | + $dd_user = $datadog_agent::params::dd_user |
| 388 | + } |
398 | 389 |
|
399 | 390 | if $conf_dir == undef { |
400 | 391 | if $_agent_major_version == 5 { |
|
461 | 452 | } |
462 | 453 | 'Windows' : { |
463 | 454 | class { 'datadog_agent::windows' : |
464 | | - agent_major_version => $_agent_major_version, |
465 | | - agent_repo_uri => $agent_repo_uri, |
466 | | - agent_version => $agent_version, |
467 | | - msi_location => $win_msi_location, |
468 | | - api_key => $api_key, |
469 | | - hostname => $host, |
470 | | - tags => $local_tags, |
471 | | - ensure => $win_ensure, |
472 | | - npm_install => $windows_npm_install, |
| 455 | + agent_major_version => $_agent_major_version, |
| 456 | + agent_repo_uri => $agent_repo_uri, |
| 457 | + agent_version => $agent_version, |
| 458 | + msi_location => $win_msi_location, |
| 459 | + api_key => $api_key, |
| 460 | + hostname => $host, |
| 461 | + tags => $local_tags, |
| 462 | + ensure => $win_ensure, |
| 463 | + npm_install => $windows_npm_install, |
| 464 | + ddagentuser_name => $windows_ddagentuser_name, |
| 465 | + ddagentuser_password => $windows_ddagentuser_password, |
473 | 466 | } |
474 | 467 | if ($win_ensure == absent) { |
475 | 468 | return() #Config files will remain unchanged on uninstall |
|
557 | 550 | require => File['/etc/dd-agent'], |
558 | 551 | } |
559 | 552 |
|
560 | | - if ($dd_url == '') { |
| 553 | + if $dd_url.empty { |
561 | 554 | $_dd_url = 'https://app.datadoghq.com' |
562 | 555 | } else { |
563 | 556 | $_dd_url = $dd_url |
|
585 | 578 | order => '05', |
586 | 579 | } |
587 | 580 |
|
588 | | - if ($extra_template != '') { |
| 581 | + unless $extra_template.empty { |
589 | 582 | concat::fragment{ 'datadog extra_template footer': |
590 | 583 | target => '/etc/dd-agent/datadog.conf', |
591 | 584 | content => template($extra_template), |
|
663 | 656 | }, |
664 | 657 | } |
665 | 658 | } |
666 | | - if $host != '' { |
| 659 | + if $host.empty { |
| 660 | + $host_config = {} |
| 661 | + } else { |
667 | 662 | $host_config = { |
668 | 663 | 'hostname' => $host, |
669 | 664 | } |
670 | | - } else { |
671 | | - $host_config = {} |
672 | 665 | } |
673 | 666 |
|
674 | 667 | if $apm_analyzed_spans { |
|
691 | 684 | $apm_obfuscation_config = {} |
692 | 685 | } |
693 | 686 |
|
694 | | - if $statsd_forward_host != '' { |
695 | | - if $_statsd_forward_port != '' { |
| 687 | + if $statsd_forward_host.empty { |
| 688 | + $statsd_forward_config = {} |
| 689 | + } else { |
| 690 | + if String($statsd_forward_port).empty { |
696 | 691 | $statsd_forward_config = { |
697 | 692 | 'statsd_forward_host' => $statsd_forward_host, |
698 | | - 'statsd_forward_port' => $statsd_forward_port, |
699 | 693 | } |
700 | 694 | } else { |
701 | 695 | $statsd_forward_config = { |
702 | 696 | 'statsd_forward_host' => $statsd_forward_host, |
| 697 | + 'statsd_forward_port' => $statsd_forward_port, |
703 | 698 | } |
704 | 699 | } |
705 | | - } else { |
706 | | - $statsd_forward_config = {} |
707 | 700 | } |
708 | 701 |
|
709 | 702 | if $additional_checksd { |
|
761 | 754 |
|
762 | 755 | if ($::operatingsystem == 'Windows') { |
763 | 756 |
|
| 757 | + |
764 | 758 | file { 'C:/ProgramData/Datadog': |
765 | 759 | ensure => directory |
766 | 760 | } |
|
0 commit comments