diff --git a/heartbeat/docs/autodiscover-hints.asciidoc b/heartbeat/docs/autodiscover-hints.asciidoc new file mode 100644 index 000000000000..3af54481f131 --- /dev/null +++ b/heartbeat/docs/autodiscover-hints.asciidoc @@ -0,0 +1,42 @@ +{beatname_uc} supports autodiscover based on hints from the both Docker and Kubernetes. The hints system looks for +hints in Kubernetes Pod annotations or Docker labels that have the prefix `co.elastic.monitor`. As soon as +the container starts, {beatname_uc} will check if it contains any hints and launch the proper config for +it. Hints tell {beatname_uc} how to get logs for the given container. + +Hints for {beatname_uc} take the form `co.elastic.monitor/MONITOR_INDEX.CONFIG_OPTION=VALUE`, where `MONITOR_INDEX` represents +the index of monitor, and `CONFIG_OPTION` is any of the <> options, with `VALUE` being the value +you'd like to set that option to. + +As an example let's convert the regular syntax {beatname_uc} monitors below into autodiscover hints. + +[source,yml] +---------------------------------------------------------------------- +-- heartbeat.monitors: +- type: tcp + hosts: '${data.host}:6379' + schedule: @every 10s +- type: icmp + hosts: '${data.host}' + schedule: @every 10s +---------------------------------------------------------------------- + +To configure this with autodiscover, add the following line to your Dockerfile to add the requisite labels. + +---------------------------------------------------------------------- +LABEL co.elastic.monitor/1.type=tcp co.elastic.monitor/1.hosts='${data.host}:6379' co.elastic.monitor/1.schedule='@every 10s' +LABEL co.elastic.monitor/2.type=icmp co.elastic.monitor/2.hosts='${data.host}' co.elastic.monitor/2.schedule='@every 10s' +---------------------------------------------------------------------- + +Then, add the following to `heartbeat.yml`: + +[source,yml] +---------------------------------------------------------------------- +heartbeat.autodiscover: + providers: + - type: docker + hints.enabled: true +---------------------------------------------------------------------- + +Then, start {beatname_uc}. This should discover the container you built and ping it once with ICMP, another time with TCP. + +For a full list of variables available, see the provider-specific docs in <>. diff --git a/heartbeat/docs/configuring-howto.asciidoc b/heartbeat/docs/configuring-howto.asciidoc index a235d52bfbd0..ef38354d6517 100644 --- a/heartbeat/docs/configuring-howto.asciidoc +++ b/heartbeat/docs/configuring-howto.asciidoc @@ -75,9 +75,11 @@ include::{libbeat-dir}/loggingconfig.asciidoc[] include::{libbeat-dir}/shared-env-vars.asciidoc[] :standalone!: +:autodiscoverHints: :autodiscoverAWSELB: include::{libbeat-dir}/shared-autodiscover.asciidoc[] :autodiscoverAWSELB!: +:autodiscoverHints!: :standalone: include::{libbeat-dir}/yaml.asciidoc[]