prometheus监控es,同样采用exporter的方案。

1、安装部署

现有es三节点的集群,环境大概如下:

主机 组件
192.168.75.11 prometheus
192.168.75.21 es,kibana,nginx

接着分别在如上三台主机上进行如下配置:

wget https://github.com/justwatchcom/elasticsearch_exporter/releases/download/v1.1.0/elasticsearch_exporter-1.1.0.linux-amd64.tar.gz
tar -zxv -f elasticsearch_exporter-1.1.0.linux-amd64.tar.gz
mv elasticsearch_exporter-1.1.0.linux-amd64 /usr/local/elasticsearch_exporter

创建用户等

groupadd prometheus
useradd -g prometheus -m -d /var/lib/prometheus -s /sbin/nologin prometheus
chown -R prometheus.prometheus /usr/local/elasticsearch_exporter

启动监控客户端:

nohup ./elasticsearch_exporter --web.listen-address ":9308"  --es.uri http://192.168.75.21:9200 &

使用systemd管理:

cat /lib/systemd/system/es_exporter.service

[Unit]
Description=The es_exporter
After=network.target [Service]
Type=simple
User=prometheus
ExecStart=/usr/local/elasticsearch_exporter/elasticsearch_exporter --web.listen-address ":9308" --es.uri http://192.168.75.21:9200
Restart=on-failure [Install]
WantedBy=multi-user.target

启动:

systemctl daemon-reload
systemctl start es_exporter
systemctl enable es_exporter

查看metrics:

curl 127.0.0.1:9308/metrics

2,配置 prometheus.yml 添加监控目标

vim /usr/local/prometheus/prometheus.yml

  - job_name: 'elasticsearch'
scrape_interval: 60s
scrape_timeout: 30s
metrics_path: "/metrics"
static_configs:
- targets: ['192.168.75.21:9308']
labels:
service: elasticsearch

重启服务。

systemctl restart prometheus

或者通过命令热加载:

curl  -XPOST localhost:9090/-/reload

5,配置 Grafana 的模板

模板通过json文件进行导入,文件就在解压的包内。

参考地址:https://shenshengkun.github.io/posts/550bdf86.html

或者通过如下ID进行导入:2322以及其他。





6,开启认证的启动方式

如果es开启了认证,那么启动的时候需要将用户名密码加载进去:

elasticsearch_exporter --web.listen-address ":9308"  --es.uri http://username:password@192.168.75.21:9200 &

其中使用的是monitoring的用户密码。

当然,除去这种命令行的启动方式之外,还可以像上边一样,基于systemd进行管理,只需将认证的参数信息写入到如下内容当中:

参考网址:https://github.com/justwatchcom/elasticsearch_exporter

cat /etc/default/elasticsearch_exporter

[Unit]
Description=The es_exporter
After=network.target [Service]
Type=simple
User=prometheus
ExecStart=/usr/local/elasticsearch_exporter/elasticsearch_exporter --web.listen-address ":9308" --es.uri=http://username:password@192.168.75.21:9200
Restart=on-failure [Install]
WantedBy=multi-user.target

