# Elastic Agent removes all metricbeat unix-sock endpoint when any metricbeat is killed

**URL:** <https://discuss.elastic.co/t/elastic-agent-removes-all-metricbeat-unix-sock-endpoint-when-any-metricbeat-is-killed/271581>\
**Category:** Beats\
**Tags:** elastic-agent\
**Created:** [April 29, 2021, 2:59am UTC](https://discuss.elastic.co/t/elastic-agent-removes-all-metricbeat-unix-sock-endpoint-when-any-metricbeat-is-killed/271581 "2021-04-29T02:59:41Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![buptubuntu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/buptubuntu/32/87901_2.png) [@buptubuntu](https://discuss.elastic.co/u/buptubuntu)\
**Post date:** [April 29, 2021, 2:59am UTC](https://discuss.elastic.co/t/elastic-agent-removes-all-metricbeat-unix-sock-endpoint-when-any-metricbeat-is-killed/271581/1 "2021-04-29T02:59:41Z")

</div>

Hi, all  
We try to use elastic agent to manage beats, and configured agent.monitoring to use a sidecar metricbeat to monitor the managed beats，after all the beats are started，if we kill the sidecar metricbeat process，the elastic agent will start it again，but the sidecar metricbeat can not get the metrics of the main process any more. We check and debug the code, and find that the unix sock endpoint of sidecar metricbeat and main metricbeat are in the same dir，and elastic agent removes the whole dir in cleanup before restart the sidecar metricbeat.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/8/0/804673893e01590b381b04bf5bfcfa650dbf88c3.jpeg)

How should we fix it，in metricbeat or in elastic agent?

Thank you.

Regards,  
buptubuntu

---

<div class="post-metadata">

**Author:** ![buptubuntu](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/buptubuntu/32/87901_2.png) [@buptubuntu](https://discuss.elastic.co/u/buptubuntu)\
**Post date:** [May 18, 2021, 9:58am UTC](https://discuss.elastic.co/t/elastic-agent-removes-all-metricbeat-unix-sock-endpoint-when-any-metricbeat-is-killed/271581/2 "2021-05-18T09:58:16Z")

</div>

Any one had the problem?

---

<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:** [June 15, 2021, 11:58am UTC](https://discuss.elastic.co/t/elastic-agent-removes-all-metricbeat-unix-sock-endpoint-when-any-metricbeat-is-killed/271581/3 "2021-06-15T11:58:28Z")

</div>

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