How to monitor docker services using metricbeat

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, the most useful metricset I've found is container , 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

    - type: docker
      hits.enabled: true

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

  - add_docker_metadata: ~
  - add_locale:
      format: offset

  hosts: [ "" ]

The metricset container log data (the relevant docker part)

"docker" : {
  "container": {
    "id": "60983ad304e13cb0245a589ce843100da82c5fv9e093aad68abb439cdc2f3044"
    "status": "Up 3 weeks",
    "command": "./",
    "image": "",
    "created": "2019-04-08T11:38:10.000Z",
    "name": "mystack_myservice.wuiqep73p99hcbto2kgv6vhr2.mufs70y24k5388jxv782in18f",
    "ip_addresses": [ "" ]
    "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

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