prometheus 监控jvm(上)


1.setup prom

https://prometheus.io/

https://github.com/prometheus/prometheus/releases/tag/v1.6.2

nohup ./prometheus --config.file=prometheus.yml &

WEB页面访问http://localhost:9090/ ,可以看到Prometheus的graph页面。

 

2 热加载配置

curl -X POST http://localhost:9090/-/reload

 

3 node exporter / mysql exporter client

https://prometheus.io/download/

https://github.com/prometheus

 mysql 还需要编辑:.my.cnf

[client]
host=127.0.0.1
user=fast
password=1qaz@WSX

 nohup ./node_exporter &

nohup ./mysqld_exporter --config.my-cnf=".my.cnf" &

通过localhost:9104,9100 就可以看到exporter导出的数据了:

 

4 server  vi prometheus.yml

 37   - job_name: 'linux'
 38     static_configs:
 39     - targets: ['192.168.57.67:9100']
 40       labels:
 41          instance: db1

 

 31   - job_name: 'mysql'
 32     static_configs:
 33     - targets: ['192.168.57.67:9104']
 34       labels:
 35          instance: db1

 

重启prometheus,点击导航栏中的status->targets可以看到,mysql的exporter已经集成进来了。 
这里写图片描述

 

https://blog.csdn.net/hfut_wowo/article/details/78536022

 

 

5 grafana setup

http://docs.grafana.org/installation/rpm/

1、安装

1
2
3
wget https: / / s3 - us - west - 2.amazonaws .com / grafana - releases / release / grafana - 4.2 . 0 - 1.x86_64 .rpm
sudo yum install initscripts fontconfig  - y
sudo rpm  - Uvh grafana - 4.2 . 0 - 1.x86_64 .rpm

2、启动服务service grafana-server start

3、访问页面http://localhost:3000 ,默认账号、密码admin/admin

 

 

6 Prometheus 和 Grafana 的对接

datasource

 

7  node  mysql   dashboards

import .json 文件:https://grafana.com/dashboards   挑选喜欢的

这里写图片描述

 

https://www.cnblogs.com/shhnwangjian/p/6878199.html

 

 

12.11

redis

wget https://github.com/oliver006/redis_exporter/releases/download/v0.15.0/redis_exporter-v0.15.0.linux-amd64.tar.gz
tar -zxvf redis_exporter-v0.15.0.linux-amd64.tar.gz -C /prometheus_exporters --strip-components=1
 
./redis_exporter
- job_name: redis_exporter
  static_configs:
  - targets: ['192.168.0.17:9122']

json模版可以使用763


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM