Skip to content

Commit 3060fe6

Browse files
author
Cristian Juve
committed
Add content_match argument in http_checks integration
1 parent 06bc227 commit 3060fe6

2 files changed

Lines changed: 15 additions & 0 deletions

File tree

manifests/integrations/http_check.pp

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,15 @@
1717
# alerts only if the check fails x times within the last y attempts
1818
# where x is the threshold and y is the window.
1919
#
20+
# content_match
21+
# The (optional) content_match parameter will allow the check
22+
# to look for a particular string within the response. The check
23+
# will report as DOWN if the string is not found.
24+
# content_match uses Python regular expressions which means that
25+
# you will have to escape the following "special" characters with
26+
# a backslash (\) if you're trying to match them in your content:
27+
# . ^ $ * + ? { } [ ] \ | ( )
28+
#
2029
# include_content
2130
# The (optional) collect_response_time parameter will instruct the
2231
# check to create a metric 'network.http.response_time', tagged with
@@ -69,6 +78,7 @@
6978
# timeout => 5,
7079
# threshold => 1,
7180
# window => 1,
81+
# content_match => '^(Bread|Apples) float(s)? in water'
7282
# include_content => true,
7383
# collect_response_time => true,
7484
# contact => 'pagerduty',
@@ -84,6 +94,7 @@
8494
$timeout = 1,
8595
$threshold = undef,
8696
$window = undef,
97+
$content_match = undef,
8798
$include_content = false,
8899
$collect_response_time = true,
89100
$disable_ssl_validation = false,
@@ -103,6 +114,7 @@
103114
'timeout' => $timeout,
104115
'threshold' => $threshold,
105116
'window' => $window,
117+
'content_match' => $content_match,
106118
'include_content' => $include_content,
107119
'collect_response_time' => $collect_response_time,
108120
'disable_ssl_validation' => $disable_ssl_validation,

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@ instances:
1919
<% if instance['window'] -%>
2020
window: <%= instance['window'] %>
2121
<% end -%>
22+
<% if instance['content_match'] -%>
23+
content_match: <%= instance['content_match'] %>
24+
<% end -%>
2225
<% if instance['include_content'] -%>
2326
include_content: <%= instance['include_content'] %>
2427
<% end -%>

0 commit comments

Comments
 (0)