Skip to main content

HTTP

This check performs queries on HTTP endpoints, and HTTP Namespaces to monitor their activity.

http-check.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: http-check
spec:
interval: 30
http:
- name: http pass response 200 status code
endpoint: https://httpbin.demo.aws.flanksource.com/status/200
thresholdMillis: 3000
responseCodes: [201, 200, 301]
maxSSLExpiry: 7
FieldDescriptionSchemeRequired
urlstringYes
endpointDeprecated, Use url instreadstring
methodHTTP Request method, default to GETstring
headersHeader fields to be used in the query[]EnvVar
bodyRequest Body Contentsstring
templateBodyIf true the body field will be templated using go templates these variables will be availableboo;
responseCodesExpected response codes for the HTTP Request.[]int
responseContentExact response content expected to be returned by the endpoint.string
thresholdMillisMaximum duration in milliseconds for the HTTP request. It will fail the check if it takes longer.int
maxSSLExpiryMaximum number of days until the SSL Certificate expires.int
*All other common fieldsCommon
Connection
connectionPath of existing connection e.g. connection://sftp/instance/ Mutually exclusive with username, passwordConnection
usernameMutually exclusive with connectionEnvVar
passwordMutually exclusive with connectionEnvVar
urlHTTP URL, if a URL is specified on both the connection and check, the url on the check takes precedence.stringYes
ntlmWhen true will do authentication using NTLM v1 protocolbool
ntlmv2When true will do authentication using NTLM v2 protocolbool

Result Variables

Result variables can be used in test, display and transform scripts

NameDescriptionScheme
codeHTTP response codeint
headersHTTP response headersmap[string]string
elapsedHTTP Request durationtime.Duration
sslAgeTime until SSL certificate expirestime.Duration
contentHTTP Response bodystring
jsonIf `Content-Type=application/json response body converted into JSON objectJSON

The above canary (http-check.yaml) is functionally equivalent to http-check-expr.yaml below

http-check-expr.yaml
apiVersion: canaries.flanksource.com/v1
kind: Canary
metadata:
name: http-check-expr
spec:
interval: 30
http:
- name: http pass response 200 status code
endpoint: https://httpbin.demo.aws.flanksource.com/status/200
test:
expr: "code in [200,201,301] and sslAge > Duration('7d')"

Template Body Variables

NameScheme
metadata.namestring
metadata.metadata.namespacestring
metadata.labelsmap[string]string

Metrics

HTTP Check Metrics
canary_check_http_response_status{status, statusClass, url}CounterResponse code counter for each endpoint
canary_check_http_ssl_expiry{url}Guage

Status class is one of 1xx, 2xx, 3xx, 4xx, 5xx