From e94292eea357ea4249502e43cb4385c71c33d2a9 Mon Sep 17 00:00:00 2001 From: Mathew Beane Date: Tue, 13 Dec 2016 11:52:28 -0600 Subject: [PATCH 01/10] 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 78529bff..9b450f71 100644 --- a/templates/agent-conf.d/http_check.yaml.erb +++ b/templates/agent-conf.d/http_check.yaml.erb @@ -31,6 +31,9 @@ instances: <% if instance['disable_ssl_validation'] -%> disable_ssl_validation: <%= instance['disable_ssl_validation'] %> <% end -%> +<% if instance['skip_event'] -%> + skip_event: <%= instance['skip_event'] %> +<% end -%> <% if instance['headers'] and ! instance['headers'].empty? -%> headers: <%- Array(instance['headers']).each do |header| -%> From 105e22c9cba819244bfc11a690a9eb8eebdf2e72 Mon Sep 17 00:00:00 2001 From: Mathew Beane Date: Tue, 13 Dec 2016 11:54:52 -0600 Subject: [PATCH 02/10] Updated httpd check to include several variables Added support for skip_event,check_certificate_expiration,days_warning,days_critical --- templates/agent-conf.d/http_check.yaml.erb | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/templates/agent-conf.d/http_check.yaml.erb b/templates/agent-conf.d/http_check.yaml.erb index 9b450f71..f34106dd 100644 --- a/templates/agent-conf.d/http_check.yaml.erb +++ b/templates/agent-conf.d/http_check.yaml.erb @@ -34,6 +34,15 @@ instances: <% 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: <%- Array(instance['headers']).each do |header| -%> From a08c2ebcaa659f7074c021f18a94ed03a6ac035b Mon Sep 17 00:00:00 2001 From: Mathew Beane Date: Tue, 13 Dec 2016 12:05:45 -0600 Subject: [PATCH 03/10] Updated puppet code for addition attributes. --- manifests/integrations/http_check.pp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/manifests/integrations/http_check.pp b/manifests/integrations/http_check.pp index 0230bf6c..a9a18df6 100644 --- a/manifests/integrations/http_check.pp +++ b/manifests/integrations/http_check.pp @@ -48,6 +48,26 @@ # problematic SSL server certificates. To maintain backwards # compatibility this defaults to false. # +# disable_ssl_validation +# The setting disable_ssl_validation parameter to true will instruct +# the http client to accept self signed, expired and otherwise +# 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 @@ -123,6 +143,10 @@ $include_content = false, $collect_response_time = true, $disable_ssl_validation = false, + $skip_events = undef, + $check_certificate_expiration = undef, + $days_warning = undef, + $days_critical = undef, $headers = [], $tags = [], $contact = [], @@ -143,6 +167,10 @@ 'include_content' => $include_content, 'collect_response_time' => $collect_response_time, 'disable_ssl_validation' => $disable_ssl_validation, + 'skip_events' => $skip_events, + 'check_certificate_expiration' => $check_certificate_expiration, + 'days_warning' => $days_warning, + 'days_critical' => $days_critical, 'headers' => $headers, 'tags' => $tags, 'contact' => $contact, From 437574427f5a73ef1c1848799bf8a3403f535349 Mon Sep 17 00:00:00 2001 From: Mathew Beane Date: Tue, 13 Dec 2016 12:07:04 -0600 Subject: [PATCH 04/10] Formatting fixes --- manifests/integrations/http_check.pp | 34 ++++++++++++---------------- 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/manifests/integrations/http_check.pp b/manifests/integrations/http_check.pp index a9a18df6..42f47f82 100644 --- a/manifests/integrations/http_check.pp +++ b/manifests/integrations/http_check.pp @@ -48,25 +48,21 @@ # problematic SSL server certificates. To maintain backwards # compatibility this defaults to false. # -# disable_ssl_validation -# The setting disable_ssl_validation parameter to true will instruct -# the http client to accept self signed, expired and otherwise -# 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 +# 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 From 892ebeac668c1f7dcdf0a2fcd66789542e26f0ba Mon Sep 17 00:00:00 2001 From: Mathew Beane Date: Tue, 13 Dec 2016 12:08:09 -0600 Subject: [PATCH 05/10] Deplurilazation --- manifests/integrations/http_check.pp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/manifests/integrations/http_check.pp b/manifests/integrations/http_check.pp index 42f47f82..7780d976 100644 --- a/manifests/integrations/http_check.pp +++ b/manifests/integrations/http_check.pp @@ -139,7 +139,7 @@ $include_content = false, $collect_response_time = true, $disable_ssl_validation = false, - $skip_events = undef, + $skip_event = undef, $check_certificate_expiration = undef, $days_warning = undef, $days_critical = undef, @@ -163,7 +163,7 @@ 'include_content' => $include_content, 'collect_response_time' => $collect_response_time, 'disable_ssl_validation' => $disable_ssl_validation, - 'skip_events' => $skip_events, + 'skip_event' => $skip_event, 'check_certificate_expiration' => $check_certificate_expiration, 'days_warning' => $days_warning, 'days_critical' => $days_critical, From e7f7af0949128c576f3f348be2031346c7fb4994 Mon Sep 17 00:00:00 2001 From: Mathew Beane Date: Tue, 13 Dec 2016 12:43:15 -0600 Subject: [PATCH 06/10] Update http_check.yaml.erb --- templates/agent-conf.d/http_check.yaml.erb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/templates/agent-conf.d/http_check.yaml.erb b/templates/agent-conf.d/http_check.yaml.erb index f34106dd..2081b29f 100644 --- a/templates/agent-conf.d/http_check.yaml.erb +++ b/templates/agent-conf.d/http_check.yaml.erb @@ -32,16 +32,16 @@ instances: disable_ssl_validation: <%= instance['disable_ssl_validation'] %> <% end -%> <% if instance['skip_event'] -%> - skip_event: <%= instance['skip_event'] %> + skip_event: <%= instance['skip_event'] %> <% end -%> <% if instance['check_certificate_expiration'] -%> - check_certificate_expiration: <%= instance['check_certificate_expiration'] %> + check_certificate_expiration: <%= instance['check_certificate_expiration'] %> <% end -%> <% if instance['days_warning'] -%> - days_warning: <%= instance['days_warning'] %> + days_warning: <%= instance['days_warning'] %> <% end -%> <% if instance['days_critical'] -%> - days_critical: <%= instance['days_critical'] %> + days_critical: <%= instance['days_critical'] %> <% end -%> <% if instance['headers'] and ! instance['headers'].empty? -%> headers: From a11dd8f3b1b2376c8369d5a4b45a68a3136ff111 Mon Sep 17 00:00:00 2001 From: Mathew Beane Date: Tue, 13 Dec 2016 12:53:01 -0600 Subject: [PATCH 07/10] Added Spec for http_check additions --- .../classes/datadog_agent_integrations_http_check_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/spec/classes/datadog_agent_integrations_http_check_spec.rb b/spec/classes/datadog_agent_integrations_http_check_spec.rb index df03f9a5..774f1ed5 100644 --- a/spec/classes/datadog_agent_integrations_http_check_spec.rb +++ b/spec/classes/datadog_agent_integrations_http_check_spec.rb @@ -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 @@ -62,6 +66,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 From b814e8ccec1a74c1579f0d82b25b471c4a1afc65 Mon Sep 17 00:00:00 2001 From: Mathew Beane Date: Wed, 14 Dec 2016 08:48:21 -0600 Subject: [PATCH 08/10] Update datadog_agent_integrations_http_check_spec.rb --- spec/classes/datadog_agent_integrations_http_check_spec.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spec/classes/datadog_agent_integrations_http_check_spec.rb b/spec/classes/datadog_agent_integrations_http_check_spec.rb index 774f1ed5..99287b46 100644 --- a/spec/classes/datadog_agent_integrations_http_check_spec.rb +++ b/spec/classes/datadog_agent_integrations_http_check_spec.rb @@ -53,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}) } From 50f379606219bade773031d1d95ae71bc27ffef6 Mon Sep 17 00:00:00 2001 From: Mathew Beane Date: Wed, 14 Dec 2016 08:49:14 -0600 Subject: [PATCH 09/10] 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 2081b29f..8c596ccb 100644 --- a/templates/agent-conf.d/http_check.yaml.erb +++ b/templates/agent-conf.d/http_check.yaml.erb @@ -29,7 +29,7 @@ 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'] %> From 495353fc3465eedcddc6147ab97a0fa92eede1ce Mon Sep 17 00:00:00 2001 From: Mathew Beane Date: Wed, 14 Dec 2016 09:09:32 -0600 Subject: [PATCH 10/10] Fixed trailing whitespace issue --- manifests/integrations/http_check.pp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/manifests/integrations/http_check.pp b/manifests/integrations/http_check.pp index 7780d976..6f693cdb 100644 --- a/manifests/integrations/http_check.pp +++ b/manifests/integrations/http_check.pp @@ -163,10 +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, + 'skip_event' => $skip_event, + 'check_certificate_expiration' => $check_certificate_expiration, + 'days_warning' => $days_warning, + 'days_critical' => $days_critical, 'headers' => $headers, 'tags' => $tags, 'contact' => $contact,