Prometheus監控elasticsearch集群(以elasticsearch-6.4.2版本為例)


部署elasticsearch集群,配置文件可“濃縮”為以下:

cluster.name: es_cluster
node.name: node1

path.data: /app/data/elasticsearch
path.logs: /app/logs/elasticsearch

network.host: 192.168.x.x
http.port: 9200
transport.tcp.port: 9201
discovery.zen.ping.unicast.hosts: ["node1", "node2","node3"]
discovery.zen.minimum_master_nodes: 2
gateway.recover_after_nodes: 3
gateway.expected_nodes: 3
gateway.recover_after_time: 5m
http.cors.enabled: true
http.cors.allow-origin: "*"
thread_pool.bulk.queue_size: 500
xpack.security.enabled: false

下載插件進行並進行安裝

插件下載地址: https://github.com/vvanholl/elasticsearch-prometheus-exporter/releases

安裝: 如果有elk單獨用戶,切換到該用戶下, wget下載,進入到es安裝目錄,執行 ./elasticsearch-plugin install file://$(pwd)/../../elasticsearch-prometheus-exporter-6.4.2.0.zip 即可完成安裝

配置Prometheus, 添加如下配置,並重新啟動Prometheus

- job_name: 'elasticsearch'
    scrape_interval: 30s
    metrics_path: "/_prometheus/metrics"
    static_configs:
    - targets:
      - 192.168.x.x:9200
      - 192.168.x.x:9200
      - 192.168.x.x:9200

配置Grafana, 導入模板,編號建議為 266 (https://grafana.com/dashboards/266) 選擇數據源為 Prometheus , 添加即可,會出現如下的監控圖


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM