Skip to main content

monitors

Creates, updates, deletes, gets or lists a monitors resource.

Overview

Namemonitors
TypeResource
Idcloudflare.load_balancers.monitors

Fields

The following fields are returned by SELECT queries:

Monitor Details response.

NameDatatypeDescription
idstring (example: f1aba936b94213e5b8dca0c0dbf1f9cc)
allow_insecurebooleanDo not validate the certificate when monitor use HTTPS. This parameter is currently only valid for HTTP and HTTPS monitors.
consecutive_downintegerTo be marked unhealthy the monitored origin must fail this healthcheck N consecutive times.
consecutive_upintegerTo be marked healthy the monitored origin must pass this healthcheck N consecutive times.
created_onstring (example: 2014-01-01T05:20:00.12345Z)
descriptionstringObject description. (default: , example: Login page monitor)
expected_bodystringA case-insensitive sub-string to look for in the response body. If this string is not found, the origin will be marked as unhealthy. This parameter is only valid for HTTP and HTTPS monitors. (default: , example: alive)
expected_codesstringThe expected HTTP response code or code range of the health check. This parameter is only valid for HTTP and HTTPS monitors. (default: , example: 2xx)
follow_redirectsbooleanFollow redirects if returned by the origin. This parameter is only valid for HTTP and HTTPS monitors.
headerobjectThe HTTP request headers to send in the health check. It is recommended you set a Host header by default. The User-Agent header cannot be overridden. This parameter is only valid for HTTP and HTTPS monitors.
intervalintegerThe interval between each health check. Shorter intervals may improve failover time, but will increase load on the origins as we check from multiple locations.
methodstringThe method to use for the health check. This defaults to 'GET' for HTTP/HTTPS based checks and 'connection_established' for TCP based health checks. (example: GET, x-stainless-terraform-configurability: computed_optional)
modified_onstring (example: 2014-01-01T05:20:00.12345Z)
pathstringThe endpoint path you want to conduct a health check against. This parameter is only valid for HTTP and HTTPS monitors. (example: /health, x-stainless-terraform-configurability: computed_optional)
portintegerThe port number to connect to for the health check. Required for TCP, UDP, and SMTP checks. HTTP and HTTPS checks should only define the port when using a non-standard port (HTTP: default 80, HTTPS: default 443). (x-stainless-terraform-configurability: optional)
probe_zonestringAssign this monitor to emulate the specified zone while probing. This parameter is only valid for HTTP and HTTPS monitors. (default: , example: example.com)
retriesintegerThe number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.
timeoutintegerThe timeout (in seconds) before marking the health check as failed.
typestringThe protocol to use for the health check. Currently supported protocols are 'HTTP','HTTPS', 'TCP', 'ICMP-PING', 'UDP-ICMP', and 'SMTP'. (http, https, tcp, udp_icmp, icmp_ping, smtp) (default: http, example: https)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
get_by_accountselectmonitor_id, account_idList a single configured monitor for an account.
list_by_accountselectaccount_idList configured monitors for an account.
get_by_userselectmonitor_idList a single configured monitor for a user.
list_by_userselectList configured monitors for a user.
createinsertaccount_idCreate a configured monitor.
load_balancer_monitors_create_monitorinsertCreate a configured monitor.
editupdatemonitor_id, account_idApply changes to an existing monitor, overwriting the supplied properties.
load_balancer_monitors_patch_monitorupdatemonitor_idApply changes to an existing monitor, overwriting the supplied properties.
updatereplacemonitor_id, account_idModify a configured monitor.
load_balancer_monitors_update_monitorreplacemonitor_idModify a configured monitor.
deletedeletemonitor_id, account_idDelete a configured monitor.
load_balancer_monitors_delete_monitordeletemonitor_idDelete a configured monitor.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
account_idstringThe Cloudflare account ID.
monitor_idstringThe Load Balancer monitor ID.

SELECT examples

List a single configured monitor for an account.

SELECT
id,
allow_insecure,
consecutive_down,
consecutive_up,
created_on,
description,
expected_body,
expected_codes,
follow_redirects,
header,
interval,
method,
modified_on,
path,
port,
probe_zone,
retries,
timeout,
type
FROM cloudflare.load_balancers.monitors
WHERE monitor_id = '{{ monitor_id }}' -- required
AND account_id = '{{ account_id }}' -- required
;

INSERT examples

Create a configured monitor.

INSERT INTO cloudflare.load_balancers.monitors (
allow_insecure,
consecutive_down,
consecutive_up,
description,
expected_body,
expected_codes,
follow_redirects,
header,
interval,
method,
path,
port,
probe_zone,
retries,
timeout,
type,
account_id
)
SELECT
{{ allow_insecure }},
{{ consecutive_down }},
{{ consecutive_up }},
'{{ description }}',
'{{ expected_body }}',
'{{ expected_codes }}',
{{ follow_redirects }},
'{{ header }}',
{{ interval }},
'{{ method }}',
'{{ path }}',
{{ port }},
'{{ probe_zone }}',
{{ retries }},
{{ timeout }},
'{{ type }}',
'{{ account_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Apply changes to an existing monitor, overwriting the supplied properties.

UPDATE cloudflare.load_balancers.monitors
SET
allow_insecure = {{ allow_insecure }},
consecutive_down = {{ consecutive_down }},
consecutive_up = {{ consecutive_up }},
description = '{{ description }}',
expected_body = '{{ expected_body }}',
expected_codes = '{{ expected_codes }}',
follow_redirects = {{ follow_redirects }},
header = '{{ header }}',
interval = {{ interval }},
method = '{{ method }}',
path = '{{ path }}',
port = {{ port }},
probe_zone = '{{ probe_zone }}',
retries = {{ retries }},
timeout = {{ timeout }},
type = '{{ type }}'
WHERE
monitor_id = '{{ monitor_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;

REPLACE examples

Modify a configured monitor.

REPLACE cloudflare.load_balancers.monitors
SET
allow_insecure = {{ allow_insecure }},
consecutive_down = {{ consecutive_down }},
consecutive_up = {{ consecutive_up }},
description = '{{ description }}',
expected_body = '{{ expected_body }}',
expected_codes = '{{ expected_codes }}',
follow_redirects = {{ follow_redirects }},
header = '{{ header }}',
interval = {{ interval }},
method = '{{ method }}',
path = '{{ path }}',
port = {{ port }},
probe_zone = '{{ probe_zone }}',
retries = {{ retries }},
timeout = {{ timeout }},
type = '{{ type }}'
WHERE
monitor_id = '{{ monitor_id }}' --required
AND account_id = '{{ account_id }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Delete a configured monitor.

DELETE FROM cloudflare.load_balancers.monitors
WHERE monitor_id = '{{ monitor_id }}' --required
AND account_id = '{{ account_id }}' --required
;