elasticsearch_exporter 监控

安装elasticsearch_exporter 

services:
  elasticsearch-exporter:
    container_name: ops-elasticsearch-exporter
    image: quay.io/prometheuscommunity/elasticsearch-exporter:v1.8.0
    restart: unless-stopped
    command:
      - '--es.uri=http://172.16.0.100:29201' #es 地址  若有密码则 --es.uri=http://用户名:密码@172.16.0.100:29201
      - '--es.all'
      - '--es.indices'
      - '--es.indices_settings'
      - '--es.indices_mappings'
      - '--es.shards'
      - '--es.timeout=20s'
    ports:
      - "9114:9114"

访问http://172.16.0.7:9114/metrics 查看是否采集

 

添加promethues

  - job_name: 'elasticsearch-exporter'
    static_configs:
    file_sd_configs:
    - files:
      - metrics/elasticsearch-exporter.yaml
      refresh_interval: 2m
    relabel_configs:
    - source_labels: [__address__]
      regex: '(.*)\:9114'
      target_label:  'instance'
      replacement:   '$1'
    - source_labels: [__address__]
      regex:         '.*\.(.*)\.lan.*'
      target_label:  'environment'
      replacement:   '$1'


cat /etc/prometheus/metrics/elasticsearch-exporter.yaml
- targets: ['172.16.0.7:9114']
  labels:
    service: elasticsearch
    job: elasticsearch-exporter

添加grafana 模板 13071

image

 

参数及指标详细 https://gitcode.com/gh_mirrors/el/elasticsearch_exporter

posted @ 2026-03-30 09:44  追梦$少年  阅读(16)  评论(0)    收藏  举报