当前位置:网站首页>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']
边栏推荐
- LevelFilter简介说明
- Tp6 use protobuf
- Vue router route cache
- 5-integrate swagger2
- Section 7 - compilation of programs (preprocessing operations) + links
- Spingboot integrates the quartz framework to realize dynamic scheduled tasks (support real-time addition, deletion, modification and query tasks)
- thinkphp6 实现数据库备份
- logback filter过滤器简介说明
- Some learning and understanding of vintage analysis
- QT连接两个qslite数据库报错QSqlQuery::exec: database not open
猜你喜欢

WPF nested layout case

Ansible中的变量及加密
![[OpenGL] use of shaders](/img/73/1322afec8add6462ca4b82cb8112d1.png)
[OpenGL] use of shaders

WPF simple login page completion case

Using C language to skillfully realize the chess game -- Sanzi chess

Excel file reading and writing (creation and parsing)

我,28岁,测试员,10月无情被辞:想给还在学测试 的人提个醒......

Vite3.0 has been released, can you still roll it (list of new features)

Why does ETL often become ELT or even let?

2022-07-28: what is the output of the following go language code? A:AA; B:AB; C:BA; D:BB。 package main import ( “fmt“ ) func main() { f
随机推荐
Scala higher order (IX): pattern matching in Scala
时钟树综合(一)
我,28岁,测试员,10月无情被辞:想给还在学测试 的人提个醒......
Excel file reading and writing (creation and parsing)
Nodejs installation tutorial
WPF nested layout case
[100 cases of unity practice] the single choice multiple choice judgment questions of unity universal question answering system are all common
How does MySQL convert rows to columns?
力扣(LeetCode)209. 长度最小的子数组(2022.07.28)
Summary of OCR optical character recognition methods
Comparison of advantages between can & canfd integrated test analysis software lkmaster and PCA Explorer 6 analysis software
Life cycle hooks in routing - activated and deactivated
Problems encountered in vmware16 installing virtual machines
Remote invocation of microservices
Can I specify memory parameters in SQL statements?
Gin parameter validation
Zabbix 其他基础监控项
logback 中FileAppender具有什么功能呢?
Leetcode buckle classic problem -- 4. Find the median of two positively ordered arrays
Variables and encryption in ansible