Move the mesos integration conf to mesos_master
The mesos integration was not working and by moving the cookbook to monitor to mesos_slave, it now correctly works with the agent.
MODIFY
kitchen.yml
kitchen.yml
@@ -420,14 +420,22 @@ suites:
my_consumer:
my_topic: [0, 1, 4, 12]
-- name: datadog_mesos
+- name: datadog_mesos_master
run_list:
- - recipe[datadog::mesos]
+ - recipe[datadog::mesos_master]
excludes: *WINDOWS_PLATFORMS
attributes:
datadog:
<<: *DATADOG
- mesos:
+ mesos_master:
+ instances:
+ - url: localhost:5050
+ timeout: 8
+ tags:
+ - master
+ - tata
+ init_config:
+ default_timeout: 10
instances:
- url: localhost:5050
timeout: 8

RENAME
recipes/mesos.rb
recipes/mesos_master.rb
@@ -33,10 +33,10 @@ include_recipe 'datadog::dd-agent'
# default_timeout: 10
# }
-datadog_monitor 'mesos' do
- init_config node['datadog']['mesos']['init_config']
- instances node['datadog']['mesos']['instances']
- logs node['datadog']['mesos']['logs']
+datadog_monitor 'mesos_master' do
+ init_config node['datadog']['mesos_master']['init_config']
+ instances node['datadog']['mesos_master']['instances']
+ logs node['datadog']['mesos_master']['logs']
action :add
notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start']
end

ADD
spec/integrations/mesos_master_spec.rb
+describe 'datadog::mesos_master' do
+ expected_yaml = <<-EOF
+ logs: ~
+ init_config:
+ default_timeout: 10
+ instances:
+ - url: 'localhost:5050'
+ timeout: 8,
+ tags:
+ - master
+ - tata
+ EOF
+
+ cached(:chef_run) do
+ ChefSpec::SoloRunner.new(
+ platform: 'ubuntu',
+ version: '16.04',
+ step_into: ['datadog_monitor']
+ ) do |node|
+ node.automatic['languages'] = { 'python' => { 'version' => '2.7.2' } }
+ node.normal['datadog'] = {
+ api_key: 'someapikey',
+ mesos_master: {
+ init_config: {
+ default_timeout: 10
+ },
+ instances: [
+ {
+ url: 'localhost:5050',
+ timeout: 8,
+ tags: ['master', 'tata']
+ }
+ ]
+ }
+ }
+ 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('mesos_master') }
+
+ it 'renders expected YAML config file' do
+ expect(chef_run).to(render_file('/etc/datadog-agent/conf.d/mesos_master.yaml').with_content { |content|
+ expect(YAML.safe_load(content).to_json).to be_json_eql(YAML.safe_load(expected_yaml).to_json)
+ })
+ end
+end

RENAME
templates/default/mesos.yaml.erb
templates/default/mesos_master.yaml.erb
RENAME
test/integration/datadog_mesos/serverspec/Gemfile
test/integration/datadog_mesos_master/serverspec/Gemfile
RENAME
test/integration/datadog_mesos/serverspec/mesos_spec.rb
test/integration/datadog_mesos_master/serverspec/mesos_spec.rb
require 'spec_helper'
-AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/mesos.yaml')
+AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/mesos_master.yaml')
describe service(@agent_service_name) do
it { should be_running }
@@ -19,7 +19,7 @@ describe file(AGENT_CONFIG) do
{
url: 'localhost:5050',
timeout: 8,
- tags: ['toto', 'tata']
+ tags: ['master', 'tata']
}
],
'logs' => nil,

Move the mesos integration conf to mesos_master

The mesos integration was not working and by moving the cookbook to monitor to mesos_slave, it now correctly works with the agent.