fix the way system-probe recipe is included
MODIFY
recipes/dd-agent.rb
recipes/dd-agent.rb
@@ -135,7 +135,14 @@ service 'datadog-agent' do
retry_delay 5
end
+# only load system-probe recipe if an agent6 installation comes with it
+ruby_block "include system-probe" do
+ block do
+ if ::File.exist?('/opt/datadog-agent/embedded/bin/system-probe') and node['datadog']['agent6'] and !is_windows
+ run_context.include_recipe "datadog::system-probe"
+ end
+ end
+end
+
# Install integration packages
include_recipe 'datadog::integrations' unless is_windows
-
-include_recipe 'datadog::system-probe'

MODIFY
recipes/system-probe.rb
recipes/system-probe.rb
# Set the correct agent startup action
sysprobe_agent_start = node['datadog']['system_probe']['enabled'] ? :start : :stop
-system_probe_bin_dir = '/opt/datadog-agent/embedded/bin'
-agent_available = File.exist?("#{system_probe_bin_dir}/system-probe") and node['datadog']['agent6']
-
#
# Configures system-probe agent
-if agent_available
system_probe_config_file = ::File.join(node['datadog']['agent6_config_dir'], 'system-probe.yaml')
template system_probe_config_file do
source 'system_probe.yaml.erb'
@@ -43,7 +39,6 @@ if agent_available
# since process-agent collects network info through system-probe, enabling system-probe should also restart process-agent
notifies :restart, 'service[datadog-agent]', :delayed unless sysprobe_agent_start == false
end
-end
# Common configuration
service_provider = nil
@@ -55,11 +50,9 @@ if node['datadog']['agent6'] &&
service_provider = Chef::Provider::Service::Upstart
end
-if agent_available
service 'datadog-agent-sysprobe' do
action [sysprobe_agent_start]
provider service_provider unless service_provider.nil?
supports :restart => true, :status => true, :start => true, :stop => true
subscribes :restart, "template[#{system_probe_config_file}]", :delayed unless sysprobe_agent_start == false
end
-end

fix the way system-probe recipe is included