Skip to content

Commit

Permalink
Merge pull request #243 from DataDog/miketheman/system_core
Browse files Browse the repository at this point in the history
Add `system_core` recipe and file
  • Loading branch information
miketheman committed Oct 22, 2015
2 parents d653883 + f0b9ceb commit c53ff47
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 0 deletions.
21 changes: 21 additions & 0 deletions recipes/system_core.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#
# Cookbook Name:: datadog
# Recipe:: system_core
#
# Copyright 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::dd-agent'

datadog_monitor 'system_core'
33 changes: 33 additions & 0 deletions spec/integrations/system_core_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
describe 'datadog::system_core' do
expected_yaml = <<-EOF
# Generated by Chef, local modifications will be overwritten
init_config:
instances:
# No configuration is needed for this check.
# A single instance needs to be defined with any value.
- foo: bar
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' }
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('system_core') }

it 'renders expected YAML config file' do
expect(chef_run).to render_file('/etc/dd-agent/conf.d/system_core.yaml').with_content { |content|
expect(YAML.load(content).to_json).to be_json_eql(YAML.load(expected_yaml).to_json)
}
end
end
8 changes: 8 additions & 0 deletions templates/default/system_core.yaml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Generated by Chef, local modifications will be overwritten

init_config:

instances:
# No configuration is needed for this check.
# A single instance needs to be defined with any value.
- foo: bar

0 comments on commit c53ff47

Please sign in to comment.