Skip to content

Commit

Permalink
[Uptime] Add docs for autodiscover hints (#14252) (#14623)
Browse files Browse the repository at this point in the history
Autodiscover hints were introduced in #13119 but not documented. This adds the docs.

Resolves #14245
  • Loading branch information
andrewvc authored Nov 25, 2019
1 parent 6d0d0ae commit ec59f05
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
42 changes: 42 additions & 0 deletions heartbeat/docs/autodiscover-hints.asciidoc
Original file line number Diff line number Diff line change
@@ -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 <<configuration-heartbeat-options>> 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 <<configuration-autodiscover>>.
2 changes: 2 additions & 0 deletions heartbeat/docs/configuring-howto.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -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[]
Expand Down

0 comments on commit ec59f05

Please sign in to comment.