From dc091939c71cf36e68eebd8ad04fce25234448b3 Mon Sep 17 00:00:00 2001 From: Kris Anderson <36420794+dorg-kanderson@users.noreply.github.com> Date: Tue, 14 May 2019 14:08:35 -0400 Subject: [PATCH 1/7] Update http_check.yaml.erb --- templates/agent-conf.d/http_check.yaml.erb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/templates/agent-conf.d/http_check.yaml.erb b/templates/agent-conf.d/http_check.yaml.erb index bbef4856..f217883c 100644 --- a/templates/agent-conf.d/http_check.yaml.erb +++ b/templates/agent-conf.d/http_check.yaml.erb @@ -32,6 +32,9 @@ instances: <% if instance['window'] -%> window: <%= instance['window'] %> <% end -%> +<% if instance['reverse_content_match'] -%> + reverse_content_match: '<%= instance["reverse_content_match"] %>' +<% end -%> <% if instance['content_match'] -%> content_match: '<%= instance["content_match"] %>' <% end -%> From 6e6d731c743e1355122da4f5470a9ea7c500cda8 Mon Sep 17 00:00:00 2001 From: Kris Anderson <36420794+dorg-kanderson@users.noreply.github.com> Date: Tue, 14 May 2019 14:11:02 -0400 Subject: [PATCH 2/7] Update http_check.pp --- manifests/integrations/http_check.pp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/manifests/integrations/http_check.pp b/manifests/integrations/http_check.pp index 0fb572f8..bd387707 100644 --- a/manifests/integrations/http_check.pp +++ b/manifests/integrations/http_check.pp @@ -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 @@ -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, @@ -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, From 289a3033f91cc94ca5d381a1fc896cc1747d92da Mon Sep 17 00:00:00 2001 From: Kris Anderson <36420794+dorg-kanderson@users.noreply.github.com> Date: Tue, 14 May 2019 14:24:00 -0400 Subject: [PATCH 3/7] Update datadog_agent_integrations_http_check_spec.rb --- spec/classes/datadog_agent_integrations_http_check_spec.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spec/classes/datadog_agent_integrations_http_check_spec.rb b/spec/classes/datadog_agent_integrations_http_check_spec.rb index 9eee9af4..726efafd 100644 --- a/spec/classes/datadog_agent_integrations_http_check_spec.rb +++ b/spec/classes/datadog_agent_integrations_http_check_spec.rb @@ -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: }) } 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: }) } @@ -67,6 +68,7 @@ threshold: 456, window: 789, content_match: 'foomatch', + reverse_content_match: false, include_content: true, collect_response_time: false, disable_ssl_validation: true, @@ -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}) } 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}) } From d1913241f6af9aaf52509b55ca12c84b84b7887c Mon Sep 17 00:00:00 2001 From: Kris Anderson <36420794+dorg-kanderson@users.noreply.github.com> Date: Tue, 14 May 2019 16:21:58 -0400 Subject: [PATCH 4/7] Update datadog_agent_integrations_http_check_spec.rb --- spec/classes/datadog_agent_integrations_http_check_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/datadog_agent_integrations_http_check_spec.rb b/spec/classes/datadog_agent_integrations_http_check_spec.rb index 726efafd..7a80fdc0 100644 --- a/spec/classes/datadog_agent_integrations_http_check_spec.rb +++ b/spec/classes/datadog_agent_integrations_http_check_spec.rb @@ -42,7 +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: }) } + 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: }) } From 3aa87225fa787bfed2e354149170f63cc4b78b08 Mon Sep 17 00:00:00 2001 From: Kris Anderson <36420794+dorg-kanderson@users.noreply.github.com> Date: Tue, 14 May 2019 17:36:17 -0400 Subject: [PATCH 5/7] Update datadog_agent_integrations_http_check_spec.rb --- spec/classes/datadog_agent_integrations_http_check_spec.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/spec/classes/datadog_agent_integrations_http_check_spec.rb b/spec/classes/datadog_agent_integrations_http_check_spec.rb index 7a80fdc0..a8179d2f 100644 --- a/spec/classes/datadog_agent_integrations_http_check_spec.rb +++ b/spec/classes/datadog_agent_integrations_http_check_spec.rb @@ -42,7 +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{reverse_content_match: true}) } 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: }) } @@ -68,7 +68,7 @@ threshold: 456, window: 789, content_match: 'foomatch', - reverse_content_match: false, + reverse_content_match: true, include_content: true, collect_response_time: false, disable_ssl_validation: true, From 22ea18dee4afee36a242235088132e0ad8b612cf Mon Sep 17 00:00:00 2001 From: Kris Anderson <36420794+dorg-kanderson@users.noreply.github.com> Date: Tue, 14 May 2019 17:36:46 -0400 Subject: [PATCH 6/7] Update datadog_agent_integrations_http_check_spec.rb --- spec/classes/datadog_agent_integrations_http_check_spec.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spec/classes/datadog_agent_integrations_http_check_spec.rb b/spec/classes/datadog_agent_integrations_http_check_spec.rb index a8179d2f..cf40f447 100644 --- a/spec/classes/datadog_agent_integrations_http_check_spec.rb +++ b/spec/classes/datadog_agent_integrations_http_check_spec.rb @@ -92,7 +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}) } + it { should contain_file(conf_file).with_content(%r{reverse_content_match: true}) } 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}) } From 7e9f06d725a554edc7a2157766c3104364da2013 Mon Sep 17 00:00:00 2001 From: Kris Anderson <36420794+dorg-kanderson@users.noreply.github.com> Date: Tue, 14 May 2019 19:37:42 -0400 Subject: [PATCH 7/7] Update http_check.yaml.erb --- templates/agent-conf.d/http_check.yaml.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/agent-conf.d/http_check.yaml.erb b/templates/agent-conf.d/http_check.yaml.erb index f217883c..f08f43a1 100644 --- a/templates/agent-conf.d/http_check.yaml.erb +++ b/templates/agent-conf.d/http_check.yaml.erb @@ -33,7 +33,7 @@ instances: window: <%= instance['window'] %> <% end -%> <% if instance['reverse_content_match'] -%> - reverse_content_match: '<%= instance["reverse_content_match"] %>' + reverse_content_match: <%= instance["reverse_content_match"] %> <% end -%> <% if instance['content_match'] -%> content_match: '<%= instance["content_match"] %>'