# Failed to get my heatbeat.yml to be used

**URL:** https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827
**Category:** Synthetics
**Created:** [November 18, 2020, 11:20am UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827 "2020-11-18T11:20:05Z")
**Posts on this page:** 11
**Page:** 1

<div class="post-metadata">

### Author: ![Fredrik\_Cronholm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fredrik_cronholm/32/74091_2.png) [@Fredrik\_Cronholm](https://discuss.elastic.co/u/Fredrik_Cronholm)
#### Post date: [November 18, 2020, 11:20am UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/1 "2020-11-18T11:20:05Z")

</div>

Hi!  
Tried it, but the pings (actually received to my clud instance) were to the default heartbeat.yml (2 http 2 icmp) inside the container (I believe that is what happened).

In examples\docker\heartbeat.docker.yml:

```auto
heartbeat.monitors:
- type: browser
  id: my-monitor
  name: My Monitor
  schedule: "@every 1m"
  script: |-
    step("load homepage", async () => {
        await page.goto('https://www.folksam.se');
    });
    step("Tryck till kundtjanst", async () => {
        await page.click('title=["Till kundservice"]');

    });

```

In examples\run.sh

```auto
#!/bin/bash
set -e
set -x
VERSION=${1:-7.10.0}
if [! -z $1]; then
  shift # discard first arg
fi
HEARTBEAT_ARGS=$@

if [-z $1]; then
  HEARTBEAT_ARGS="-E output.elasticsearch.hosts=["localhost:9200"] -E output.elasticsearch.username=elastic -E output.elasticsearch.password=changeme"
else
  HEARTBEAT_ARGS="$@"
fi

# Set Image based on version
if [[$VERSION =~ ^[0-9] ]]; then
	IMAGE=docker.elastic.co/experimental/synthetics:$VERSION-synthetics
else
	IMAGE=$VERSION
fi

echo "Using image '$IMAGE' with extra args: $HEARTBEAT_ARGS"
docker run \
  --rm \
  --name=heartbeat \
  --user=heartbeat \
  --net=host \
  --security-opt seccomp=seccomp_profile.json \
  --volume="$(pwd)/heartbeat.docker.yml:/usr/share/heartbeat/heartbeat.yml:ro" \
  --volume="$(pwd)/../../:/opt/elastic-synthetics:rw" \
  $IMAGE \
  --strict.perms=false -e \
  -E cloud.id=xxxx" \
  -E cloud.auth="elastic:xxx"
  $HEARTBEAT_ARGS

```

