Skip to main content

probe.http

HTTP probing allows you to monitor the availability and responsiveness of web services by sending HTTP requests and evaluating the responses.

Arguments

You can use the following arguments with probe.http:

NameTypeDescriptionDefaultRequired
scrape_intervaldurationInterval at which targets should be probed.1mno
targetslist(object)List of HTTP targets to probe. See target arguments below.no
target_fromreferenceReference to a discovery configuration to load targets from.no
forward_tolist(reference)List of exporter references to send metrics to.yes

Target Arguments

NameTypeDescriptionDefaultRequired
urlstringHTTP URL to probe.yes
methodstringHTTP method to use (GET, POST, etc.).GETno
expected_status_codeintegerExpected HTTP status code for successful probe.200no
timeout_secintegerTimeout in seconds for the HTTP request.15no
headersmap(string)Custom HTTP headers to send with the request.no
labelsmap(string)Labels to attach to this target.no
authobjectAuthentication configuration (see auth block below).no
scrape_intervaldurationOverride global scrape interval for this target.1mno
follow_redirectbooleanWhether to follow HTTP redirects.falseno
skip_tlsbooleanSkip TLS certificate validation.falseno

Auth Block

NameTypeDescriptionDefaultRequired
usernamestringUsername for basic authentication.no
passwordstringPassword for basic authentication.no
bearerstringBearer token for authentication.no

Example

Plain text configuration

probe "http" "google_check" {
scrape_interval = "30s"
targets = [
{
url = "https://www.google.com"
method = "GET"
expected_status_code = 200
labels = {
service = "google"
env = "test"
}
}
]

forward_to = [exporter.otlp.otlp]
}

From a JSON file

discovery "file" "json_targets" {
path = ["./targets.json"]
}

probe "http" "test" {
target_from = discovery.file.json_targets
forward_to = [exporter.otlp.otlp]
}

Resources