chef-datadog
chef-datadog copied to clipboard
Datadog docker installation
Hi I try use datadog agent in docker, and i need some recipe from datadog cookbook ( line nginx , etc) but all recipe include datadog agent install. Can someone add flag like enable\disable agent installation ? Best regard Anton
Hi @ruanton29,
could you provide a bit more details as to why you wouldn't want the "datadog::nginx" recipe to also include the recipes that install the agent? The latter recipes should (almost) not change anything in the environment unless the agent hasn't already been installed (and as far as I know this should also apply to docker containers).
That said, if you just want to set up a particular integration (for example nginx) without using the datadog::nginx
recipe, you can use the datadog_monitor
resource directly in your recipes as follows:
datadog_monitor 'nginx' do
instances node['datadog']['nginx']['instances']
end
Hi @olivielpeau I could use it like this but we use many of monitoring recipe and it's easy to use it like
- Put config and just include "datadog::nginx"
- install docker with dataadog But now i use it like
if node['datadog_cookbook']['enable']
service_name = node['datadog_cookbook']['docker']['run']['name']
node['datadog_cookbook']['monitor_default'].each do |service_to_monitor|
unless service_to_monitor == 'zookeeper'
datadog_monitor service_to_monitor do
instances node['datadog'][service_to_monitor]['instances']
notifies :restart, "service[Service #{service_name}]", :delayed
end
else
datadog_monitor 'zk' do
instances node['datadog'][service_to_monitor]['instances']
notifies :restart, "service[Service #{service_name}]", :delayed
end
end
end
end
But simple include will be more elegantly Best regards