from examples\docker I start /(w10) using  
sh run.sh 7.10.0  
At starts up, the data is send to my cloud but always for  
[http://elasticsearch:9200/](http://elasticsearch:9200/)  
[http://kibana:5601/](http://kibana:5601/)  
icmp://elasticsearch  
icmp://kibana

Why is not my heartbeat.yml used??

---

<div class="post-metadata">

### Author: ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)
#### Post date: [November 18, 2020, 12:49pm UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/2 "2020-11-18T12:49:18Z")

</div>

@Fredrik_Cronholm if you want to change where you want to send data you will have to specify those options while running your command

like this

`sh run.sh 7.10.0 -E output.elasticsearch.hosts=["localhost:9200"] -E cloud.id=434343`

same way you can specify other options` -E cloud.id` or` -E cloud.auth` or `-E output.elasticsearch.username=elastic` etc

let me know if it works.

---

<div class="post-metadata">

### Author: ![Fredrik\_Cronholm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fredrik_cronholm/32/74091_2.png) [@Fredrik\_Cronholm](https://discuss.elastic.co/u/Fredrik_Cronholm)
#### Post date: [November 18, 2020, 2:26pm UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/3 "2020-11-18T14:26:50Z")

</div>

That works, the data is sent to the correct place. It is the tests that is not used (the content of heartbeat.docker.yml)

---

<div class="post-metadata">

### Author: ![shahzad31](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shahzad31/32/51637_2.png) [@shahzad31](https://discuss.elastic.co/u/shahzad31)
#### Post date: [November 19, 2020, 10:44am UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/4 "2020-11-19T10:44:36Z")

</div>

I guess you can retry creating your container. That might help, we will try to reproduce this locally.

---

<div class="post-metadata">

### Author: ![Fredrik\_Cronholm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fredrik_cronholm/32/74091_2.png) [@Fredrik\_Cronholm](https://discuss.elastic.co/u/Fredrik_Cronholm)
#### Post date: [November 19, 2020, 11:29am UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/5 "2020-11-19T11:29:03Z")

</div>

I'm not super used to docker, I have rerun sh run.sh a few times, no difference. I have also tried to copy the local config file to the container (as in the scrip), docker cp to /usr/share/heartbeat/heartbeat.yml but the same result.  
Waiting for a possible resolution. I'm thinking my test file has some syntax errors and is therefore not used..?

---

<div class="post-metadata">

### Author: ![PaulB-Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paulb-elastic/32/78691_2.png) [@PaulB-Elastic](https://discuss.elastic.co/u/PaulB-Elastic)
#### Post date: [November 19, 2020, 5:13pm UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/6 "2020-11-19T17:13:47Z")

</div>

Are you running `run.sh` from the `synthetics/examples/docker` folder on your clone of the repo?

This should run the docker version of Elastic Synthetics, taking the configuration from your local `synthetics/examples/heartbeat.docker.yml` file (i.e. this is the one you want to edit to contains your URLs and script).

Try making sure you are in the `synthetics/examples/docker` folder when you run `run.sh` so that it can mount the correct `synthetics/examples/heartbeat.docker.yml`file inside your docker container.

---

<div class="post-metadata">

### Author: ![Fredrik\_Cronholm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fredrik_cronholm/32/74091_2.png) [@Fredrik\_Cronholm](https://discuss.elastic.co/u/Fredrik_Cronholm)
#### Post date: [November 20, 2020, 2:00pm UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/7 "2020-11-20T14:00:11Z")

</div>

Yes I run it locally on my host in the cloned repo ☹

---

<div class="post-metadata">

### Author: ![PaulB-Elastic](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/paulb-elastic/32/78691_2.png) [@PaulB-Elastic](https://discuss.elastic.co/u/PaulB-Elastic)
#### Post date: [November 20, 2020, 2:47pm UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/8 "2020-11-20T14:47:51Z")

</div>

The mounting of your `local heartbeat.docker.yml` into the docker container works the same for regular Heartbeat (e.g. standard HTTP pings) as well as for the Synthetics implementation (i.e. it uses the same mechanism for getting your local `heartbeat.docker.yml` into the docker container).

It might be worth starting again to make sure you have a clean set up. Remove your clone of the Synthetics repository (backing up anything you may want to keep), then clone a new/up to date copy (`git clone git@github.com:elastic/synthetics.git`).

Before running it, also remove any docker images you may have (this will make sure it downloads the latest version when you next run). You can run `docker images` to see what images you have.

If you have anything like `docker.elastic.co/experimental/synthetics` or `7.10.0-synthetics`, remove it with `docker image rm IMAGE_ID`, substituting the `IMAGE_ID` with what was listed for the image.

Add your Elasticsearch host/credentials to the `synthetics/examples/docker/run.sh` file as you did before. Don’t modify the `heartbeat.docker.yml` file yet.

Make sure you are in the `synthetics/examples/docker` folder, then run the `./run.sh 7.10.0` command, this will take a bit longer and download all the docker images needed. Check that this is running correctly.

If so, stop it (`[ctrl][c]`) then add your monitor configuration to the `heartbeat.docker.yml` and run `./run.sh 7.10.0` again to see if it runs with your monitors this time.

---

<div class="post-metadata">

### Author: ![Fredrik\_Cronholm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/fredrik_cronholm/32/74091_2.png) [@Fredrik\_Cronholm](https://discuss.elastic.co/u/Fredrik_Cronholm)
#### Post date: [November 27, 2020, 3:04pm UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/9 "2020-11-27T15:04:51Z")

</div>

Hi!  
Did as described (removed all images, clones new, started etc. etc). Still difference. Still doesn't check the [elastic.io](http://elastic.io) site (as described in the original heartbeat.docker.yml). It still checks 4 localhost adresses.

---

<div class="post-metadata">

### Author: ![Hamidreza](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamidreza/32/21369_2.png) [@Hamidreza](https://discuss.elastic.co/u/Hamidreza)
#### Post date: [December 3, 2020, 2:05pm UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/10 "2020-12-03T14:05:55Z")

</div>

Hi @Fredrik_Cronholm,

Is it possible for you to post part of the logs from the docker container?  
You can use this command to get the logs: `docker logs --tail=50 <container-id>`.

Cheers,  
Hamid

---

<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: [December 27, 2020, 2:05pm UTC](https://discuss.elastic.co/t/failed-to-get-my-heatbeat-yml-to-be-used/255827/11 "2020-12-27T14:05:58Z")

</div>

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