Support process-agent configuration in datadog.yaml
Also remove process.conf for Agent 6
MODIFY
attributes/default.rb
attributes/default.rb
@@ -342,18 +342,11 @@ default['datadog']['ddtrace_gem_version'] = nil
# * `false` to explicitly disable it
# Leave it to `nil` to let the agent's default behavior decide whether to run the process-agent
default['datadog']['enable_process_agent'] = nil
+default['datadog']['process_agent']['url'] = 'https://process.datadoghq.com'
-# Comma-separated list of regex patterns matching process commands to blacklist.
-# Example: 'my-secret-app,dbpass'
-default['datadog']['process_agent']['blacklist'] = nil
-
-# Comma-separated list of regex patterns of containers to include or skip.
-# Each pattern should be in the form of "field:pattern" where 'field' is either
-# 'image' or 'name'.
-# Example: 'image:redis,image:nginx'
-default['datadog']['process_agent']['container_blacklist'] = nil
-# Whitelist is applied after the blacklist.
-default['datadog']['process_agent']['container_whitelist'] = nil
+# A list of regex patterns matching process commands to blacklist.
+# Example: ['my-secret-app', 'dbpass']
+default['datadog']['process_agent']['blacklist'] = []
# Full path to store process-agent logs to override the default.
default['datadog']['process_agent']['log_file'] = nil

MODIFY
templates/default/datadog.conf.erb
templates/default/datadog.conf.erb
@@ -217,12 +217,6 @@ connection_limit: <%= node['datadog']['connection_limit'] %>
<% unless node['datadog']['process_agent']['blacklist'].nil? -%>
blacklist: <%= node['datadog']['process_agent']['blacklist'] %>
<% end -%>
-<% unless node['datadog']['process_agent']['container_blacklist'].nil? -%>
-container_blacklist: <%= node['datadog']['process_agent']['container_blacklist'] %>
-<% end -%>
-<% unless node['datadog']['process_agent']['container_whitelist'].nil? -%>
-container_whitelist: <%= node['datadog']['process_agent']['container_whitelist'] %>
-<% end -%>
<% unless node['datadog']['process_agent']['process_interval'].nil? -%>
process_interval = <%= node['datadog']['process_agent']['process_interval'] %>
<% end -%>

MODIFY
templates/default/datadog.yaml.erb
templates/default/datadog.yaml.erb
@@ -61,6 +61,17 @@ if node['datadog']['web_proxy']['host']
http_proxy = scheme + http_proxy
end
+# In the default case we will start and run with only container collection.
+process_agent_enabled = 'false'
+
+if node['datadog']['enable_process_agent'].is_a?(TrueClass)
+ # Collect processes if enabled.
+ process_agent_enabled = 'true'
+elsif node['datadog']['enable_process_agent'].is_a?(FalseClass)
+ # Disable the Agent altogether if false.
+ process_agent_enabled = 'disabled'
+end
+
## Populate agent_config ##
agent_config = @extra_config.merge({
api_key: @api_key,
@@ -81,7 +92,21 @@ agent_config = @extra_config.merge({
log_file: ::File.join(node['datadog']['log_file_directory'], "agent.log"),
# log agent options
- log_enabled: node['datadog']['enable_logs_agent']
+ log_enabled: node['datadog']['enable_logs_agent'],
+
+ # process agent options
+ process_config: {
+ enabled: process_agent_enabled,
+ log_file: node['datadog']['process_agent']['log_file'],
+ intervals: {
+ container: node['datadog']['process_agent']['container_interval'],
+ container_realtime: node['datadog']['process_agent']['rtcontainer_interval'],
+ process: node['datadog']['process_agent']['rtcontainer_interval'],
+ process_realtime: node['datadog']['process_agent']['rtprocess_interval'],
+ },
+ blacklist_patterns: node['datadog']['process_agent']['blacklist'],
+ process_dd_url: node['datadog']['process_agent']['url']
+ }
})
if node['datadog']['use_v2_api']
@@ -106,6 +131,7 @@ end
# Remove nil values
agent_config.reject!{ |k,v| v.nil? }
+agent_config[:process_config][:intervals].reject!{ |k,v| v.nil? }
-%>
# Generated by Chef, local modifications will be overwritten

Support process-agent configuration in datadog.yaml (#511)

Also remove process.conf for Agent 6