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
24 changes: 24 additions & 0 deletions manifests/integrations/http_check.pp
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,22 @@
# problematic SSL server certificates. To maintain backwards
# compatibility this defaults to false.
#
# skip_event
# The (optional) skip_event parameter will instruct the check to not
# create any event to avoid duplicates with a server side service check.
# This default to False.
#
# check_certificate_expiration
# days_warning
# days_critical
# The (optional) check_certificate_expiration will instruct the check
# to create a service check that checks the expiration of the
# ssl certificate. Allow for a warning to occur when x days are
# left in the certificate, and alternatively raise a critical
# warning if the certificate is y days from the expiration date.
# The SSL certificate will always be validated for this additional
# service check regardless of the value of disable_ssl_validation
#
# headers
# The (optional) headers parameter allows you to send extra headers
# with the request. This is useful for explicitly specifying the host
Expand Down Expand Up @@ -123,6 +139,10 @@
$include_content = false,
$collect_response_time = true,
$disable_ssl_validation = false,
$skip_event = undef,
$check_certificate_expiration = undef,
$days_warning = undef,
$days_critical = undef,
$headers = [],
$tags = [],
$contact = [],
Expand All @@ -143,6 +163,10 @@
'include_content' => $include_content,
'collect_response_time' => $collect_response_time,
'disable_ssl_validation' => $disable_ssl_validation,
'skip_event' => $skip_event,
'check_certificate_expiration' => $check_certificate_expiration,
'days_warning' => $days_warning,
'days_critical' => $days_critical,
'headers' => $headers,
'tags' => $tags,
'contact' => $contact,
Expand Down
12 changes: 12 additions & 0 deletions spec/classes/datadog_agent_integrations_http_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@
it { should contain_file(conf_file).without_content(%r{include_content: true}) }
it { should contain_file(conf_file).without_content(%r{collect_response_time: true}) }
it { should contain_file(conf_file).without_content(%r{disable_ssl_validation: false}) }
it { should contain_file(conf_file).without_content(%r{skip_event: }) }
it { should contain_file(conf_file).without_content(%r{check_certificate_expiration: }) }
it { should contain_file(conf_file).without_content(%r{days_warning: }) }
it { should contain_file(conf_file).without_content(%r{days_critical: }) }
it { should contain_file(conf_file).without_content(%r{headers: }) }
it { should contain_file(conf_file).without_content(%r{tags: }) }
end
Expand All @@ -49,6 +53,10 @@
include_content: true,
collect_response_time: false,
disable_ssl_validation: true,
skip_event: true,
check_certificate_expiration: true,
days_warning: 14,
days_critical: 7,
}}

it { should contain_file(conf_file).with_content(%r{name: foo.bar.baz}) }
Expand All @@ -62,6 +70,10 @@
it { should contain_file(conf_file).with_content(%r{include_content: true}) }
it { should contain_file(conf_file).without_content(%r{collect_response_time: true}) }
it { should contain_file(conf_file).with_content(%r{disable_ssl_validation: true}) }
it { should contain_file(conf_file).with_content(%r{skip_event: true}) }
it { should contain_file(conf_file).with_content(%r{check_certificate_expiration: true}) }
it { should contain_file(conf_file).with_content(%r{days_warning: 14}) }
it { should contain_file(conf_file).with_content(%r{days_critical: 7}) }
end

context 'with headers parameter array' do
Expand Down
14 changes: 13 additions & 1 deletion templates/agent-conf.d/http_check.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,19 @@ instances:
collect_response_time: <%= instance['collect_response_time'] %>
<% end -%>
<% if instance['disable_ssl_validation'] -%>
disable_ssl_validation: <%= instance['disable_ssl_validation'] %>
disable_ssl_validation: <%= instance['disable_ssl_validation'] %>
<% end -%>
<% if instance['skip_event'] -%>
skip_event: <%= instance['skip_event'] %>
<% end -%>
<% if instance['check_certificate_expiration'] -%>
check_certificate_expiration: <%= instance['check_certificate_expiration'] %>
<% end -%>
<% if instance['days_warning'] -%>
days_warning: <%= instance['days_warning'] %>
<% end -%>
<% if instance['days_critical'] -%>
days_critical: <%= instance['days_critical'] %>
<% end -%>
<% if instance['headers'] and ! instance['headers'].empty? -%>
headers:
Expand Down