当前位置:网站首页>Prometheus与Grafana
Prometheus与Grafana
2022-07-29 07:07:00 【jjt_!!】
一套监控进程,Prometheus用于存储监控数据,Grafana以图标的形式将各种数据通过图表的形式展示出来。
| 插件 | 默认端口 | dashboard ID | 备注 |
|---|---|---|---|
| Node Exporter | 9100 | 11074 | 监控服务器数据 |
| process exporter | 9256 | 249 | 以进程维度进行数据监控 |
| redis_exporter | 9121 | 监控redis | |
| mysqld_exporter | 9104 | 7362 | 监控mysql |
查看数据的基本方式: curl localhost:port/metricsprometheus的原始页面:http:ip:9090,输入指标量等信息就可以进行原始的数据查询。一般使用grafana的进行指标量的展示
prometheus的配置文件prometheus.yml,基本格式见图。job_name对应一个job,下边可配置多个targets,target为部署对应插件的机器的信息;
使用grafana的情况下:安装dashboard的方式,在下面页面输入id即可。id号可以从官网【https://grafana.com/grafana/dashboards】查询获取:
Node Exporter
部署在节点机器上,启动: ./node_exporter
在
监控链接: https://www.ipcpu.com/2021/04/prometheus-node_exporter/
在prometheus上的配置
- job_name: '44_141_pro'
static_configs:
- targets: ['10.130.44.141:9100']
process exporte
官网地址
https://github.com/ncabatoff/process-exporter/
部署
以进程维度去进行监控,部署在进程允许的节点上
启动方式: ./process-exporter -config.path config.yml
配置方式:
process_names:
- name: "{
{.Comm}}"
cmdline:
- 'go-call-distrib'
name: 适配各种匹配规则
- { {.Comm}}包含原始可执行文件的基本名称,即中的第二个字段/proc//stat
- { {.ExeBase}}包含可执行文件的基本名称 { {.ExeFull}}包含可执行文件的完全限定路径
- { {.Username}}包含有效用户的用户名 { {.Matches}}map 包含应用 cmdline regexps 产生的所有匹配项
- { {.PID}}包含进程的PID。请注意,使用 PID 意味着该组将仅包含一个进程。
- { {.StartTime}}包含进程的开始时间。这可以与 PID 结合使用,因为 PID 会随着时间的推移而重复使用。
- { {.Cgroups}}包含(如果支持)进程的 cgroup (
/proc/self/cgroup)。这对于识别进程属于哪个容器特别有用。
process_names必须包含一个或多个选择器(comm,exe
或cmdline);如果存在多个选择器,它们必须全部匹配。每个选择器都是一个字符串列表,用于匹配进程的comm, argv[0],或者在
的情况下cmdline,是应用于命令行的正则表达式。
在prometheus上的配置
- job_name: '44_141_pro'
static_configs:
- targets: ['10.130.44.141:9256']
redis_exporte
在redis部署的机器部署
启动命令(redis的连接ip及密码)./redis_exporter -redis.addr 10.130.44.103:6380 -redis.password 123456
在prometheus上的配置
- job_name: 'redis_exporter_targets'
static_configs:
- targets:
- redis://10.130.44.103:6380
- redis://10.130.44.103:6381
- redis://10.130.44.103:6382
- redis://10.130.44.141:6383
- redis://10.130.44.141:6384
- redis://10.130.44.141:6385
metrics_path: /scrape
relabel_configs:
- source_labels: [__address__]
target_label: __param_target
- source_labels: [__param_target]
target_label: instance
- target_label: __address__
replacement: 10.130.44.103:9121
## config for scraping the exporter itself
- job_name: 'redis_exporter'
static_configs:
- targets:
- 10.130.44.103:9121
mysqld_exporter
在mysql所在的机器部署
启动命令: ./mysqld_exporter --config.my-cnf=.mysqld_exporter.cnf
在需监控的mysql数据库上创建用户:
grant select,replication client, process on *.* to 'mysql_monitor'@'localhost' identified by '123456';
flush privileges;
配置文件(隐藏文件格式):
[client]
user=mysql_monitor
password=123456

在prometheus上的配置
- job_name: '44_103_mysql'
static_configs:
- targets: ['10.130.44.103:9104']
边栏推荐
- Gin template
- Thinkphp6 realizes database backup
- Win11 system error: code execution cannot continue because ierutil.dll cannot be found. Reinstalling the program may fix this problem
- WPF interface layout must know basis
- 我,28岁,测试员,10月无情被辞:想给还在学测试 的人提个醒......
- WPF simple login page completion case
- Spingboot integrates the quartz framework to realize dynamic scheduled tasks (support real-time addition, deletion, modification and query tasks)
- Introduction to logback filter
- Ansible中的变量及加密
- Other basic monitoring items of ZABBIX
猜你喜欢

用户列表 圆形头像并跟随小板块

Leetcode 879. profit plan

QT基础第二天(2)qt基础部件:按钮类,布局类,输出类,输入类,容器等个别举例

微服务远程调用

ETL为什么经常变成ELT甚至LET?

Some learning and understanding of vintage analysis

CMOS芯片制造全工艺流程

Win11vmware turns on the virtual machine and restarts on the blue screen and the solution that cannot be started

Use vscode to configure Mysql to realize connection, query, and other functions

After 4 years of development and 13K, if you want to change to automated testing, can your salary still rise···
随机推荐
Amazon cloud assistant applet is coming!
【Unity实战100例】Unity万能答题系统之单选多选判断题全部通用
logback appender简介说明
JS 鸡生蛋与蛋生鸡问题,Object与Function究竟谁出现的更早?Function算不算Function的实例?
Excel file reading and writing (creation and parsing)
Thinkphp6 realizes database backup
Cvpr2021 | multi view stereo matching based on self supervised learning (cvpr2021)
Ansible中的变量及加密
5-integrate swagger2
[redis] redis development specifications and precautions
[OpenGL] use of shaders
H3C_ Using setting default static routing priority to realize the active and standby function of export dual lines
Latest 10 billion quantitative private placement list
My personal website doesn't allow access to wechat, so I did this
Redis Basics
使用VsCode配置MySQL实现连接、查询、等功能
QT topic: basic components (button class, layout class, output class, input class, container class)
Does Flink support sqlserver databases? Get the changes of SQLSERVER database
反射reflect
Scala 高阶(九):Scala中的模式匹配