> vi setup.sh
setup.sh
docker run \ --net host \ docker.elastic.co/beats/metricbeat:6.6.2 \ setup -E setup.kibana.host=192.168.1.60:5601 \ -E output.elasticsearch.hosts=["192.168.1.60:9200"]
> chmod +x setup.sh
> ./setup.sh
> mkdir conf
> cd conf
> curl -L -O https://raw.githubusercontent.com/elastic/beats/6.6/deploy/docker/metricbeat.docker.yml
> cd ..
> vi buildDocker.sh
CONTAINER=metricbeat IMAGE=docker.elastic.co/beats/metricbeat:6.6.2 docker stop $CONTAINER docker rm $CONTAINER DIR=`pwd -P` docker run --name $CONTAINER \ --user=root \ --restart=always \ -v $DIR/conf/metricbeat.docker.yml:/usr/share/metricbeat/metricbeat.yml \ -v "/var/run/docker.sock:/var/run/docker.sock:ro" \ -v "/sys/fs/cgroup:/hostfs/sys/fs/cgroup:ro" \ -v "/proc:/hostfs/proc:ro" \ -v "/:/hostfs:ro" \ --net=host \ -d $IMAGE \ metricbeat -e -E output.elasticsearch.hosts=["192.168.1.60:9200"] docker logs -f $CONTAINER
> chmod +x buildDocker.sh
> ./buildDocker.sh
Reference
Reference | URL |
---|---|
Running MetricBeat on Docker | https://www.elastic.co/guide/en/beats/metricbeat/current/running-on-docker.html |