【Prometheus】【Elasticsearch】prometheus监控Elasticsearch实现

时间:2025-03-25 07:01:02

通过prometheus插件elasticsearch_exporter实现

  1. 在需要挂起监控的es集群下载安装elasticsearch_exporter插件
    下载地址:/prometheus-community/elasticsearch_exporter/releases

  2. 下载后解压
    tar -zxvf elasticsearch_exporter-1.1.0.linux-

  3. 启动插件
    cd elasticsearch_exporter-1.1.-amd64/
    nohup ./elasticsearch_exporter -- -- --es.cluster_settings --es.indices_settings -- -- --=10s ---address=“:9116” ---path=“/metrics” -- http://username:password@10.58.56.11:9200 &

参数解释:
– 默认http://localhost:9200,连接到的Elasticsearch节点的地址(主机和端口)。 这可以是本地节点(例如localhost:9200),也可以是远程Elasticsearch服务器的地址
– 默认flase,如果为true,则查询群集中所有节点的统计信息,而不仅仅是查询我们连接到的节点。
–es.cluster_settings 默认flase,如果为true,请在统计信息中查询集群设置
– 默认flase,如果为true,则查询统计信息以获取集群中的所有索引。
–es.indices_settings 默认flase,如果为true,则查询集群中所有索引的设置统计信息。
– 默认flase,如果为true,则查询集群中所有索引的统计信息,包括分片级统计信息(意味着 = true)。
– 默认flase,如果为true,则查询集群快照的统计信息。

  1. 修改prometheus集群配置文件

    修改es目标的metrics_path–>“metrics_path: /metrics”
    discovery_elasticsearch.yml
    添加es_exporter节点–>“- targets: [‘10.58.56.11:9116’]”