From b43f3ec28634b28776ca68b21f444a6a3875ccfe Mon Sep 17 00:00:00 2001
From: owl Healthcheck library for OpenResty. Some notes on the usage of this library:
+
+
+ Some notes on the usage of this library: Each target will have 4 counters, 1 success counter and 3 failure
-counters (‘http’, ‘tcp’, and ‘timeout’). Any failure will only reset the
-success counter, but a success will reset all three failure counters. All targets are uniquely identified by their IP address and port number
-combination, most functions take those as arguments. All keys in the SHM will be namespaced by the healthchecker name as
-provided to the new function. Hence no collissions will occur on shm-keys
-as long as the Active healthchecks will be synchronized across workers, such that only
-a single active healthcheck runs. Events will be raised in every worker, see lua-resty-worker-events
-for details. Each target will have 4 counters, 1 success counter and 3 failure
+ counters ('http', 'tcp', and 'timeout'). Any failure will only reset the
+ success counter, but a success will reset all three failure counters. All targets are uniquely identified by their IP address and port number
+ combination, most functions take those as arguments. All keys in the SHM will be namespaced by the healthchecker name as
+ provided to the new function. Hence no collissions will occur on shm-keys
+ as long as the Active healthchecks will be synchronized across workers, such that only
+ a single active healthcheck runs. Events will be raised in every worker, see lua-resty-worker-events
+ for details.Topics
Module
resty.healthcheck
-
-
name
is unique.name
is unique.
The function call itself is wrapped with pcall to protect against +
The function call itself is wrapped with pcall to protect against exception.
Acquire a lock and run a function
-The function call itself is wrapped with pcall to protect against +
Acquire a lock and run a function
+ +The function call itself is wrapped with pcall to protect against exception.
This function exhibits some special behavior when called during a
non-yieldable phase such as init_worker
or log
:
resty.lock
does not
-attempt to sleep/yield"scheduled"
resty.lock
does not
+ attempt to sleep/yield"scheduled"
unhealthy.tcp_failures
(for TCP failures) or unhealthy.http_failures
is set to zero in the configuration, this function is a no-op
and returns true
.
@@ -475,7 +478,7 @@ healthy.successes
is set to zero in the configuration,
this function is a no-op and returns true
.
@@ -557,7 +560,7 @@ NOTE: the returned checker
object must be anchored, if not it will be
- removed by Lua’s garbage collector and the healthchecks will cease to run.
+ removed by Lua's garbage collector and the healthchecks will cease to run.
name
: name of the health checkershm_name
: the name of the lua_shared_dict
specified in the Nginx configuration to usessl_cert
: certificate for mTLS connections (string or parsed object)ssl_key
: key for mTLS connections (string or parsed object)checks.active.type
: “http”, “https” or “tcp” (default is “http”)checks.active.timeout
: socket timeout for active checks (in seconds)checks.active.concurrency
: number of targets to check concurrentlychecks.active.http_path
: path to use in GET
HTTP request to run on active checkschecks.active.https_sni
: SNI server name incase of HTTPSchecks.active.https_verify_certificate
: boolean indicating whether to verify the HTTPS certificatechecks.active.headers
: one or more lists of values indexed by header namechecks.active.healthy.interval
: interval between checks for healthy targets (in seconds)checks.active.healthy.http_statuses
: which HTTP statuses to consider a successchecks.active.healthy.successes
: number of successes to consider a target healthychecks.active.unhealthy.interval
: interval between checks for unhealthy targets (in seconds)checks.active.unhealthy.http_statuses
: which HTTP statuses to consider a failurechecks.active.unhealthy.tcp_failures
: number of TCP failures to consider a target unhealthychecks.active.unhealthy.timeouts
: number of timeouts to consider a target unhealthychecks.active.unhealthy.http_failures
: number of HTTP failures to consider a target unhealthychecks.passive.type
: “http”, “https” or “tcp” (default is “http”; for passive checks, “http” and “https” are equivalent)checks.passive.healthy.http_statuses
: which HTTP statuses to consider a failurechecks.passive.healthy.successes
: number of successes to consider a target healthychecks.passive.unhealthy.http_statuses
: which HTTP statuses to consider a successchecks.passive.unhealthy.tcp_failures
: number of TCP failures to consider a target unhealthychecks.passive.unhealthy.timeouts
: number of timeouts to consider a target unhealthychecks.passive.unhealthy.http_failures
: number of HTTP failures to consider a target unhealthyname
: name of the health checkershm_name
: the name of the lua_shared_dict
specified in the Nginx configuration to usessl_cert
: certificate for mTLS connections (string or parsed object)ssl_key
: key for mTLS connections (string or parsed object)checks.active.type
: "http", "https" or "tcp" (default is "http")checks.active.timeout
: socket timeout for active checks (in seconds)checks.active.concurrency
: number of targets to check concurrentlychecks.active.http_path
: path to use in GET
HTTP request to run on active checkschecks.active.https_sni
: SNI server name incase of HTTPSchecks.active.https_verify_certificate
: boolean indicating whether to verify the HTTPS certificatechecks.active.headers
: one or more lists of values indexed by header namechecks.active.healthy.interval
: interval between checks for healthy targets (in seconds)checks.active.healthy.http_statuses
: which HTTP statuses to consider a successchecks.active.healthy.successes
: number of successes to consider a target healthychecks.active.unhealthy.interval
: interval between checks for unhealthy targets (in seconds)checks.active.unhealthy.http_statuses
: which HTTP statuses to consider a failurechecks.active.unhealthy.tcp_failures
: number of TCP failures to consider a target unhealthychecks.active.unhealthy.timeouts
: number of timeouts to consider a target unhealthychecks.active.unhealthy.http_failures
: number of HTTP failures to consider a target unhealthychecks.passive.type
: "http", "https" or "tcp" (default is "http"; for passive checks, "http" and "https" are equivalent)checks.passive.healthy.http_statuses
: which HTTP statuses to consider a failurechecks.passive.healthy.successes
: number of successes to consider a target healthychecks.passive.unhealthy.http_statuses
: which HTTP statuses to consider a successchecks.passive.unhealthy.tcp_failures
: number of TCP failures to consider a target unhealthychecks.passive.unhealthy.timeouts
: number of timeouts to consider a target unhealthychecks.passive.unhealthy.http_failures
: number of HTTP failures to consider a target unhealthy If any of the health counters above (e.g. checks.passive.unhealthy.timeouts
)
is set to zero, the according category of checks is not taken to account.
This way active or passive health checks can be disabled selectively.
@@ -830,7 +832,7 @@