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. 阿里云 python3 使用duplicity

    前言 公司业务中使用的备份工具一直是alicloud-duplicity,一直也没研究.后来业务出问题了,看了看,原来是基于duplicity开发的,使用了半天,感觉很不错,我感觉他的特点有: 加密备 ...

  2. ETL工具 (二)sqoop 数据同步工具

    Sqoop简介 将关系数据库(oracle.mysql.postgresql等)数据与hadoop数据进行转换的工具. 官网: http://sqoop.apache.org/ 版本:(两个版本完全不 ...

  3. 「Python实用秘技09」更好用的函数运算缓存

    本文完整示例代码及文件已上传至我的Github仓库https://github.com/CNFeffery/PythonPracticalSkills 这是我的系列文章「Python实用秘技」的第9期 ...

  4. C# 委托/事件本质详解

    委托 一.什么是委托 IL层面1>委托的本质就是一个类2>继承自System.MulticastDelegate3>委托里面内置了3个方法:Invoke(),BeginInvoke( ...

  5. 基于.NetCore开发博客项目 StarBlog - (16) 一些新功能 (监控/统计/配置/初始化)

    系列文章 基于.NetCore开发博客项目 StarBlog - (1) 为什么需要自己写一个博客? 基于.NetCore开发博客项目 StarBlog - (2) 环境准备和创建项目 基于.NetC ...

  6. DQL分组查询和DQL分页查询

    分组查询: 1.语法:group by 分组字段: 2.注意: 分组之后查询的字符按:分组字段.聚合函数 where 和having 的区别 where再分组前进行限定,如果不满足条件则不参与分组.h ...

  7. 利用本地HTTPS模拟环境为FastAPI框架集成FaceBook社交三方登录

    原文转载自「刘悦的技术博客」https://v3u.cn/a_id_174 提起社交,就不得不说马克·扎克伯格(Mark Zuckerberg)一手创办的社交网络(FaceBook).进入2020年, ...

  8. Taurus.MVC V3.0.3 微服务开源框架发布:让.NET 架构在大并发的演进过程更简单。

    前方: 开源地址:https://github.com/cyq1162/Taurus.MVC 上篇文章介绍过:工业制造行业的低代码开发平台思维架构图 规划中涉及到了微服务,近些天经过努力和不断的代码与 ...

  9. Redis 09 基数

    参考源 https://www.bilibili.com/video/BV1S54y1R7SB?spm_id_from=333.999.0.0 版本 本文章基于 Redis 6.2.6 概述 Redi ...

  10. 一文带你认知定时消息发布RocketMQ

    摘要:DMS任意时间定时消息能力发布. DMS是华为云的分布式消息中间件服务.适用于解决分布式架构中的系统解耦.跨系统跨地域数据流通.分布式事务协调等难题,协助构建优雅的现代化应用架构,提供可兼容 K ...