Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New http_check recipe+template #178

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions recipes/http_check.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
include_recipe 'datadog::dd-agent'

# Build a data structure with configuration.
# @see http://docs.datadoghq.com/guides/network_checks/
# @example
# node.override['datadog']['http_check']['instances'] = [
# {
# 'name' => 'MyHTTPcheck',
# 'url' => 'http://my.server/some/service',
# 'timeout' => '15',
# 'content_match' => 'string to match',
# 'include_content' => true,
# 'collect_response_time' => true,
# 'skip_event' => true,
# 'tags' => [
# 'myApp',
# 'serviceName'
# ]
# }
# ]
datadog_monitor 'http_check' do
instances node['datadog']['http_check']['instances']
end
36 changes: 4 additions & 32 deletions templates/default/http_check.yaml.erb
Original file line number Diff line number Diff line change
@@ -1,33 +1,5 @@
init_config:

# To notify on every service, set a list of notified uses here.
#
# notify:
# - user1@example.com
# - pagerduty

instances:
# - name: My first service
# url: http://some.url.example.com
# timeout: 1

# If your service uses basic authentication, you can optionally
# specify a username and password that will be used in the check.
# username: user
# password: pass
<%# Sanitize the compiled Mash to standard Array/Hash objects by way of JSON -%>
<%= JSON.parse(({ 'instances' => @instances }).to_json).to_yaml %>

# The (optional) window and threshold parameters allow you to trigger
# alerts only if the check fails x times within the last y attempts
# where x is the threshold and y is the window.

# threshold: 3
# window: 5

# - name: My second service
# url: https://another.url.example.com

# For service-specific notifications, you can optionally specify
# a list of users to notify within the service configuration.
# notify:
# - user2@example.com
# - pagerduty
init_config:
# Nothing to configure here