Skip to content
Merged
Show file tree
Hide file tree
Changes from 4 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
7 changes: 7 additions & 0 deletions manifests/integrations/http_check.pp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,11 @@
# alerts only if the check fails x times within the last y attempts
# where x is the threshold and y is the window.
#
# reverse_content_match
# When (optional) true, reverses the behavior of the content_match option,
# i.e. the HTTP check will report as DOWN if the string or expression
# in content_match IS found. (default is false)
#
# content_match
# The (optional) content_match parameter will allow the check
# to look for a particular string within the response. The check
Expand Down Expand Up @@ -166,6 +171,7 @@
$threshold = undef,
$window = undef,
$content_match = undef,
$reverse_content_match = false,
$include_content = false,
$http_response_status_code = undef,
$collect_response_time = true,
Expand Down Expand Up @@ -196,6 +202,7 @@
'threshold' => $threshold,
'window' => $window,
'content_match' => $content_match,
'reverse_content_match' => $reverse_content_match,
'include_content' => $include_content,
'http_response_status_code' => $http_response_status_code,
'collect_response_time' => $collect_response_time,
Expand Down
3 changes: 3 additions & 0 deletions spec/classes/datadog_agent_integrations_http_check_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
it { should contain_file(conf_file).without_content(%{threshold: }) }
it { should contain_file(conf_file).without_content(%r{window: }) }
it { should contain_file(conf_file).without_content(%r{content_match: }) }
it { should contain_file(conf_file).without_content(%r{reverse_content_match: false}) }
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{http_response_status_code: }) }
Expand All @@ -67,6 +68,7 @@
threshold: 456,
window: 789,
content_match: 'foomatch',
reverse_content_match: false,
Comment thread
dorg-kanderson marked this conversation as resolved.
Outdated
include_content: true,
collect_response_time: false,
disable_ssl_validation: true,
Expand All @@ -90,6 +92,7 @@
it { should contain_file(conf_file).with_content(%r{threshold: 456}) }
it { should contain_file(conf_file).with_content(%r{window: 789}) }
it { should contain_file(conf_file).with_content(%r{content_match: 'foomatch'}) }
it { should contain_file(conf_file).with_content(%r{reverse_content_match: false}) }
Comment thread
dorg-kanderson marked this conversation as resolved.
Outdated
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}) }
Expand Down
3 changes: 3 additions & 0 deletions templates/agent-conf.d/http_check.yaml.erb
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ instances:
<% if instance['window'] -%>
window: <%= instance['window'] %>
<% end -%>
<% if instance['reverse_content_match'] -%>
reverse_content_match: '<%= instance["reverse_content_match"] %>'
Comment thread
dorg-kanderson marked this conversation as resolved.
Outdated
<% end -%>
<% if instance['content_match'] -%>
content_match: '<%= instance["content_match"] %>'
<% end -%>
Expand Down