Add couchbase recipe.
ADD
recipes/couchbase.rb
+include_recipe 'datadog::dd-agent'
+
+# Monitor couchbase
+#
+# Assuming you have 2 instances on the same host
+# you need to set up the following attributes.
+# Each instance's metric will be tagged with "instance:server_url".
+# to help you differentiate between instances.
+#
+# node['datadog']['couchbase']['instances'] = [
+# {
+# server: 'http://localhost:1234'
+# },
+# {
+# server: 'http://localhost:4567'
+# }
+# ]
+
+datadog_monitor 'couchbase' do
+ instances node['datadog']['couchbase']['instances']
+end

ADD
spec/integrations/couchbase_spec.rb
+describe 'datadog::couchbase' do
+ expected_yaml = <<-EOF
+ init_config:
+
+ instances:
+ - server: http://localhost:8091
+ user: Administrator
+ password: default
+ EOF
+
+ cached(:chef_run) do
+ ChefSpec::SoloRunner.new(step_into: ['datadog_monitor']) do |node|
+ node.automatic['languages'] = { 'python' => { 'version' => '2.7.2' } }
+ node.set['datadog'] = {
+ api_key: 'someapikey',
+ couchbase: {
+ instances: [
+ {
+ server: 'http://localhost:8091',
+ username: 'Administrator',
+ password: 'default'
+ }
+ ]
+ }
+ }
+ end.converge(described_recipe)
+ end
+
+ subject { chef_run }
+
+ it_behaves_like 'datadog-agent'
+
+ it { is_expected.to include_recipe('datadog::dd-agent') }
+
+ it { is_expected.to add_datadog_monitor('couchbase') }
+
+ it 'renders expected YAML config file' do
+ expect(chef_run).to(render_file('/etc/dd-agent/conf.d/couchbase.yaml').with_content { |content|
+ expect(YAML.safe_load(content).to_json).to be_json_eql(YAML.safe_load(expected_yaml).to_json)
+ })
+ end
+end

ADD
templates/default/couchbase.yaml.erb
+instances:
+<% @instances.each do |i| -%>
+ - server: <%= i['server'] %>
+ user: <%= @node.fetch('couchbase', {}).fetch('server', {}).fetch('username', i.fetch('username', 'Administrator')) %>
+ password: <%= @node.fetch('couchbase', {}).fetch('server', {}).fetch('password', i.fetch('password', '')) %>
+<% end %>
+init_config:

Add couchbase recipe. (#487)