一、部署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 , 添加即可
转载请注明:IT运维空间 » 运维技术 » Prometheus监控elasticsearch集群
发表评论