Docs » Integrations Guide » Use the Smart Agent » Monitors » http

http 🔗

Monitor Type: http (Source)

Accepts Endpoints: Yes

Multiple Instances Allowed: Yes

Overview 🔗

This monitor will generate metrics based on whether the HTTP responses from the configured URLs match expectations (e.g. correct body, status code, etc).

TLS information will automatically be fetched if applicable (from base URL or redirection).

The configuration will be applied to every requests URLs from configured list so you need to instance multiple times this monitor for different behavior on multiple URLs.

Configuration 🔗

To activate this monitor in the Smart Agent, add the following to your agent config:

monitors:  # All monitor config goes under this key
 - type: http
   ...  # Additional config

For a list of monitor options that are common to all monitors, see Common Configuration.

Config option Required Type Description
host no string Host/IP to monitor
port no integer Port of the HTTP server to monitor (default: 0)
path no string HTTP path to use in the test request
httpTimeout no int64 HTTP timeout duration for both read and writes. This should be a duration string that is accepted by https://golang.org/pkg/time/#ParseDuration (default: 10s)
username no string Basic Auth username to use on each request, if any.
password no string Basic Auth password to use on each request, if any.
useHTTPS no bool If true, the agent will connect to the server using HTTPS instead of plain HTTP. (default: false)
httpHeaders no map of strings A map of HTTP header names to values. Comma separated multiple values for the same message-header is supported.
skipVerify no bool If useHTTPS is true and this option is also true, the exporter's TLS cert will not be verified. (default: false)
caCertPath no string Path to the CA cert that has signed the TLS cert, unnecessary if skipVerify is set to false.
clientCertPath no string Path to the client TLS cert to use for TLS required connections
clientKeyPath no string Path to the client TLS key to use for TLS required connections
requestBody no string Optional HTTP request body as string like '{"foo":"bar"}'
noRedirects no bool Do not follow redirect. (default: false)
method no string HTTP request method to use. (default: GET)
urls no list of strings DEPRECATED: list of HTTP URLs to monitor. Use host/port/useHTTPS/path instead.
regex no string Optional Regex to match on URL(s) response(s).
desiredCode no integer Desired code to match for URL(s) response(s). (default: 200)

Metrics 🔗

These are the metrics available for this monitor. Metrics that are categorized as container/host (default) are in bold and italics in the list below.

  • http.cert_expiry (gauge)
    Certificate expiry in seconds. This metric is reported only if HTTPS is available (from last followed URL).
  • http.cert_valid (gauge)
    Value is 1 if certificate is valid (including expiration test) or 0 else. This metric is reported only if HTTPS is available (from last followed URL).
  • http.code_matched (gauge)
    Value is 1 if status_code value match desiredCode set in config. Always reported.
  • http.content_length (gauge)
    HTTP response body length. Always reported.
  • http.regex_matched (gauge)
    Value is 1 if pattern match in response body. Only reported if regex is configured.
  • http.response_time (gauge)
    HTTP response time in seconds. Always reported.
  • http.status_code (gauge)
    HTTP response status code. Always reported.

Non-default metrics (version 4.7.0+) 🔗

To emit metrics that are not default, you can add those metrics in the generic monitor-level extraMetrics config option. Metrics that are derived from specific configuration options that do not appear in the above list of metrics do not need to be added to extraMetrics.

To see a list of metrics that will be emitted you can run agent-status monitors after configuring this monitor in a running agent instance.

Dimensions 🔗

The following dimensions may occur on metrics emitted by this monitor. Some dimensions may be specific to certain metrics.

Name Description
method HTTP method used to do request. Not available on http.cert_* metrics.
original_url The original URL used in the configuration of this monitor. May differ from url if the URL responds with a redirect and noRedirects: false.
server_name ServerName used for TLS validation. Always and only available on http.cert_expiry metric.
url Last URL retrieved (after redirects) from configured one. Always available on every metrics.