# Heartbeat autodiscover not working: protocol not available

**URL:** https://discuss.elastic.co/t/heartbeat-autodiscover-not-working-protocol-not-available/262780
**Category:** Beats
**Tags:** docker, heartbeat
**Created:** [February 1, 2021, 5:13am UTC](https://discuss.elastic.co/t/heartbeat-autodiscover-not-working-protocol-not-available/262780 "2021-02-01T05:13:04Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![jeffrey008](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeffrey008/32/83185_2.png) [@jeffrey008](https://discuss.elastic.co/u/jeffrey008)
#### Post date: [February 1, 2021, 5:13am UTC](https://discuss.elastic.co/t/heartbeat-autodiscover-not-working-protocol-not-available/262780/1 "2021-02-01T05:13:04Z")

</div>

I was trying Heartbeat autodiscover on my Windows. Here is my `heartbeast.yml`:

```auto
heartbeat.autodiscover:
  providers:
    - type: docker
      templates:
        - condition:
            contains:
              docker.container.image: api
          config:
            - type: tcp
              hosts: ["tcp://localhost:2375"]
              schedule: "@every 10s"

```

Here is the output of `.\heartbeat.exe -v -e`:

```auto
2021-02-01T13:05:56.097+0800 INFO instance/beat.go:456 heartbeat stopped.
2021-02-01T13:05:56.099+0800 ERROR instance/beat.go:951 Exiting: error in autodiscover provider settings: error setting up docker autodiscover provider: protocol not available
Exiting: error in autodiscover provider settings: error setting up docker autodiscover provider: protocol not available

```

Version:

```auto
heartbeat version 7.9.2 (amd64), libbeat 7.9.2 [2ab907f5ccecf9fd82fe37105082e89fd871f684 built 2020-09-22 22:24:50 +0000 UTC]

```

---

<div class="post-metadata">

### Author: ![Andrew\_Cholakian1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrew_cholakian1/32/3612_2.png) [@Andrew\_Cholakian1](https://discuss.elastic.co/u/Andrew_Cholakian1)
#### Post date: [February 1, 2021, 12:08pm UTC](https://discuss.elastic.co/t/heartbeat-autodiscover-not-working-protocol-not-available/262780/2 "2021-02-01T12:08:19Z")

</div>

@jsoriano thoughts on this error? I think this would be up your alley.

---

<div class="post-metadata">

### Author: ![jsoriano](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jsoriano/32/27920_2.png) [@jsoriano](https://discuss.elastic.co/u/jsoriano)
#### Post date: [February 1, 2021, 5:33pm UTC](https://discuss.elastic.co/t/heartbeat-autodiscover-not-working-protocol-not-available/262780/3 "2021-02-01T17:33:43Z")

</div>

I think that docker autodiscover tries to connect by default to `unix:///var/run/docker.sock`. Unix sockets are only supported in recent versions of Windows, what is problably causing this `protocol not available` error.

In Windows, the npipe should be used instead, something like this:

```auto
heartbeat.autodiscover:
  providers:
    - type: docker
      host: 'npipe://./pipe/docker_engine'
      ...

```

Of if the docker daemon is listening in `localhost:2375`:

```auto
heartbeat.autodiscover:
  providers:
    - type: docker
      host: 'tcp://localhost:2375'
      ...

```

---

<div class="post-metadata">

### Author: ![jeffrey008](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeffrey008/32/83185_2.png) [@jeffrey008](https://discuss.elastic.co/u/jeffrey008)
#### Post date: [February 3, 2021, 9:52am UTC](https://discuss.elastic.co/t/heartbeat-autodiscover-not-working-protocol-not-available/262780/4 "2021-02-03T09:52:55Z")

</div>

I did make the autodiscover works by the below config (notice the 4 slashes):

```auto
heartbeat.autodiscover:
  providers:
    - type: docker
      host: 'npipe:////./pipe/docker_engine'

```

However the data doesn't seems quite right, see below:

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/a/e/aee29756bbd472c5e3d7c70f6ca4bc78b8e896cb.png)

Any idea why the name isn't the container name, and why are they reporting `[i/o timeout]`?

---

<div class="post-metadata">

### Author: ![jeffrey008](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/jeffrey008/32/83185_2.png) [@jeffrey008](https://discuss.elastic.co/u/jeffrey008)
#### Post date: [February 4, 2021, 7:37am UTC](https://discuss.elastic.co/t/heartbeat-autodiscover-not-working-protocol-not-available/262780/5 "2021-02-04T07:37:00Z")

</div>

I found a solution.  
For the name, you have to set the `name` and `id` under `config`.  
For the timeout problem, I use `localhost` instead of `data.host`.  
Here is the setting that I use:

```auto
heartbeat.autodiscover:
  providers:
    - type: docker
      host: 'npipe:////./pipe/docker_engine'
      templates:
        - config:
            - type: tcp
              id: "${data.docker.container.id}"
              name: "${data.docker.container.name}"
              hosts: ["localhost:${data.port}"]
              schedule: "@every 10s"
              timeout: 1s

```

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [March 4, 2021, 9:37am UTC](https://discuss.elastic.co/t/heartbeat-autodiscover-not-working-protocol-not-available/262780/6 "2021-03-04T09:37:35Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
