编写docker-compose.yml

  1. version: "3.3"
  2. services:
  3. elasticsearch_exporter1:
  4. image: justwatch/elasticsearch_exporter:1.1.0
  5. command:
  6. - '--es.uri=http://elastic:W86mXT4x1t2T@172.16.106.76:9200'
  7. restart: always
  8. ports:
  9. - "9124:9114"
  10. elasticsearch_exporter2:
  11. image: justwatch/elasticsearch_exporter:1.1.0
  12. command:
  13. - '--es.uri=http://elastic:W86mXT4x1t2T@172.16.106.76:9201'
  14. restart: always
  15. ports:
  16. - "9125:9114"
  17. networks:
  18. qa_net:

运行

docker-compose -f es.yaml up -d

Prometheus配置

  1. - job_name: 'es-9200'
  2. static_configs:
  3. - targets: ['172.16.106.76:9124']
  4. labels:
  5. appname: 'es-9200'
  6. name: 'es-9200'
  7. group: 'es'
  8. - job_name: 'es-9300'
  9. static_configs:
  10. - targets: ['172.16.106.76:9125']
  11. labels:
  12. appname: 'es-9300'
  13. name: 'es-9300'
  14. group: 'es'

查看docker 是否有数据

docker ps

grafana导入模板

https://github.com/hangxie/elasticsearch_exporter