Skip to main content

healthchecks

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

Overview

Namehealthchecks
TypeResource
Idcloudflare.zones.healthchecks

Fields

The following fields are returned by SELECT queries:

Health Check Details response.

NameDatatypeDescription
idstringIdentifier. (example: 023e105f4ecef8ad9ca31a8372d0c353)
namestringA short name to identify the health check. Only alphanumeric characters, hyphens and underscores are allowed. (example: server-1)
addressstringThe hostname or IP address of the origin server to run health checks on. (example: www.example.com)
check_regionsarrayA list of regions from which to run health checks. Null means Cloudflare will pick a default region.
consecutive_failsintegerThe number of consecutive fails required from a health check before changing the health to unhealthy.
consecutive_successesintegerThe number of consecutive successes required from a health check before changing the health to healthy.
created_onstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
descriptionstringA human-readable description of the health check. (example: Health check for www.example.com)
failure_reasonstringThe current failure reason if status is unhealthy. (example: )
http_configobjectParameters specific to an HTTP or HTTPS health check.
intervalintegerThe interval between each health check. Shorter intervals may give quicker notifications if the origin status changes, but will increase load on the origin as we check from multiple locations.
modified_onstring (date-time) (example: 2014-01-01T05:20:00.12345Z)
retriesintegerThe number of retries to attempt in case of a timeout before marking the origin as unhealthy. Retries are attempted immediately.
statusstringThe current status of the origin server according to the health check. (unknown, healthy, unhealthy, suspended) (example: healthy)
suspendedbooleanIf suspended, no health checks are sent to the origin.
tcp_configobjectParameters specific to TCP health check.
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' and 'TCP'. (default: HTTP, example: HTTPS)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselecthealthcheck_id, zone_idFetch a single configured health check.
listselectzone_idpage, per_pageList configured health checks.
smart_shield_create_health_checkinsertzone_id, name, addressCreate a new health check.
smart_shield_patch_health_checkupdatehealthcheck_id, zone_id, name, addressPatch a configured health check.
smart_shield_update_health_checkreplacehealthcheck_id, zone_id, success, errors, messages, resultUpdate a configured health check.
smart_shield_delete_health_checkdeletehealthcheck_id, zone_idDelete a health check.

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
healthcheck_idstring
zone_idstringThe Cloudflare zone ID.
pagenumberPage number of paginated results.
per_pagenumberMaximum number of results per page. Must be a multiple of 5.

SELECT examples

Fetch a single configured health check.

SELECT
id,
name,
address,
check_regions,
consecutive_fails,
consecutive_successes,
created_on,
description,
failure_reason,
http_config,
interval,
modified_on,
retries,
status,
suspended,
tcp_config,
timeout,
type
FROM cloudflare.zones.healthchecks
WHERE healthcheck_id = '{{ healthcheck_id }}' -- required
AND zone_id = '{{ zone_id }}' -- required
;

INSERT examples

Create a new health check.

INSERT INTO cloudflare.zones.healthchecks (
address,
check_regions,
consecutive_fails,
consecutive_successes,
description,
http_config,
interval,
name,
retries,
suspended,
tcp_config,
timeout,
type,
zone_id
)
SELECT
'{{ address }}' /* required */,
'{{ check_regions }}',
{{ consecutive_fails }},
{{ consecutive_successes }},
'{{ description }}',
'{{ http_config }}',
{{ interval }},
'{{ name }}' /* required */,
{{ retries }},
{{ suspended }},
'{{ tcp_config }}',
{{ timeout }},
'{{ type }}',
'{{ zone_id }}'
RETURNING
errors,
messages,
result,
success
;

UPDATE examples

Patch a configured health check.

UPDATE cloudflare.zones.healthchecks
SET
address = '{{ address }}',
check_regions = '{{ check_regions }}',
consecutive_fails = {{ consecutive_fails }},
consecutive_successes = {{ consecutive_successes }},
description = '{{ description }}',
http_config = '{{ http_config }}',
interval = {{ interval }},
name = '{{ name }}',
retries = {{ retries }},
suspended = {{ suspended }},
tcp_config = '{{ tcp_config }}',
timeout = {{ timeout }},
type = '{{ type }}'
WHERE
healthcheck_id = '{{ healthcheck_id }}' --required
AND zone_id = '{{ zone_id }}' --required
AND name = '{{ name }}' --required
AND address = '{{ address }}' --required
RETURNING
errors,
messages,
result,
success;

REPLACE examples

Update a configured health check.

REPLACE cloudflare.zones.healthchecks
SET
errors = '{{ errors }}',
messages = '{{ messages }}',
result = '{{ result }}',
success = {{ success }}
WHERE
healthcheck_id = '{{ healthcheck_id }}' --required
AND zone_id = '{{ zone_id }}' --required
AND success = {{ success }} --required
AND errors = '{{ errors }}' --required
AND messages = '{{ messages }}' --required
AND result = '{{ result }}' --required
RETURNING
errors,
messages,
result,
success;

DELETE examples

Delete a health check.

DELETE FROM cloudflare.zones.healthchecks
WHERE healthcheck_id = '{{ healthcheck_id }}' --required
AND zone_id = '{{ zone_id }}' --required
;