From 92827cfe75a99f61fd6be3bed8824f0e3a1659ba Mon Sep 17 00:00:00 2001 From: Scott Enriquez Date: Tue, 8 Nov 2016 16:08:00 -0500 Subject: [PATCH 1/3] set disable_ssl_validation parameter if instances are declared in the main manifest --- manifests/integrations/http_check.pp | 27 +++++++++++++++++++++- templates/agent-conf.d/http_check.yaml.erb | 4 ++++ 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/manifests/integrations/http_check.pp b/manifests/integrations/http_check.pp index 394d9509..4c76526c 100644 --- a/manifests/integrations/http_check.pp +++ b/manifests/integrations/http_check.pp @@ -3,8 +3,14 @@ # This class will install the necessary config to hook the http_check in the agent # # Parameters: +# sitename +# (Required) The name of the instance. +# # url +# (Required) The url to check. +# # timeout +# The (optional) timeout in seconds. # # username # password @@ -57,9 +63,12 @@ # a list of users to notify within the service configuration. # # tags +# The (optional) tags to add to the check instance. # # Sample Usage: # +# Add a class for each check instance: +# # class { 'datadog_agent::integrations::http_check': # sitename => 'google', # url => 'http://www.google.com/', @@ -86,6 +95,22 @@ # } # # +# Add multiple instances in one class declaration: +# +# class { 'datadog_agent::integrations::http_check': +# instances => [{ +# 'sitename' => 'google', +# 'url' => 'http://www.google.com', +# }, +# { +# 'sitename' => 'local', +# 'url' => 'http://localhost/', +# 'headers' => ['Host: stan.borbat.com', 'DNT: true'], +# 'tags' => ['production', 'wordpress'] +# }] +# } + + class datadog_agent::integrations::http_check ( $sitename = undef, $url = undef, @@ -117,7 +142,7 @@ 'content_match' => $content_match, 'include_content' => $include_content, 'collect_response_time' => $collect_response_time, - 'disable_ssl_validation' => $disable_ssl_validation, + 'disable_ssl_validation' => $disable_ssl_validation, 'headers' => $headers, 'tags' => $tags, 'contact' => $contact, diff --git a/templates/agent-conf.d/http_check.yaml.erb b/templates/agent-conf.d/http_check.yaml.erb index 512018b2..b12dc7ae 100644 --- a/templates/agent-conf.d/http_check.yaml.erb +++ b/templates/agent-conf.d/http_check.yaml.erb @@ -28,7 +28,11 @@ instances: <% if instance['collect_response_time'] -%> collect_response_time: <%= instance['collect_response_time'] %> <% end -%> +<% if instance['disable_ssl_validation'] -%> disable_ssl_validation: <%= instance['disable_ssl_validation'] %> +<% else %> + disable_ssl_validation: false +<% end -%> <% if instance['headers'] and ! instance['headers'].empty? -%> headers: <%- Array(instance['headers']).each do |header| -%> From 130f5f08b69c3643274eaef7e1b8b27060d88c01 Mon Sep 17 00:00:00 2001 From: Scott Enriquez Date: Mon, 14 Nov 2016 17:00:33 -0500 Subject: [PATCH 2/3] default to true for disable_ssl_validation when defining the instance in manifest --- templates/agent-conf.d/http_check.yaml.erb | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/templates/agent-conf.d/http_check.yaml.erb b/templates/agent-conf.d/http_check.yaml.erb index b12dc7ae..78529bff 100644 --- a/templates/agent-conf.d/http_check.yaml.erb +++ b/templates/agent-conf.d/http_check.yaml.erb @@ -29,9 +29,7 @@ instances: collect_response_time: <%= instance['collect_response_time'] %> <% end -%> <% if instance['disable_ssl_validation'] -%> - disable_ssl_validation: <%= instance['disable_ssl_validation'] %> -<% else %> - disable_ssl_validation: false + disable_ssl_validation: <%= instance['disable_ssl_validation'] %> <% end -%> <% if instance['headers'] and ! instance['headers'].empty? -%> headers: From 59c2f03d903dcfefe4e877f3a0175198d5df3545 Mon Sep 17 00:00:00 2001 From: Scott Enriquez Date: Mon, 14 Nov 2016 17:04:37 -0500 Subject: [PATCH 3/3] fix indentation --- manifests/integrations/http_check.pp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/manifests/integrations/http_check.pp b/manifests/integrations/http_check.pp index 4c76526c..0230bf6c 100644 --- a/manifests/integrations/http_check.pp +++ b/manifests/integrations/http_check.pp @@ -104,9 +104,9 @@ # }, # { # 'sitename' => 'local', -# 'url' => 'http://localhost/', -# 'headers' => ['Host: stan.borbat.com', 'DNT: true'], -# 'tags' => ['production', 'wordpress'] +# 'url' => 'http://localhost/', +# 'headers' => ['Host: stan.borbat.com', 'DNT: true'], +# 'tags' => ['production', 'wordpress'] # }] # }