Getting Started with the Agent
Monitor the up/down status of local or remote HTTP endpoints. The HTTP check can detect bad response codes (e.g. 404), identify soon-to-expire SSL certificates, search responses for specific text, and much more. The check also submits HTTP response times as a metric.
The HTTP check is packaged with the Agent, so simply install the Agent on any host from which you want to probe your HTTP sites. Though many metrics-oriented checks are best run on the same host(s) as the monitored service, you may want to run this status-oriented check from hosts that do not run the monitored sites.
If you need the newest version of the HTTP check, install the
dd-check-http package; this package’s check will override the one packaged with the Agent. See the integrations-core repository for more details.
Create a file
http_check.yaml in the Agent’s
conf.d directory. See the sample http_check.yaml for all available configuration options:
init_config: instances: - name: Example website url: https://example.com/ # disable_ssl_validation: false # default is true, so set false to check SSL validation # ca_certs: /path/to/ca/file # e.g. /etc/ssl/certs/ca-certificates.crt # check_certificate_expiration: true # default is true # days_warning: 28 # default 14 # days_critical: 14 # default 7 # timeout: 3 # in seconds. Default is 1. skip_event: true # Default is false, i.e. emit events instead of service checks. Recommend to set to true. - name: Example website (staging) url: http://staging.example.com/ skip_event: true
The HTTP check has more configuration options than many checks — many more than are shown above. Most options are opt-in, e.g. the Agent will not check SSL validation unless you configure the requisite options. Notably, the Agent will check for soon-to-expire SSL certificates by default.
See the sample http_check.yaml for a full list and description of available options, here is a list of them:
|The URL to test.|
|The time in seconds to allow for a response.|
|The HTTP method. This setting defaults to GET, though many other HTTP methods are supported, including POST and PUT.|
|The data option is only available when using the POST method. Data should be included as key-value pairs and will be sent in the body of the request.|
|A string or Python regular expression. The HTTP check will search for this value in the response and will report as DOWN if the string or expression is not found.|
|When true, reverses the behavior of the |
|If your service uses basic authentication, you can provide the username and password here.|
|A string or Python regular expression for an HTTP status code. This check will report DOWN for any status code that does not match. This defaults to 1xx, 2xx and 3xx HTTP status codes. For example: |
|When set to |
|By default, the check will collect the response time (in seconds) as the metric |
|This setting will skip SSL certificate validation and is enabled by default. If you require SSL certificate validation, set this to |
|When SSL certificate validation is enabled (see setting above), this setting will allow you to disable security warnings.|
|This setting will allow you to override the default certificate path as specified in |
|This parameter allows you to send additional headers with the request. Please see the example YAML file for additional information and caveats.|
|When enabled, the check will not create an event. This is useful to avoid duplicates with a server side service check. This defaults to |
|If set, the check will bypass proxy settings and attempt to reach the check url directly. This defaults to |
|This setting allows the service check to follow HTTP redirects and defaults to |
|A list of arbitrary tags that will be associated with the check. For more information about tags, please see our Guide to tagging and blog post, The power of tagged metrics|
When you have finished configuring
http_check.yaml, restart the Agent to begin sending HTTP service checks and response times to Datadog.
Run the Agent’s
info subcommand and look for
http_check under the Checks section:
Checks ====== [...] http_check ---------- - instance #0 [WARNING] Warning: Skipping SSL certificate validation for https://example.com based on configuration - instance #1 [OK] - Collected 2 metrics, 0 events & 4 service checks [...]
The http_check check is compatible with all major platforms.
|The response time of an HTTP request to a given url, tagged by url, e.g. 'url:http://example.com'.|
shown as second
|Days until SSL certificate expiration|
shown as day
Older versions of the HTTP check only emitted events to reflect site status, but now the check supports service checks, too. However, emitting events is still the default behavior. Set
skip_event to true for all configured instances to submit service checks instead of events.
The Agent will soon deprecate
skip_event, i.e. the HTTP check will only support service checks.
To create alert conditions on these service checks in Datadog, select ‘Network’ on the Create Monitor page, not ‘Integration’.
DOWN when any of the following occur:
reverse_content_matchis true and the response body does contain the pattern in
disable_ssl_validationis false, and the SSL connection cannot be validated
The check returns:
uri’s certificate has already expired
uri’s certificate expires in less than
uri’s certificate expires in less than
To disable this check, set
check_certificate_expiration to false.
Need help? Contact Datadog Support.
Learn more about infrastructure monitoring and all our integrations on our blog