The docker module on metric beat shows error when I try to put it in the conf file.
Please let me know if i m wrong with the configuration for the docker module,
This is the error I m getting when I try to run with the docker module:
This is the module part which I added on the conf file:
- module: docker
metricsets: ["container", "cpu", "diskio", "healthcheck", "info", "memory", "network"]
hosts: ["nceapttls13:///var/run/docker.sock"]
enabled: true
period: 10s
# To connect to Docker over TLS you must specify a client and CA certificate.
ssl:
certificate_authority: "/etc/pki/root/ca.pem"
certificate: "/etc/pki/client/cert.pem"
key: "/etc/pki/client/cert.key"
Was there an error when you ran it? Did config test pass (metricbeat test config -e -d "*")? Did the module test pass (metricbeat test modules docker -e -d "*")?
my metricbeat is running on docker as a container
also i m using version 5.6.8
could you give the commands to test whether metric beat is running or not on docker
Nothing at all? It should have at least gave some debug output or an error.
As an alternative way to collect information about why it's failing to communicate to Docker, you can enable debug logging in your metricbeat.yml config file.
logging.level: debug
logging.selectors: ['*']
Another thing I noticed is that you are using a unix socket AND you have uncommented the ssl options. I think you can leave the ssl options commented out when using a unix socket. Similar to this example.
If you are running Metricbeat inside of a container then did you mount /var/lib/docker.sock inside of the container so that Metricbeat can access it?
If so, then does the Metricbeat process have the appropriate permissions to read/write to the socket?
I did a quick test with docker-compose to see if everything was working OK with the docker module. Here's the config I used in case it helps.
# Dockerfile
FROM docker.elastic.co/beats/metricbeat:6.2.3
COPY metricbeat.yml /usr/share/metricbeat/metricbeat.yml
USER root
RUN chown root /usr/share/metricbeat/metricbeat.yml
# docker-compose.yml
---
version: '3'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch:6.2.3
environment: ['http.host=0.0.0.0', 'transport.host=127.0.0.1']
ports: ['127.0.0.1:9200:9200']
kibana:
image: docker.elastic.co/kibana/kibana:6.2.3
container_name: kibana
ports: ['127.0.0.1:5601:5601']
depends_on: ['elasticsearch']
metricbeat:
build: .
volumes:
- /var/run/docker.sock:/var/run/docker.sock
command: -e
depends_on: ['elasticsearch']
# So that metricbeat has permission to access the Docker socket.
user: root
$ docker-compose run
# Wait for things to start.
# See if events are present.
$ curl http://localhost:9200/_cat/indices/metricbeat*?v
health status index uuid pri rep docs.count docs.deleted store.size pri.store.size
yellow open metricbeat-6.2.3-2018.04.17 GGotq8MUT9m88xMMFpX1pg 5 1 398 0 812kb 812kb
# To see some of the raw events.
$ curl http://localhost:9200/metricbeat-*/_search?pretty
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.