chef-datadog icon indicating copy to clipboard operation
chef-datadog copied to clipboard

Datadog docker installation

Open ruanton29 opened this issue 7 years ago • 2 comments

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

ruanton29 avatar Oct 13 '17 10:10 ruanton29

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

olivielpeau avatar Nov 30 '17 15:11 olivielpeau

Hi @olivielpeau I could use it like this but we use many of monitoring recipe and it's easy to use it like

  1. Put config and just include "datadog::nginx"
  2. 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

ruanton29 avatar Dec 01 '17 11:12 ruanton29