Skip to content

Commit c0da53b

Browse files
aepodtruthbk
authored andcommitted
Updated httpd_check to include new attributes. (DataDog#276)
* Update http_check.yaml.erb * Updated httpd check to include several variables Added support for skip_event,check_certificate_expiration,days_warning,days_critical * Updated puppet code for addition attributes. * Formatting fixes * Deplurilazation * Update http_check.yaml.erb * Added Spec for http_check additions * Update datadog_agent_integrations_http_check_spec.rb * Update http_check.yaml.erb * Fixed trailing whitespace issue
1 parent 0795d36 commit c0da53b

3 files changed

Lines changed: 49 additions & 1 deletion

File tree

manifests/integrations/http_check.pp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,22 @@
4848
# problematic SSL server certificates. To maintain backwards
4949
# compatibility this defaults to false.
5050
#
51+
# skip_event
52+
# The (optional) skip_event parameter will instruct the check to not
53+
# create any event to avoid duplicates with a server side service check.
54+
# This default to False.
55+
#
56+
# check_certificate_expiration
57+
# days_warning
58+
# days_critical
59+
# The (optional) check_certificate_expiration will instruct the check
60+
# to create a service check that checks the expiration of the
61+
# ssl certificate. Allow for a warning to occur when x days are
62+
# left in the certificate, and alternatively raise a critical
63+
# warning if the certificate is y days from the expiration date.
64+
# The SSL certificate will always be validated for this additional
65+
# service check regardless of the value of disable_ssl_validation
66+
#
5167
# headers
5268
# The (optional) headers parameter allows you to send extra headers
5369
# with the request. This is useful for explicitly specifying the host
@@ -123,6 +139,10 @@
123139
$include_content = false,
124140
$collect_response_time = true,
125141
$disable_ssl_validation = false,
142+
$skip_event = undef,
143+
$check_certificate_expiration = undef,
144+
$days_warning = undef,
145+
$days_critical = undef,
126146
$headers = [],
127147
$tags = [],
128148
$contact = [],
@@ -143,6 +163,10 @@
143163
'include_content' => $include_content,
144164
'collect_response_time' => $collect_response_time,
145165
'disable_ssl_validation' => $disable_ssl_validation,
166+
'skip_event' => $skip_event,
167+
'check_certificate_expiration' => $check_certificate_expiration,
168+
'days_warning' => $days_warning,
169+
'days_critical' => $days_critical,
146170
'headers' => $headers,
147171
'tags' => $tags,
148172
'contact' => $contact,

spec/classes/datadog_agent_integrations_http_check_spec.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@
3232
it { should contain_file(conf_file).without_content(%r{include_content: true}) }
3333
it { should contain_file(conf_file).without_content(%r{collect_response_time: true}) }
3434
it { should contain_file(conf_file).without_content(%r{disable_ssl_validation: false}) }
35+
it { should contain_file(conf_file).without_content(%r{skip_event: }) }
36+
it { should contain_file(conf_file).without_content(%r{check_certificate_expiration: }) }
37+
it { should contain_file(conf_file).without_content(%r{days_warning: }) }
38+
it { should contain_file(conf_file).without_content(%r{days_critical: }) }
3539
it { should contain_file(conf_file).without_content(%r{headers: }) }
3640
it { should contain_file(conf_file).without_content(%r{tags: }) }
3741
end
@@ -49,6 +53,10 @@
4953
include_content: true,
5054
collect_response_time: false,
5155
disable_ssl_validation: true,
56+
skip_event: true,
57+
check_certificate_expiration: true,
58+
days_warning: 14,
59+
days_critical: 7,
5260
}}
5361

5462
it { should contain_file(conf_file).with_content(%r{name: foo.bar.baz}) }
@@ -62,6 +70,10 @@
6270
it { should contain_file(conf_file).with_content(%r{include_content: true}) }
6371
it { should contain_file(conf_file).without_content(%r{collect_response_time: true}) }
6472
it { should contain_file(conf_file).with_content(%r{disable_ssl_validation: true}) }
73+
it { should contain_file(conf_file).with_content(%r{skip_event: true}) }
74+
it { should contain_file(conf_file).with_content(%r{check_certificate_expiration: true}) }
75+
it { should contain_file(conf_file).with_content(%r{days_warning: 14}) }
76+
it { should contain_file(conf_file).with_content(%r{days_critical: 7}) }
6577
end
6678

6779
context 'with headers parameter array' do

templates/agent-conf.d/http_check.yaml.erb

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,19 @@ instances:
2929
collect_response_time: <%= instance['collect_response_time'] %>
3030
<% end -%>
3131
<% if instance['disable_ssl_validation'] -%>
32-
disable_ssl_validation: <%= instance['disable_ssl_validation'] %>
32+
disable_ssl_validation: <%= instance['disable_ssl_validation'] %>
33+
<% end -%>
34+
<% if instance['skip_event'] -%>
35+
skip_event: <%= instance['skip_event'] %>
36+
<% end -%>
37+
<% if instance['check_certificate_expiration'] -%>
38+
check_certificate_expiration: <%= instance['check_certificate_expiration'] %>
39+
<% end -%>
40+
<% if instance['days_warning'] -%>
41+
days_warning: <%= instance['days_warning'] %>
42+
<% end -%>
43+
<% if instance['days_critical'] -%>
44+
days_critical: <%= instance['days_critical'] %>
3345
<% end -%>
3446
<% if instance['headers'] and ! instance['headers'].empty? -%>
3547
headers:

0 commit comments

Comments
 (0)