6.监控elasticsearch集群---放弃采用(获取不到数据),建议看另一篇文章:监控elasticsearch的更多相关文章

  1. shell脚本监控k8s集群job状态,若出现error通过触发阿里云的进程监控报警

    #!/bin/bash while [ 1 ] do job_error_no=`kubectl get pod -n weifeng |grep -i "job"|grep -c ...

  2. Elasticsearch集群 管理

    第7章 深入Elasticsearch集群 启动一个Elasticsearch节点时,该节点会开始寻找具有相同集群名字并且可见的主节点.如 果找到主节点,该节点加入一个已经组成了的集群:如果没有找到, ...

  3. 手把手教你搭建一个 Elasticsearch 集群

    为何要搭建 Elasticsearch 集群 凡事都要讲究个为什么.在搭建集群之前,我们首先先问一句,为什么我们需要搭建集群?它有什么优势呢? 高可用性 Elasticsearch 作为一个搜索引擎, ...

  4. ElasticSearch 集群监控

    要监控哪些 ElasticSearch metrics? Elasticsearch 提供了大量的 Metric,可以帮助您检测到问题的迹象,在遇到节点不可用.out-of-memory.long g ...

  5. zabbix监控Elasticsearch集群

    本节以 zabbix 为例,介绍如何使用监控系统完成 Elasticsearch 的监控报警. github 上有好几个版本的 ESZabbix 仓库,都源自 Elastic 公司员工 unterge ...

  6. Prometheus监控elasticsearch集群(以elasticsearch-6.4.2版本为例)

    部署elasticsearch集群,配置文件可"浓缩"为以下: cluster.name: es_cluster node.name: node1 path.data: /app/ ...

  7. Elasticsearch 集群优化-尽可能全面详细

    Elasticsearch 集群优化-转载参考1 基本配置 基本配置,5台配置为 24C 125G 17T 的主机,每台主机上搭建了一个elasticsearch节点. 采用的elasticsearc ...

  8. Docker部署Elasticsearch集群

    http://blog.sina.com.cn/s/blog_8ea8e9d50102wwik.html Docker部署Elasticsearch集群 参考文档: https://hub.docke ...

  9. Elasticsearch 集群 单服务器 超级详细教程

    前言 之前了解了Elasticsearch的基本概念.将spring boot + ElasticSearch + head插件 搞通之后.紧接着对es进行下一步的探索:集群.查阅资料的过程中,找到了 ...

随机推荐

  1. APISpace 绕口令API接口 免费好用

    绕口令又称急口令.吃口令.拗口令等.是一种民间传统的语言游戏 ,由于它是将若干双声.叠韵词或发音相同.相近的语.词有意集中在一起,组成简单.有趣的语韵,要求快速念出,所以读起来使人感到节奏感强,妙趣横 ...

  2. rust中的ref

    理解Rust的引用与借用(好文链接) #![feature(core_intrinsics)] fn print_type_of<T>(_: T) { println!("{}& ...

  3. 用js获取当前页面的url

    1.获取当前或者指定页面的文件名或路径 window.location.pathname 2.设置或获取整个URl字符串 window.location.href 3.设置或获取URL相关的端口号 w ...

  4. 5.26 NOI 模拟

    \(T1\)石子与HH与HHの取 博弈是不可能会的 \(c_i\)相等,比较显然的\(Nim,\)直接前缀异或求一下 \(a_i=1,\)区间长度对\(2\)取模 结论\(:\)黑色石子严格大于白色个 ...

  5. P1980 计数问题 - 记录

    P1980 计数问题 题目描述 试计算在区间 1 到 n的所有整数中,数字x(0 ≤ x ≤ 9)共出现了多少次?例如,在 1到11中,即在 1,2,3,4,5,6,7,8,9,10,11中,数字1出 ...

  6. Pulsar Summit Asia 2020 中文专场议题出炉!

    关于 Apache Pulsar Apache Pulsar 是 Apache 软件基金会顶级项目,是下一代云原生分布式消息流平台,集消息.存储.轻量化函数式计算为一体,采用计算与存储分离架构设计,支 ...

  7. 主流前沿的开源监控和报警系统Prometheus+Grafana入门之旅

    Prometheus概述 定义 Prometheus 官网地址 https://prometheus.io/ Prometheus 官网文档地址 https://prometheus.io/docs/ ...

  8. Luogu1816 忠诚 (ST表)

    继续复习模板,加深理解ing... #include <iostream> #include <cstdio> #include <cstring> #includ ...

  9. Spring 02: Spring接管下的三层项目架构

    业务背景 需求:使用三层架构开发,将用户信息导入到数据库中 目标:初步熟悉三层架构开发 核心操作:开发两套项目,对比Spring接管下的三层项目构建和传统三层项目构建的区别 注意:本例中的数据访问层, ...

  10. Unity3D学习笔记12——渲染纹理

    目录 1. 概述 2. 详论 3. 问题 1. 概述 在文章<Unity3D学习笔记11--后处理>中论述了后处理是帧缓存(Framebuffer)技术实现之一:而另外一个帧缓存技术实现就 ...