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即可导入

相关推荐
江南风月14 小时前
WGCLOUD监控系统的Restful Http接口一览
运维·zabbix·运维开发·prometheus
文青小兵16 小时前
Linux云计算——docker 监控(五)
linux·docker·云计算·grafana·prometheus
weixin_468466851 天前
Prometheus监控服务部署与实战指南
服务器·后端·python·docker·自动化·prometheus
江华森2 天前
Prometheus 全栈监控体系部署与使用指南
prometheus
codeejun3 天前
每日一Go-70、Prometheus + Grafana 从采集到告警的完整实战(Go + Kind)
golang·grafana·prometheus
Cat_Rocky5 天前
k8s-Prometheus的manifests 清单部署
linux·kubernetes·prometheus
成为你的宁宁5 天前
【Prometheus基于文件的服务发现】
服务发现·prometheus
zhojiew5 天前
在Ray集群中使用vLLM部署LLM模型并集成Prometheus和Grafana进行指标观测的实践
grafana·prometheus·vllm
Cat_Rocky6 天前
K8S部署EFK日志收集技术栈
容器·kubernetes·prometheus
D4c-lovetrain6 天前
云原生实战:K8s 一键部署 Prometheus+Grafana+EFK 完整可观测平台
云原生·kubernetes·prometheus