diff --git a/manifests/integrations/system_core.pp b/manifests/integrations/system_core.pp new file mode 100644 index 00000000..69005b4d --- /dev/null +++ b/manifests/integrations/system_core.pp @@ -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] + } +} diff --git a/spec/classes/datadog_agent_integrations_system_core_spec.rb b/spec/classes/datadog_agent_integrations_system_core_spec.rb new file mode 100644 index 00000000..db6af86e --- /dev/null +++ b/spec/classes/datadog_agent_integrations_system_core_spec.rb @@ -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 diff --git a/templates/agent-conf.d/system_core.yaml.erb b/templates/agent-conf.d/system_core.yaml.erb new file mode 100644 index 00000000..563cedd7 --- /dev/null +++ b/templates/agent-conf.d/system_core.yaml.erb @@ -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 \ No newline at end of file