-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Integrations] Add logic to install extra_packages agent checks
- Let the datadog:dd-agent recipe install any package found in the `extra_packages` attribute, and configure it - add some tests with the twemproxy integration
- Loading branch information
Showing
10 changed files
with
111 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# | ||
# Cookbook Name:: datadog | ||
# Recipe:: integrations | ||
# | ||
# Copyright 2011-2015, Datadog | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
# | ||
|
||
include_recipe 'datadog::repository' if node['datadog']['installrepo'] | ||
|
||
# Install all specified integrations | ||
# example: | ||
# default['datadog']['extra_packages']['twemproxy'] = { | ||
# 'name' => 'dd-check-twemproxy', | ||
# 'version' => '1.0.0-1' | ||
# } | ||
# default['datadog']['twemproxy']['instances'] = [ | ||
# { | ||
# 'url' => 'http://localhost:22222' | ||
# } | ||
node['datadog']['extra_packages'].each do |name, options| | ||
package options['name'] do | ||
version options['version'] | ||
action :install | ||
end | ||
|
||
datadog_monitor name do | ||
init_config node['datadog'][name]['init_config'] | ||
instances node['datadog'][name]['instances'] | ||
use_integration_template true | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Generated by Chef, local modifications will be overwritten | ||
|
||
<%= JSON.parse(({ 'instances' => @instances, 'init_config' => @init_config }).to_json).to_yaml %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
../../helpers/serverspec/Gemfile |
33 changes: 33 additions & 0 deletions
33
test/integration/datadog_integrations/serverspec/integrations_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Encoding: utf-8 | ||
require 'spec_helper' | ||
|
||
AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/twemproxy.yaml') | ||
|
||
describe service(@agent_service_name) do | ||
it { should be_running } | ||
end | ||
|
||
describe file(AGENT_CONFIG) do | ||
it { should be_a_file } | ||
|
||
it 'is valid yaml matching input values' do | ||
generated = YAML.load_file(AGENT_CONFIG) | ||
|
||
expected = { | ||
instances: [ | ||
{ | ||
url: 'http://localhost:22222' | ||
} | ||
], | ||
init_config: {} | ||
} | ||
|
||
expect(generated.to_json).to be_json_eql expected.to_json | ||
end | ||
|
||
if @agent_check_dir | ||
describe file('/opt/datadog-agent/3rd-party/twemproxy/check.py') do | ||
it { should be_a_file } | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters