Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
1 change: 1 addition & 0 deletions manifests/integrations/nginx.pp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
#
class datadog_agent::integrations::nginx(
Array $instances = [],
$logs = undef,
Comment thread
jadams-av marked this conversation as resolved.
Outdated
) inherits datadog_agent::params {
include datadog_agent

Expand Down
14 changes: 14 additions & 0 deletions spec/classes/datadog_agent_integrations_nginx_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,25 @@
'nginx_status_url' => 'http://foo.bar:1941/check',
'tags' => %w{foo bar baz}
}
],
logs: [
{
'type' => 'file',
'path' => '/var/log/nginx/access.log',
'service' => 'my.nginx.service',
Comment thread
jadams-av marked this conversation as resolved.
Outdated
'source' => 'nginx',
'sourcecategory' => 'http_web_access'
}
Comment thread
jadams-av marked this conversation as resolved.
]
}}

it { should contain_file(conf_file).with_content(%r{nginx_status_url:.*http://foo.bar:1941/check}m) }
it { should contain_file(conf_file).with_content(%r{tags:.*foo.*bar.*baz}m) }
it { should contain_file(conf_file).with_content(%r{type:.*file}m) }
it { should contain_file(conf_file).with_content(%r{path:.*/var/log/nginx/access.log}m) }
it { should contain_file(conf_file).with_content(%r{service:.*my.nginx.service}m) }
Comment thread
jadams-av marked this conversation as resolved.
Outdated
it { should contain_file(conf_file).with_content(%r{source:.*nginx}m) }
it { should contain_file(conf_file).with_content(%r{sourcecategory:.*http_web_access}m) }
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions templates/agent-conf.d/nginx.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,8 @@
require 'yaml'
%>

<% if @logs %>
<%= {'init_config'=>nil, 'instances'=>@instances, 'logs'=>@logs}.to_yaml %>
<% else %>
<%= {'init_config'=>nil, 'instances'=>@instances}.to_yaml %>
<% end %>