http

Reference for the `http` collector.

http · collector · run nanook doc http for the same content in your terminal.

Performs an HTTP request and reports status, response code, and latency.

Options

OptionTypeDefaultDescription
urlstringrequired 🔒target URL
timeoutstring5srequest timeout (e.g. 5s, 30s)
successexprhttp.code between [200, 299]nanook-expr predicate over http.code and http.latency [nanook-expr]

Metrics

MetricKindUnitDescription
http.statusbooltrue if the request succeeded. Labels: url.
http.codenumericHTTP response code. Labels: url.
http.latencynumericsecondsrequest latency in seconds. Labels: url.

Examples

Health probe

[[collectors]]
name = "api"
kind = "http"
interval = 30
[collectors.opts]
url = "https://api.example.com/health"
timeout = 3000

Custom success predicate

[[collectors]]
name = "homepage"
kind = "http"
interval = 60
[collectors.opts]
url = "https://example.com"
success = "http.code between [200, 399]"

Slow endpoint

[[alerts]]
expr = "api::http.latency > 1s"
count = 3
channel = "ops"

Endpoint down

[[alerts]]
expr = 'api::http.status is "false"'
count = 2
channel = "ops"
escalate = { after = 300, channel = "oncall" }