Elasticsearch_export配置
1.下载elasticsearch_exporter-1.7.0.linux-amd64.tar.gz
2.上传安装包到服务器,并解压:
tar -xvf elasticsearch_exporter-1.7.0.linux-amd64.tar.gz
3.测试启动elasticsearch_exporter
cd elasticsearch_exporter-1.7.0.linux-amd64
nohup ./elasticsearch_exporter --es.all --es.indices --es.indices_settings --es.shards --es.node=_local --es.timeout=5s --web.listen-address=172.16.10.208:9114 --web.telemetry-path=/metrics --es.uri=http://elastic:123456@172.16.10.206:9200 &
4.配置开机启动
vi /usr/lib/systemd/system/elasticsearch_export.service
[Unit]
Description=elasticsearch_export
After=network.target
[Service]
User=root
Type=simple
ExecStart=/root/elasticsearch_exporter-1.7.0.linux-amd64/elasticsearch_exporter --es.all --es.indices --es.indices_settings --es.shards --es.node=_local --es.timeout=5s --web.listen-address=172.16.10.208:9114 --web.telemetry-path=/metrics --es.uri=http://elastic:123456@172.16.10.206:9200
Restart=on-failure
[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl restart elasticsearch_export.service
systemctl enable elasticsearch_export.service
Prometheus配置
在 prometheus.yml 中添加如下配置:
scrape_configs:
- job_name: 'elasticsearch'
static_configs:
- targets: ['172.16.10.206:9114']
重启Prometheus