# Load external configuration files with autodiscover

**URL:** https://discuss.elastic.co/t/load-external-configuration-files-with-autodiscover/160044
**Category:** Beats
**Tags:** metricbeat
**Created:** [December 9, 2018, 12:50pm UTC](https://discuss.elastic.co/t/load-external-configuration-files-with-autodiscover/160044 "2018-12-09T12:50:23Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![hamid.haghshenas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid.haghshenas/32/42667_2.png) [@hamid.haghshenas](https://discuss.elastic.co/u/hamid.haghshenas)
#### Post date: [December 9, 2018, 12:50pm UTC](https://discuss.elastic.co/t/load-external-configuration-files-with-autodiscover/160044/1 "2018-12-09T12:50:23Z")

</div>

I'm going to monitor Docker Swarm containers using Metricbeat, which is itself a Swarm service. I've heard that I should use [autodiscover](https://www.elastic.co/guide/en/beats/metricbeat/current/configuration-autodiscover.html) instead of using modules directly.

Say I want to monitor services running uWSGI and PHP-FPM. Is it required to copy all contents of modules.d/uwsgi.yml and modules.d/php\_fpm.yml in metricbeat.yml like below?

```auto
metricbeat.autodiscover:
  providers:
    - type: docker
      templates:
        - condition:
            contains:
              docker.container.image: my_python_app
          config:
            # Paste contents of uwsgi.yml here
        - condition:
            contains:
              docker.container.image: my_php_app
          config:
            # Paste contents of php_fpm.yml here

```

But this seems to end in a large metricbeat.yml file. Is there a way to use separate config files with autodiscover, like when we used modules directly?

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [December 10, 2018, 1:29pm UTC](https://discuss.elastic.co/t/load-external-configuration-files-with-autodiscover/160044/2 "2018-12-10T13:29:56Z")

</div>

Currently you need all the configs in this file. One solution to solve this is using hint based autodiscovery: [https://www.elastic.co/guide/en/beats/metricbeat/current/configuration-autodiscover-hints.html](https://www.elastic.co/guide/en/beats/metricbeat/current/configuration-autodiscover-hints.html) But to be honest I haven't tried of this works on Docker Swarm.

---

<div class="post-metadata">

### Author: ![hamid.haghshenas](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/hamid.haghshenas/32/42667_2.png) [@hamid.haghshenas](https://discuss.elastic.co/u/hamid.haghshenas)
#### Post date: [December 10, 2018, 3:00pm UTC](https://discuss.elastic.co/t/load-external-configuration-files-with-autodiscover/160044/3 "2018-12-10T15:00:55Z")

</div>

To use this solution, I need to config my Metricbeat by labeling Docker containers, right?

The idea itself is not bad and can be interpreted as annotating containers for metering.

Thanks again.

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [December 13, 2018, 8:20am UTC](https://discuss.elastic.co/t/load-external-configuration-files-with-autodiscover/160044/4 "2018-12-13T08:20:24Z")

</div>

Exactly.

---

<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: [January 10, 2019, 8:33am UTC](https://discuss.elastic.co/t/load-external-configuration-files-with-autodiscover/160044/5 "2019-01-10T08:33:34Z")

</div>

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