Prometheus监控Elasticsearch

1 下载elasticsearch exporter

https://github.com/prometheus-community/elasticsearch_exporter

2 systemd 管理elasticsearch exporter 

service文件:  /usr/lib/systemd/system/es_exporter.service

[Unit]
Description=es_exporter
Documentation=https://prometheus.io
After=network.target

[Service]
ExecStart=/usr/local/elasticsearch_exporter/elasticsearch_exporter --es.all --es.cluster_settings --es.indices --es.indices_settings --es.shards --es.snapshots --es.timeout=10s --web.listen-address ":9114" --web.telemetry-path "/metrics" --es.uri "http://172.16.53.120:19200"
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure


[Install]
WantedBy=multi-user.target

[Unit]
Description=es_exporter
After=network.target

elasticsearch_exporter参数:

      --collector.cluster-info  Enable the cluster-info collector (default: enabled).
      --web.listen-address=":9114"  
                                Address to listen on for web interface and telemetry.
      --web.telemetry-path="/metrics"  
                                Path under which to expose metrics.
      --es.uri="http://localhost:9200"  
                                HTTP API address of an Elasticsearch node.
      --es.timeout=5s           Timeout for trying to get stats from Elasticsearch.
      --es.all                  Export stats for all nodes in the cluster. If used, this flag will override the flag es.node.
      --es.node="_local"        Node's name of which metrics should be exposed.
      --es.indices              Export stats for indices in the cluster.
      --es.indices_settings     Export stats for settings of all indices of the cluster.
      --es.indices_mappings     Export stats for mappings of all indices of the cluster.
      --es.aliases              Export informational alias metrics.
      --es.cluster_settings     Export stats for cluster settings.
      --es.shards               Export stats for shards in the cluster (implies --es.indices).
      --es.snapshots            Export stats for the cluster snapshots.
      --es.slm                  Export stats for SLM snapshots.
      --es.data_stream          Export stas for Data Streams.
      --es.clusterinfo.interval=5m  
                                Cluster info update interval for the cluster label
      --es.ca=""                Path to PEM file that contains trusted Certificate Authorities for the Elasticsearch connection.
      --es.client-private-key=""  
                                Path to PEM file that contains the private key for client auth when connecting to Elasticsearch.
      --es.client-cert=""       Path to PEM file that contains the corresponding cert for the private key to connect to Elasticsearch.
      --es.ssl-skip-verify      Skip SSL verification when connecting to Elasticsearch.
      --log.level="info"        Sets the loglevel. Valid levels are debug, info, warn, error
      --log.format="logfmt"     Sets the log format. Valid formats are json and logfmt
      --log.output="stdout"     Sets the log output. Valid outputs are stdout and stderr
      --aws.region=""           Region for AWS elasticsearch
      --version                 Show application version.

3 启动exporter

systemctl start es_exporter.service

systemctl stop es_exporter.service

4 prometheus动态发现

prometheus.yml

  - job_name: 'es monitor'
    scrape_interval: 1m
    file_sd_configs:
     - files:
        - /usr/local/src/prometheus/conf.d/elasticsearch.json

elasticsearch.json

[
  {
    "labels": {
      "desc": "elasticsearch",
      "group": "elasticsearch",
      "host_ip": "172.16.53.117"
    },
    "targets": [
      "172.16.53.117:9114"
    ]
  }
]

5 Grafana dashboard

ID:14191

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
根据引用的内容,Elasticsearch_exporter_rules.yml是用来配置Elasticsearch集群告警规则的文件。这些规则是用来监控Elasticsearch服务的各种指标,并在满足某些条件时触发告警。具体的规则内容可以在该文件中找到。 另外,引用和引用提到了一些关于Prometheus监控服务的常见告警规则,其中也包括了Elasticsearch监控规则。通过配置这些规则,可以监控Elasticsearch的各项指标,例如节点状态、文档数量、查询性能等,并在出现异常情况时及时发出告警通知。 综上所述,要了解更多关于Prometheus监控Elasticsearch的告警规则,可以参考Elasticsearch_exporter_rules.yml文件以及其他相关的监控规则配置文件。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [三、Prometheus常用告警规则rules.yml](https://blog.csdn.net/yeqinghanwu/article/details/126367493)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] - *3* [prometheus 监控es规则](https://download.csdn.net/download/guleng90/80981220)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_2"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值