Tie health state of a backend to other backends
Find a file
Thibaut Artis e77f9df24f build: Don't use vcs_vmod_version if not present
Before that, when building from a system without
Git some Makefile steps would fail because without
it vmodtool.py would not generate the required
src/vmod_vcs_version.txt file to be present.
We now check if the file is already present or if
git is installed, if either condition is validated
then src/vmod_vcs_version.txt will be used, if not
it will not be used and a warning will be issued
at configure time.
2025-07-30 11:58:08 +02:00
src build: Don't use vcs_vmod_version if not present 2025-07-30 11:58:08 +02:00
.clang-tidy CI: Introduce clang-tidy 2025-07-30 11:58:08 +02:00
.gitignore Handle src/vmod_vcs_version.txt 2025-05-06 16:27:26 +02:00
.gitlab-ci.yml CI: Add a Gitlab CI pipeline configuration 2025-07-30 11:58:08 +02:00
bootstrap vcdk skeleton 2018-08-10 16:29:25 +02:00
configure.ac build: Don't use vcs_vmod_version if not present 2025-07-30 11:58:08 +02:00
LICENSE Standardize LICENSE 2022-12-01 16:13:51 +01:00
Makefile.am CI: Add coverage target to Makefile 2025-07-30 11:58:08 +02:00
README.rst add the generated rst as README for now 2018-08-10 19:51:10 +02:00

..
.. NB:  This file is machine generated, DO NOT EDIT!
..
.. Edit vmod.vcc and run make instead
..

.. role:: ref(emphasis)

.. _vmod_all_healthy(3):

================
vmod_all_healthy
================

--------------------------
Varnish all_healthy Module
--------------------------

:Manual section: 3

SYNOPSIS
========


::

   import all_healthy [from "path"] ;
   
   new xdirector = director()
  
      VOID xdirector.consider(BACKEND)
  
      VOID xdirector.set_backend(BACKEND)
  
      BACKEND xdirector.backend()
  


DESCRIPTION
===========

The all_healthy vmod provides a varnish director tieing the health
state of several other backends / health states: An all_healthy
director is only healthy if all backends to consider are healthy. It
always resolves to exactly one backend, which may or may not be part
of the set of backends considered for health state.

An all_healthy director will commonly be layered below other directors
for actual load balancing.

Examples and use cases:

* Using more than one health checks for a backend::

	probe probe_a { ... }
	probe probe_b { ... }

	backend be_a {
		.host = "1.2.3.4";
		.probe = probe_a;
	}

	# will never actually be used, only provides the second probe
	backend be_b {
		.host = "1.2.3.4";
		.probe = probe_b;
	}

	sub vcl_init {
		new be = all_healthy.director();
		# implies be.set_backend(be_a);
		be.consider(be_a);
		be.consider(be_b);

		some_director.add_backend(be);
	}

	sub vcl_backend_fetch {
		set bereq.backend = be.backend();
	}

* Checking health on a different port::

	probe oob_probe { ... }

	backend be_traffic {
		.host = "1.2.3.4";
		# no .probe !
	}

	backend be_oob_probe {
		.host = "1.2.3.4";
		.port = "4242";
		.probe = oob_probe;
	}

	sub vcl_init {
		new be = all_healthy.director();
		be.consider(be_oob_probe);
		be.set_backend(be_traffic);

		some_director.add_backend(be);
	}

	sub vcl_backend_fetch {
		set bereq.backend = be.backend();
	}

CONTENTS
========

* :ref:`obj_director`
* :ref:`func_director.backend`
* :ref:`func_director.consider`
* :ref:`func_director.set_backend`


.. _obj_director:

new xdirector = director()
--------------------------

Instantiate an all_healthy director.

.. _func_director.consider:

VOID xdirector.consider(BACKEND)
--------------------------------

Add a backend to consider for determining the health state of the
director.

This method may only be called from vcl_init {}


.. _func_director.set_backend:

VOID xdirector.set_backend(BACKEND)
-----------------------------------

Set the backend the director resolves to.

This method may only be called from vcl_init {}


.. _func_director.backend:

BACKEND xdirector.backend()
---------------------------

Return the all_healthy director instance, which will resolve to the
backend set using the .set_backend() method.

SEE ALSO
========vcl\(7),varnishd\(1)





COPYRIGHT
=========

::

  This document is copyright and licensed under the same conditions as
  the libvmod-all_healthy project. See LICENSE for details.