HTTP Check

Supported OS Linux Mac OS Windows

통합 버전11.0.0
이 페이지는 아직 한국어로 제공되지 않으며 번역 작업 중입니다. 번역에 관한 질문이나 의견이 있으시면 언제든지 저희에게 연락해 주십시오.

Overview

Monitor the up and down status of local or remote HTTP endpoints. The HTTP check can detect bad response codes (such as 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.

Setup

Installation

The HTTP check is included in the Datadog Agent package. No additional installation is needed on your server. 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.

Configuration

Edit the http_check.d/conf.yaml file, in the conf.d/ folder at the root of your Agent’s configuration directory. See the sample http_check.d/conf.yaml for all available configuration options:

init_config:

instances:
  - name: Example website
    url: https://example.com/

  - name: Example website (staging)
    url: http://staging.example.com/

The HTTP check has more configuration options than many checks. Most options are opt-in, for example: the Agent does not check SSL validation unless you configure the requisite options. Notably, the Agent checks for soon-to-expire SSL certificates by default.

This check runs on every run of the Agent collector, which defaults to every 15 seconds. To set a custom run frequency for this check, see the collection interval section of the custom check documentation.

See the sample http_check.d/conf.yaml for a full list and description of available options, here is a list of them:

SettingDescription
nameName of your Http check instance. This is presented as a tag on the Service Checks.
urlThe URL to test.
timeoutThe time in seconds to allow for a response. The default is 10.
methodThe HTTP method to use for the check.
dataUse this parameter to specify a body for a request with a POST, PUT, DELETE, or PATCH method. SOAP requests are supported if you use the POST method and supply an XML string as the data parameter.
headersThis parameter allows you to send additional headers with the request. See the example YAML file for additional information and caveats.
content_matchA string or Python regular expression. The HTTP check searches for this value in the response and reports as DOWN if the string or expression is not found.
reverse_content_matchWhen true, reverses the behavior of the content_match option, that is the HTTP check reports as DOWN if the string or expression in content_match IS found. (default is false)
username & passwordIf your service uses basic authentication, you can provide the username and password here.
http_response_status_codeA string or Python regular expression for an HTTP status code. This check reports DOWN for any status code that does not match. This defaults to 1xx, 2xx and 3xx HTTP status codes. For example: 401 or 4\d\d.
include_contentWhen set to true, the check includes the first 500 characters of the HTTP response body in notifications. The default value is false.
collect_response_timeBy default, the check collects the response time (in seconds) as the metric network.http.response_time. To disable, set this value to false.
tls_verifyInstructs the check to validate the TLS certificate of services when reaching to url.
tls_ignore_warningIf tls_verify is set to true, it disables any security warnings from the SSL connection.
tls_ca_certThis setting allows you to override the default certificate path as specified in init_config
check_certificate_expirationWhen check_certificate_expiration is enabled, the service check checks the expiration date of the SSL certificate. Note: This causes the SSL certificate to be validated, regardless of the value of the tls_verify setting.
tls_retrieve_non_validated_certIf tls_verify is set to false and if check_certificate_expiration is true, setting this to true allows the certificate to be examined for an expiration date.
days_warning & days_criticalWhen check_certificate_expiration is enabled, these settings raise a warning or critical alert when the SSL certificate is within the specified number of days from expiration.
ssl_server_nameWhen check_certificate_expiration is enabled, this setting specifies the hostname of the service to connect to and it also overrides the host to match with if check_hostname is enabled.
check_hostnameIf set to true the check log a warning if the checked url hostname is different than the SSL certificate hostname.
skip_proxyIf set, the check bypasses proxy settings and attempt to reach the check url directly. This defaults to false. This integration’s proxy settings default to the proxy settings defined in the datadog.yaml configuration file if this is not set.
allow_redirectsThis setting allows the service check to follow HTTP redirects and defaults to true.
tagsA list of arbitrary tags that are associated with the check. For more information about tags, see the Guide to tagging and blog post, The power of tagged metrics

When you have finished configuring http_check.d/conf.yaml, restart the Agent to begin sending HTTP service checks and response times to Datadog.

Validation

Run the Agent’s status subcommand and look for http_check under the Checks section.

Data Collected

Metrics

network.http.response_time
(gauge)
The response time of an HTTP request to a given url, tagged by url, e.g. 'url:http://example.com'.
Shown as second
network.http.can_connect
(gauge)
Whether the check can connect, 1 if true, 0 otherwise. Tagged by url, e.g. 'url:http://example.com'.
network.http.cant_connect
(gauge)
Whether the check failed to connect, 1 if true, 0 otherwise. Tagged by url, e.g. 'url:http://example.com'.
http.ssl.days_left
(gauge)
Days until SSL certificate expiration
Shown as day
http.ssl.seconds_left
(gauge)
Seconds until SSL certificate expiration
Shown as second

Events

The HTTP check does not include any events.

Service Checks

http.can_connect
Returns CRITICAL if the Agent cannot establish an HTTP connection to the URL. Returns OK if the connection is successful.
Statuses: ok, critical

http.ssl_cert
Returns CRITICAL if the SSL certificate has expired. Returns WARNING if the SSL certificate will expire in less than the configured threshold. Returns OK otherwise.
Statuses: ok, warning, critical, unknown

To disable http.ssl_cert, set check_certificate_expiration to false.

Note: To set an alert on these service checks, create a Network Monitor.

Troubleshooting

Need help? Contact Datadog support.

PREVIEWING: rtrieu/product-analytics-ui-changes