Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions manifests/integrations/system_core.pp
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# Class: datadog_agent::integrations::system_core
#
# This class will install the necessary configuration for the system_core integration
#
# Sample Usage:
# include 'datadog_agent::integrations::system_core'
#
#
class datadog_agent::integrations::system_core inherits datadog_agent::params {
include datadog_agent

file {
"${datadog_agent::params::conf_dir}/system_core.yaml":
ensure => file,
owner => $datadog_agent::params::dd_user,
group => $datadog_agent::params::dd_group,
mode => '0644',
content => template('datadog_agent/agent-conf.d/system_core.yaml.erb'),
require => Package[$datadog_agent::params::package_name],
notify => Service[$datadog_agent::params::service_name]
}
}
27 changes: 27 additions & 0 deletions spec/classes/datadog_agent_integrations_system_core_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
require 'spec_helper'

describe 'datadog_agent::integrations::system_core' do
let(:facts) {{
operatingsystem: 'Ubuntu',
}}
let(:conf_dir) { '/etc/dd-agent/conf.d' }
let(:dd_user) { 'dd-agent' }
let(:dd_group) { 'root' }
let(:dd_package) { 'datadog-agent' }
let(:dd_service) { 'datadog-agent' }
let(:conf_file) { "#{conf_dir}/system_core.yaml" }

it { should compile.with_all_deps }
it { should contain_file(conf_file).with(
owner: dd_user,
group: dd_group,
mode: '0644',
)}
it { should contain_file(conf_file).that_requires("Package[#{dd_package}]") }
it { should contain_file(conf_file).that_notifies("Service[#{dd_service}]") }

context 'with default parameters' do
it { should contain_file(conf_file).with_content(%r{instances:}) }
it { should contain_file(conf_file).with_content(%r{ - foo: bar}) }
end
end
10 changes: 10 additions & 0 deletions templates/agent-conf.d/system_core.yaml.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# MANAGED BY PUPPET
#

init_config:

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