Prometheus的搭建与使用

一、安装Prometheus

官网下载地址:Download | Prometheus

复制代码
解压:tar -zxvf prometheus-2.19.2.linux-amd64.tar.gz

重命名: mv prometheus-2.19.2.linux-amd64 /home/prometheus

进入对应目录: cd /home/prometheus

查看配置文件:cat prometheus.yml

# 前台启动
./prometheus --config.file=prometheus.yml

# 后台启动
nohup ./prometheus --config.file=prometheus.yml > ./prometheus.log 2>&1 &

验证是否成功:http://***.***.***.***:9090/graph

如果查不到数据可以检查下我们的targets是否有报错

二、安装Grafana

官方下载地址:Download Grafana | Grafana Labs

复制代码
下载:wget https://dl.grafana.com/oss/release/grafana-7.0.5-1.x86_64.rpm 

安装:yum install grafana-7.0.5-1.x86_64.rpm

启动:systemctl daemon-reload
systemctl enable grafana-server.service
systemctl start grafana-server.service

验证是否成功:http://***.***.***.***:3000

默认用户名密码都是admin,初次登录会要求修改默认的登录密码

添加数据源

1.点击DATA SOURCES

2.选择Prometheus

3.Dashboards中import "Prometheus 2.0 Stats"

4.Settings界面填写服务器地址

5.切换界面

五、添加监控项

1.linux

下载node_exporter:

wget https://github.com/prometheus/node_exporter/releases/download/v1.0.1/node_exporter-1.0.1.linux-amd64.tar.gz

解压:tar -zxvf node_exporter-1.0.1.linux-amd64.tar.gz

启动: ./node_exporter &

注释:记得查看防火墙9100端口是否开启

这时候会看到如下警告

复制代码
level=info ts=2020-07-09T02:24:55.402Z caller=tls_config.go:170 msg="TLS is disabled and it cannot be enabled on the fly." http2=false

这是因为Node Exporter 自v1.0.0 版本加了TLS验证(这个在后序篇幅讲,此次跳过)

到官网选择一个喜欢的仪表盘:Dashboards | Grafana Labs

查看id

导入仪表盘

在文本框里输入对应id即可导入

相关推荐
小阳睡不醒5 小时前
小白成长之路-部署prometheus监控平台
prometheus
运维成长记4 天前
云原生监控系统 Prometheus大总结 20250909
云原生·prometheus
_何同学4 天前
Spring Boot 监控实战:集成 Prometheus 与 Grafana,打造全方位监控体系
spring boot·grafana·prometheus
g66x6 天前
自建prometheus监控腾讯云k8s集群
kubernetes·腾讯云·prometheus
苦逼IT运维7 天前
Jenkins 监控方案:Prometheus + Grafana 实践
jenkins·grafana·prometheus
迦蓝叶8 天前
JAiRouter 配置文件重构纪实 ——基于单一职责原则的模块化拆分与内聚性提升
java·网关·ai·重构·openai·prometheus·单一职责原则
会飞的小蛮猪9 天前
Jenkins运维之路(权限分配&忘记admin密码)
java·运维·经验分享·jenkins·prometheus
川石课堂软件测试9 天前
Oracle 数据库:视图与索引
数据库·网络协议·nginx·http·oracle·grafana·prometheus
川石课堂软件测试10 天前
Oracle 数据库如何查询列
linux·数据库·sql·功能测试·oracle·grafana·prometheus
川石课堂软件测试10 天前
Oracle 数据库使用事务确保数据的安全
数据库·python·功能测试·docker·oracle·单元测试·prometheus