diff --git a/manifests/integrations/http_check.pp b/manifests/integrations/http_check.pp index 0230bf6c..6f693cdb 100644 --- a/manifests/integrations/http_check.pp +++ b/manifests/integrations/http_check.pp @@ -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 @@ -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 = [], @@ -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, diff --git a/spec/classes/datadog_agent_integrations_http_check_spec.rb b/spec/classes/datadog_agent_integrations_http_check_spec.rb index df03f9a5..99287b46 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 @@ -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}) } @@ -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 diff --git a/templates/agent-conf.d/http_check.yaml.erb b/templates/agent-conf.d/http_check.yaml.erb index 78529bff..8c596ccb 100644 --- a/templates/agent-conf.d/http_check.yaml.erb +++ b/templates/agent-conf.d/http_check.yaml.erb @@ -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: