Packages

Erlang/Elixir Cloud Framework Health Check CloudI Service

Current section

Files

Jump to
cloudi_service_health_check doc cloudi_service_health_check.html
Raw

doc/cloudi_service_health_check.html

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Module cloudi_service_health_check</title>
<link rel="stylesheet" type="text/css" href="stylesheet.css" title="EDoc">
</head>
<body bgcolor="white">
<div class="navbar"><a name="#navbar_top"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<hr>
<h1>Module cloudi_service_health_check</h1>
<ul class="index"><li><a href="#description">Description</a></li><li><a href="#types">Data Types</a></li><li><a href="#index">Function Index</a></li><li><a href="#functions">Function Details</a></li></ul>
<h3><a name="Health_Check_CloudI_Service">Health Check CloudI Service</a></h3><p>
Each interval, do a DNS lookup of a hostname (if a hostname was provided)
and check the health of each IP address.</p>.
<p>Copyright © 2022-2023 Michael Truog</p>
<p><b>Version:</b> 2.0.7 Oct 26 2023 14:01:42
------------------------------------------------------------------------</p>
<p><b>Behaviours:</b> <a href="deps/cloudi_core/doc/cloudi_service.html"><tt>cloudi_service</tt></a>.</p>
<p><b>Authors:</b> Michael Truog (<a href="mailto:mjtruog at protonmail dot com"><tt>mjtruog at protonmail dot com</tt></a>).</p>
<h2><a name="description">Description</a></h2>
<h3><a name="Health_Check_CloudI_Service">Health Check CloudI Service</a></h3><p>
Each interval, do a DNS lookup of a hostname (if a hostname was provided)
and check the health of each IP address.</p>
<p>Any DNS failure can have custom functions for the event with the
dns_failure function and/or the dns_restored function. The DNS failure
will only occur once for each hostname provided and old IP address
information will still be used for the health check.</p>
<p>The health check uses either a TCP port number or a single ping request
to each of the IP addresses associated with the hostname.
If any of the IP addresses had a failure the host's health_failed boolean
will be set to true. The availability and downtime of a host is based
on whether all IP addresses pass the health check.</p>
<p>Any TCP health check failure can have custom functions for the event with
the tcp_failure function and/or the tcp_restored function.
A tcp_test function custom function can be provided if the TCP socket
needs additional health check criteria.</p>
<p>Any ping health check failure can have custom functions for the event with
the ping failure function and/or the ping_restored function.</p>
<p>All _failure custom functions are provided with the failure Reason
as a parameter. All _restored custom functions are provided with
the native monotonic time when the failure occurred (TimeFailure) and
when the restore occurred (TimeRestored) to provide the event duration.</p>
A dns_ip_added function can be provided for execution when an IP address
is added after a successful DNS lookup response.
A dns_ip_removed_healthy function and/or a dns_ip_removed_failed function
can be provided for execution when an IP address is removed due to a
successful DNS lookup response. DNS-based load balancing may cause
excessive execution of these functions.
<h2><a name="types">Data Types</a></h2>
<h3 class="typedecl"><a name="type-dns_failure">dns_failure()</a></h3>
<p><tt>dns_failure() = fun((Name::<a href="#type-hostname">hostname()</a>, Reason::atom()) -&gt; ok)</tt></p>
<h3 class="typedecl"><a name="type-dns_ip_added">dns_ip_added()</a></h3>
<p><tt>dns_ip_added() = fun((Name::<a href="#type-hostname">hostname()</a>, IP::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/inet.html#type-ip_address">inet:ip_address()</a>) -&gt; ok)</tt></p>
<h3 class="typedecl"><a name="type-dns_ip_removed_failed">dns_ip_removed_failed()</a></h3>
<p><tt>dns_ip_removed_failed() = fun((Name::<a href="#type-hostname">hostname()</a>, IP::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/inet.html#type-ip_address">inet:ip_address()</a>, TimeFailure::<a href="deps/cloudi_core/doc/cloudi_timestamp.html#type-native_monotonic">cloudi_timestamp:native_monotonic()</a>, TimeRemoved::<a href="deps/cloudi_core/doc/cloudi_timestamp.html#type-native_monotonic">cloudi_timestamp:native_monotonic()</a>) -&gt; ok)</tt></p>
<h3 class="typedecl"><a name="type-dns_ip_removed_healthy">dns_ip_removed_healthy()</a></h3>
<p><tt>dns_ip_removed_healthy() = fun((Name::<a href="#type-hostname">hostname()</a>, IP::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/inet.html#type-ip_address">inet:ip_address()</a>) -&gt; ok)</tt></p>
<h3 class="typedecl"><a name="type-dns_restored">dns_restored()</a></h3>
<p><tt>dns_restored() = fun((Name::<a href="#type-hostname">hostname()</a>, TimeFailure::<a href="deps/cloudi_core/doc/cloudi_timestamp.html#type-native_monotonic">cloudi_timestamp:native_monotonic()</a>, TimeRestored::<a href="deps/cloudi_core/doc/cloudi_timestamp.html#type-native_monotonic">cloudi_timestamp:native_monotonic()</a>) -&gt; ok)</tt></p>
<h3 class="typedecl"><a name="type-hostname">hostname()</a></h3>
<p><tt>hostname() = nonempty_string()</tt></p>
<p> dns name or ip address</p>
<h3 class="typedecl"><a name="type-interval">interval()</a></h3>
<p><tt>interval() = 1..4294967</tt></p>
<h3 class="typedecl"><a name="type-ping_failure">ping_failure()</a></h3>
<p><tt>ping_failure() = fun((Name::<a href="#type-hostname">hostname()</a>, IP::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/inet.html#type-ip_address">inet:ip_address()</a>, Reason::string()) -&gt; ok)</tt></p>
<h3 class="typedecl"><a name="type-ping_restored">ping_restored()</a></h3>
<p><tt>ping_restored() = fun((Name::<a href="#type-hostname">hostname()</a>, IP::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/inet.html#type-ip_address">inet:ip_address()</a>, TimeFailure::<a href="deps/cloudi_core/doc/cloudi_timestamp.html#type-native_monotonic">cloudi_timestamp:native_monotonic()</a>, TimeRestored::<a href="deps/cloudi_core/doc/cloudi_timestamp.html#type-native_monotonic">cloudi_timestamp:native_monotonic()</a>) -&gt; ok)</tt></p>
<h3 class="typedecl"><a name="type-tcp_failure">tcp_failure()</a></h3>
<p><tt>tcp_failure() = fun((Name::<a href="#type-hostname">hostname()</a>, IP::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/inet.html#type-ip_address">inet:ip_address()</a>, Port::<a href="#type-tcp_port">tcp_port()</a>, Reason::any()) -&gt; ok)</tt></p>
<h3 class="typedecl"><a name="type-tcp_port">tcp_port()</a></h3>
<p><tt>tcp_port() = 1..65535</tt></p>
<h3 class="typedecl"><a name="type-tcp_restored">tcp_restored()</a></h3>
<p><tt>tcp_restored() = fun((Name::<a href="#type-hostname">hostname()</a>, IP::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/inet.html#type-ip_address">inet:ip_address()</a>, Port::<a href="#type-tcp_port">tcp_port()</a>, TimeFailure::<a href="deps/cloudi_core/doc/cloudi_timestamp.html#type-native_monotonic">cloudi_timestamp:native_monotonic()</a>, TimeRestored::<a href="deps/cloudi_core/doc/cloudi_timestamp.html#type-native_monotonic">cloudi_timestamp:native_monotonic()</a>) -&gt; ok)</tt></p>
<h3 class="typedecl"><a name="type-tcp_test">tcp_test()</a></h3>
<p><tt>tcp_test() = fun((Socket::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/gen_tcp.html#type-socket">gen_tcp:socket()</a>, Timeout::1..4294967295) -&gt; ok | {error, any()}) | fun((Name::<a href="#type-hostname">hostname()</a>, IP::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/inet.html#type-ip_address">inet:ip_address()</a>, Port::<a href="#type-tcp_port">tcp_port()</a>, Timeout::1..4294967295) -&gt; ok | {error, any()})</tt></p>
<h2><a name="index">Function Index</a></h2>
<table width="100%" border="1" cellspacing="0" cellpadding="2" summary="function index"><tr><td valign="top"><a href="#cloudi_service_handle_info-3">cloudi_service_handle_info/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#cloudi_service_handle_request-11">cloudi_service_handle_request/11</a></td><td></td></tr>
<tr><td valign="top"><a href="#cloudi_service_init-4">cloudi_service_init/4</a></td><td></td></tr>
<tr><td valign="top"><a href="#cloudi_service_terminate-3">cloudi_service_terminate/3</a></td><td></td></tr>
<tr><td valign="top"><a href="#tcp_test_http-3">tcp_test_http/3</a></td><td>
<h4><a name="HTTP_tcp_test_function.">HTTP tcp_test function.</a></h4>
Add as
{{cloudi_service_health_check, tcp_test_http, [Method, Path, StatusCode]}}
with values provided for Method, Path and StatusCode.</td></tr>
<tr><td valign="top"><a href="#tcp_test_https-3">tcp_test_https/3</a></td><td>
<h4><a name="HTTPS_tcp_test_function.">HTTPS tcp_test function.</a></h4>
Add as
{{cloudi_service_health_check, tcp_test_https, [Method, Path, StatusCode]}}
with values provided for Method, Path and StatusCode.</td></tr>
</table>
<h2><a name="functions">Function Details</a></h2>
<h3 class="function"><a name="cloudi_service_handle_info-3">cloudi_service_handle_info/3</a></h3>
<div class="spec">
<p><tt>cloudi_service_handle_info(X1, State, Dispatcher) -&gt; any()</tt></p>
<p> </p>
</div>
<h3 class="function"><a name="cloudi_service_handle_request-11">cloudi_service_handle_request/11</a></h3>
<div class="spec">
<p><tt>cloudi_service_handle_request(RequestType, Name, Pattern, RequestInfo, Request, Timeout, Priority, TransId, Source, State, Dispatcher) -&gt; any()</tt></p>
<p> </p>
</div>
<h3 class="function"><a name="cloudi_service_init-4">cloudi_service_init/4</a></h3>
<div class="spec">
<p><tt>cloudi_service_init(Args, Prefix, Timeout, Dispatcher) -&gt; any()</tt></p>
<p> </p>
</div>
<h3 class="function"><a name="cloudi_service_terminate-3">cloudi_service_terminate/3</a></h3>
<div class="spec">
<p><tt>cloudi_service_terminate(Reason, Timeout, State) -&gt; any()</tt></p>
<p> </p>
</div>
<h3 class="function"><a name="tcp_test_http-3">tcp_test_http/3</a></h3>
<div class="spec">
<p><tt>tcp_test_http(Method::head | get, Path::nonempty_string(), StatusCode::200..399) -&gt; fun((Name::<a href="#type-hostname">hostname()</a>, IP::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/inet.html#type-ip_address">inet:ip_address()</a>, Port::<a href="#type-tcp_port">tcp_port()</a>, Timeout::1..4294967295) -&gt; ok | {error, any()})</tt><br></p>
<p> </p>
</div><p>
<h4><a name="HTTP_tcp_test_function.">HTTP tcp_test function.</a></h4>
Add as
{{cloudi_service_health_check, tcp_test_http, [Method, Path, StatusCode]}}
with values provided for Method, Path and StatusCode.</p>
<h3 class="function"><a name="tcp_test_https-3">tcp_test_https/3</a></h3>
<div class="spec">
<p><tt>tcp_test_https(Method::head | get, Path::nonempty_string(), StatusCode::200..399) -&gt; fun((Name::<a href="#type-hostname">hostname()</a>, IP::<a href="/home/george/organized/work/financial_helper_apps/mc2_all-patterns/intraday_system/cloudi_org/kernel/doc/inet.html#type-ip_address">inet:ip_address()</a>, Port::<a href="#type-tcp_port">tcp_port()</a>, Timeout::1..4294967295) -&gt; ok | {error, any()})</tt><br></p>
<p> </p>
</div><p>
<h4><a name="HTTPS_tcp_test_function.">HTTPS tcp_test function.</a></h4>
Add as
{{cloudi_service_health_check, tcp_test_https, [Method, Path, StatusCode]}}
with values provided for Method, Path and StatusCode.</p>
<hr>
<div class="navbar"><a name="#navbar_bottom"></a><table width="100%" border="0" cellspacing="0" cellpadding="2" summary="navigation bar"><tr><td><a href="overview-summary.html" target="overviewFrame">Overview</a></td><td><a href="http://www.erlang.org/"><img src="erlang.png" align="right" border="0" alt="erlang logo"></a></td></tr></table></div>
<p><i>Generated by EDoc</i></p>
</body>
</html>