# How to monitor docker services using metricbeat

**URL:** https://discuss.elastic.co/t/how-to-monitor-docker-services-using-metricbeat/179753
**Category:** Beats
**Tags:** metricbeat
**Created:** [May 6, 2019, 11:24am UTC](https://discuss.elastic.co/t/how-to-monitor-docker-services-using-metricbeat/179753 "2019-05-06T11:24:19Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![matanper](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/matanper/32/45610_2.png) [@matanper](https://discuss.elastic.co/u/matanper)
#### Post date: [May 6, 2019, 11:24am UTC](https://discuss.elastic.co/t/how-to-monitor-docker-services-using-metricbeat/179753/1 "2019-05-06T11:24:19Z")

</div>

I have a docker swarm running a number of services. I'm using the elastic stack (kibana, elastic, filebeat, etc) for monitoring.  
For the business logic I'm writing logs and using filebeat to move them to logstash and analyze the data in kibana.

But I'm having trouble in monitoring the liveness of my docker services. some of them are deployed globally (like filebeat) and some of them have a number of replicas. I wan't to be able to see in kibana that the number of running containers is equal to the number that the service should have. I'm trying to use metricbeat with [docker module](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-module-docker.html), the most useful metricset I've found is [`container`](https://www.elastic.co/guide/en/beats/metricbeat/current/metricbeat-metricset-docker-container.html), but it doesn't seem to contain enough information for me to display or analyze the number of instances of a service.

my metricbeat configuration

```
metricbeat.autodiscover:
  providers:
    - type: docker
      hits.enabled: true

metricbeat.modules:
  - module: docker
    enabled: true
    metricsets:
      - container
      - healthcheck
      - info
    period: 10s
    hosts: ["unix:///var/run/docker.sock"]

processors:
  - add_docker_metadata: ~
  - add_locale:
      format: offset

output.logstash:
  hosts: ["mylogstash.com"]

```

The metricset `container` log data (the relevant docker part)

```
...
"docker" : {
  "container": {
    "id": "60983ad304e13cb0245a589ce843100da82c5fv9e093aad68abb439cdc2f3044"
    "status": "Up 3 weeks",
    "command": "./entrypoint.sh",
    "image": "registry.com/myimage",
    "created": "2019-04-08T11:38:10.000Z",
    "name": "mystack_myservice.wuiqep73p99hcbto2kgv6vhr2.mufs70y24k5388jxv782in18f",
    "ip_addresses": ["10.0.0.148"]
    "labels" : {
       "com_dokcer_swarm_node_id": "wuiqep73p99hcbto2kgv6vhr2",
       "com_docker_swarm_task_name": "stack_service.wuiqep73p99hcbto2kgv6vhr2.mufs70y24k5388jxv782in18f",
       "com_docker_swarm_service_id": "kxm5dk43yzyzpemcbz23s21xo",
       "com_docker_swarn_task_id": "mufs70y24k5388jxv782in18f",
       "com_docker_swarm_task" : "",
       "com_docker_stack_namespace": "mystack",
       "com_docker_swarm_service_name": "mystack_myservice"
     },
     "size": {
        "rw": 0,
        "root_fs": 0
     }
  }
}
...
```

---

<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 3, 2019, 11:24am UTC](https://discuss.elastic.co/t/how-to-monitor-docker-services-using-metricbeat/179753/2 "2019-06-03T11:24:20Z")

</div>

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