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
73 changes: 43 additions & 30 deletions manifests/system_probe.pp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
class datadog_agent::system_probe(
Boolean $enabled = false,
Boolean $network_enabled = false,
Optional[String] $log_file = undef,
Optional[String] $sysprobe_socket = undef,
Optional[Boolean] $enable_oom_kill = false,
Expand All @@ -9,46 +10,58 @@
Optional[String] $service_provider = undef,
) inherits datadog_agent::params {

if $::operatingsystem == 'Windows' {
# Datadog does not currently support Windows and macOS platforms for Network Performance Monitoring
fail('Network performance monitoring is only supported on Linux.')
}

if $service_provider {
service { $datadog_agent::params::sysprobe_service_name:
ensure => $service_ensure,
enable => $service_enable,
provider => $service_provider,
hasstatus => false,
pattern => 'dd-agent',
require => Package[$datadog_agent::params::package_name],
}
} else {
service { $datadog_agent::params::sysprobe_service_name:
ensure => $service_ensure,
enable => $service_enable,
hasstatus => false,
pattern => 'dd-agent',
require => Package[$datadog_agent::params::package_name],
}
}

$sysprobe_config = {
'system_probe_config' => {
'enabled' => $enabled,
'sysprobe_socket' => $sysprobe_socket,
'log_file' => $log_file,
'enable_oom_kill' => $enable_oom_kill,
},
'network_config' => {
'enabled' => $network_enabled,
}
}

file { '/etc/datadog-agent/system-probe.yaml':
owner => $datadog_agent::params::dd_user,
group => 'dd-agent',
mode => '0640',
content => template('datadog_agent/system_probe.yaml.erb'),
notify => Service[$datadog_agent::params::sysprobe_service_name],
require => File['/etc/datadog-agent'],
if $::operatingsystem == 'Windows' {

file { 'C:/ProgramData/Datadog/system-probe.yaml':
owner => $datadog_agent::params::dd_user,
group => $datadog_agent::params::dd_group,
mode => '0640',
content => template('datadog_agent/system_probe.yaml.erb'),
require => File['C:/ProgramData/Datadog'],
}

} else {

if $service_provider {
service { $datadog_agent::params::sysprobe_service_name:
ensure => $service_ensure,
enable => $service_enable,
provider => $service_provider,
hasstatus => false,
pattern => 'dd-agent',
require => Package[$datadog_agent::params::package_name],
}
} else {
service { $datadog_agent::params::sysprobe_service_name:
ensure => $service_ensure,
enable => $service_enable,
hasstatus => false,
pattern => 'dd-agent',
require => Package[$datadog_agent::params::package_name],
}
}

file { '/etc/datadog-agent/system-probe.yaml':
owner => $datadog_agent::params::dd_user,
group => $datadog_agent::params::dd_group,
mode => '0640',
content => template('datadog_agent/system_probe.yaml.erb'),
notify => Service[$datadog_agent::params::sysprobe_service_name],
require => File['/etc/datadog-agent'],
}
}

}
2 changes: 1 addition & 1 deletion manifests/windows.pp
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@
}

$hostname_option = $hostname ? { '' => {}, default => { 'HOSTNAME' => $hostname } }
$npm_install_option = $npm_install ? { false => {}, true => { 'NPM' => 'true' } }
$npm_install_option = $npm_install ? { false => {}, true => { 'ADDLOCAL' => 'MainApplication,NPM' } }

package { $datadog_agent::params::package_name:
ensure => $ensure_version,
Expand Down
2 changes: 1 addition & 1 deletion spec/classes/datadog_agent_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,7 @@
it do
is_expected.to contain_package('Datadog Agent').with(
ensure: 'installed',
install_options: ['/norestart', { 'APIKEY' => 'notakey', 'HOSTNAME' => 'notahost', 'TAGS' => '""', 'NPM' => 'true' }],
install_options: ['/norestart', { 'APIKEY' => 'notakey', 'HOSTNAME' => 'notahost', 'TAGS' => '""', 'ADDLOCAL' => 'MainApplication,NPM' }],
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You'll have to open up the file above, but the let statement above implies to me this is only A7.
There's no reason it won't work in A6, does there need to be another change for that?

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 is just the test. It only covers A7, but the code is the same for both Agents so I don't think we need to test both.

)
end
end
Expand Down