Prometheus监控elasticsearch

2022-10-27 14:41:49 浏览数 (3)

下载elasticsearch_exporter

https://github.com/justwatchcom/elasticsearch_exporter/releases 解压后,把elasticsearch_exporter拷贝到/usr/local/bin/目录下

创建启动脚本

vim /usr/lib/systemd/system/elasticsearch_exporter.service

代码语言:javascript复制
[Unit]
Description=The es_exporter
After=network.target

[Service]
Type=simple
User=root
ExecStart=/usr/local/bin/elasticsearch_exporter --web.listen-address ":9114" --es.uri http://127.0.0.1:9200
Restart=on-failure

[Install]
WantedBy=multi-user.target

启动

代码语言:javascript复制
systemctl daemon-reload
systemctl start elasticsearch_exporter
systemctl enable elasticsearch_exporter

修改prometheus配置

vim /etc/prometheus/prometheus.yml

代码语言:javascript复制
...
- job_name: 'elasticsearch_cluster'
  static_configs:
    - targets:
      - 192.168.0.100:9114
      - 192.168.1.200:9114
...

重新加载prometheus配置

0 人点赞