prometheus 监控告警安装与设置
1、什么是Prometheus?
Prometheus (普罗米修斯)是由 SoundCloud开发的开源监控报警系统和时序列数据库 。
2、Prometheus的特点
- 多维度数据模型。 灵活的查询语言。
- 不依赖分布式存储,单个服务器节点是自主的。
- 通过基于HTTP的pull方式采集时序数据。
- 可以通过中间网关进行时序列数据推送。
- 通过服务发现或者静态配置来发现目标服务对象。
- 支持多种多样的图表和界面展示,比如Grafana等。
官网地址:
https://prometheus.io/
3、基本原理
Prometheus的基本原理是通过HTTP协议周期性抓取被监控组件的状态,任意组件只要提供对应的HTTP接口就可以接入监控。
4、架构图
5、安装prometheus
官网下载,解压即可使用
wget https://github.com/prometheus/prometheus/releases/download/v2.30.3/prometheus-2.30.3.linux-amd64.tar.gz
配置文件:
vi prometheus.yml
启动prometheus
./prometheus &
prometheus 加到系统服务
# vi /etc/systemd/system/prometheus.service[Unit]
Description=Prometheus Monitoring System
Documentation=Prometheus Monitoring System[Service]
ExecStart=/data/app/prometheus/prometheus --config.file=/data/app/prometheus/prometheus.yml --web.listen-address=:9080[Install]
WantedBy=multi-user.target
** 6、promethus 监控MySQL**
1、安装mysqld_exporter
下载解压安装即可
官网 https://github.com/prometheus/mysqld_exporterwget https://github.com/prometheus/mysqld_exporter/releases/download/v0.13.0/mysqld_exporter-0.13.0.linux-amd64.tar.gz
2、配置:
# vi /usr/local/mysqld_exporter/.my.cnf[client]
port=3306
user=user_repel
password=password
3、启动:
./mysqld_exporter --config.my-cnf=.my.cnf
4、prometheus.yml的scrape_configs节点增加如下配置
之后重启prometheus
- job_name: "mysql"# metrics_path defaults to '/metrics'# scheme defaults to 'http'.static_configs:- targets: ["127.0.0.1:9104"]
5、Grafana中MySQL的Dashboard ID
7362
** 7、安装grafana**
wget https://dl.grafana.com/enterprise/release/grafana-enterprise-8.2.1.linux-amd64.tar.gz
tar -zxvf grafana-enterprise-8.2.1.linux-amd64.tar.gz
启动
./bin/grafana-server -config conf/defaults.ini &
访问
http://localhost:300
admin
admin
增加邮件smtp配置
enabled = true #默认是false
host = smtp.mxhichina.com:465 #smtp服务器地址
user = test@xxx.com #你登录邮箱的账号
password = xxxxxxx #你邮箱账号的密码
from_address = test@xxx.com #发邮件的账号
from_name = Grafana #自定义的名字
ehlo_identity = dashboard.example.com #无关紧要的一个标示
8、监控elasticsearch
解压即完成安装。
#官网 https://github.com/prometheus-community/elasticsearch_exporter/releaseswget https://github.com/prometheus-community/elasticsearch_exporter/releases/download/v1.2.1/elasticsearch_exporter-1.2.1.linux-amd64.tar.gz
启动
nohup ./elasticsearch_exporter --es.all --es.indices --es.cluster_settings --es.indices_settings --es.shards --es.snapshots --es.timeout=10s --web.list
en-address=":9105" --web.telemetry-path="/metrics" --es.uri http://127.0.0.1:8607 &
prometheus.yml的scrape_configs节点增加如下配置
之后重启prometheus
- job_name: 'es_19' static_configs:- targets: ['127.0.0.1:9105']
Grafana中elasticsearch的Dashboard ID
2322
9、监控redis
下载解压即安装。
https://github.com/oliver006/redis_exporterwget https://github.com/oliver006/redis_exporter/releases/download/v1.27.1/redis_exporter-v1.27.1.linux-amd64.tar.gz
启动
#对一个redis服务进行监控
nohup ./redis_exporter -redis.addr 47.103.23.154:6379 -redis.password 123456 -web.listen-address 0.0.0.0:9122 &#对多个redis服务进行监控
nohup ./redis_exporter -redis.addr 47.103.23.154:6379,47.103.23.164:6379 -redis.password 123456 -web.listen-address 0.0.0.0:9122 &
prometheus.yml的scrape_configs节点增加如下配置
之后重启prometheus
- job_name: 'redis_15' static_configs:- targets: ['127.0.0.1:9106']
9、监控rabbitmq
官网下载,解压即安装
https://github.com/kbudde/rabbitmq_exporter/wget https://github.com/kbudde/rabbitmq_exporter/releases/download/v1.0.0-RC8/rabbitmq_exporter-1.0.0-RC8.linux-amd64.tar.gz
增加config.json配置
{"rabbit_url": "http://127.0.0.1:15672","rabbit_user": "monitor", #必须具备admin权限"rabbit_pass": "1","publish_port": "9107","publish_addr": "","output_format": "TTY","ca_file": "ca.pem","cert_file": "client-cert.pem","key_file": "client-key.pem","insecure_skip_verify": false,"exlude_metrics": [],"include_queues": ".*","skip_queues": "^$","skip_vhost": "^$","include_vhost": ".*","rabbit_capabilities": "no_sort,bert","enabled_exporters": ["exchange","node","overview","queue"],"timeout": 30,"max_queues": 0
}
启动
nohup ./rabbitmq_exporter -config-file config.json &
prometheus.yml的scrape_configs节点增加如下配置
之后重启prometheus
- job_name: 'rabbitmq_15' static_configs:- targets: ['127.0.0.1:9107']
prometheus 监控告警安装与设置相关推荐
- 服务器运维监控指标,运维体系~指标监控~Prometheus监控告警与日志
一 Prometheus 入门 1.1 入门介绍 运维体系~指标监控 先来一张图,说明一下Prometheus监控相关的软件和知识点. 1: 首先要安装:Prometheus, 负责收集各种监控指标, ...
- prometheus监控+告警
1 开始安装前的准备 1.1 修改主机名 1.2 关闭防火墙 1.3 关闭seliunx 1.4 关闭防火墙 1.5 下载阿里云的yum源 2 下载所用到的包 2.1 安装 node_porter 2 ...
- Prometheus监控告警
监控告警-Prometheus 第一章:概述 本章将介绍监控告警的一些基本概念. 1.1 什么是监控告警? 监控是什么? 说白了就是用一种形式去盯着.观察服务器,把服务器的各种行为表现都显示出来,用以 ...
- prometheus监控告警功能
prometheus监控K8S 监控告警功能 alertmanager邮箱告警配置 首先开通SMTP服务,QQ邮箱:设置–帐号–开通POP3/SMTP服务,记住生成的密码(其它邮箱同理) 编辑prom ...
- Prometheus监控告警搭建(一)
一.监控组件 监控需要的组件 alertmanager-0.21.0.linux-amd64.tar.gzgrafana-7.4.0.linux-amd64.tar.gzmysqld_exporter ...
- Prometheus监控告警规则
Prometheus监控MongoDB报警规则.MySQL报警规则.Nginx报警规则.Redis报警规则. MongoDB报警规则 报警名称 表达式 采集数据时间(分钟) 报警触发条件 Mongod ...
- 自从上线了 Prometheus 监控告警,真香!
点击上方蓝色"方志朋",选择"设为星标" 回复"666"获取独家整理的学习资料! 对很多人来说,未知.不确定.不在掌控的东西,会有潜意识的逃 ...
- 阿里云Prometheus监控服务
什么是Prometheus? Prometheus是一个开源系统监控和警报工具包 原生Prometheus:Overview | Prometheus 工作原理:prometheus原理简介_袁胜的博 ...
- zabbix监控告警表报统计
发送邮件的脚本 #!/usr/bin/python #coding:utf-8 import smtplib, time, os from email.mime.text import MIMETex ...
最新文章
- 微软旷视人脸识别100%失灵!北京十一学校校友新研究「隐身衣」,帮你保护照片隐私数据...
- MySQL——数据库的增删改操作
- Intel Realsense D435 opencv 为什么将color图转换成灰度图后,再与depth图水平堆叠,其结果一片黑色?(数据未map到0-255)
- dart系列之:dart语言中的函数
- 动态规划 最长上升子序列
- css div设置inline-block后 div顶部对齐
- LeetCode MySQL 1179. 重新格式化部门表
- filter IE滤镜(Internet Explorer)CSS
- python兔子繁殖问题中如何输出相应月份的数列_斐波那契数列介绍及Python中五种方法斐波那契数列...
- [13年迁移]公司服务器坏了,无聊按面向对象的方法分析下javascript的空值和假值...
- JEECG登陆全过程
- 完数(完备数、完美数)
- 大班科学电子计算机,计算器教案
- python读坐标像素_python如何读取像素值
- 汇编语言aaa指令解析,aas指令解析
- MyExcel 2.1.3 发布,提供行级读取处理能力
- 联想e470加装固态硬盘_联想e470能不能加固态硬盘?
- 新疆大盘鸡的标准做法
- windows server 2012 使用包管理工具choco安装程序
- 微信小程序 API的 promise化