首页
找靠谱产品
找解决方案
找靠谱公司
找案例
找对的人
专家智库
悬赏任务
SAAS
ToB门户
了解全球最新的ToB事件
论坛
潜水/灌水快乐,沉淀知识,认识更多同行。
ToB圈子
加入IT圈,遇到更多同好之人。
微博
Follow
记录
Doing
博客
Blog
文库
业界最专业的IT文库,上传资料也可以赚钱
下载
分享
Share
排行榜
Ranklist
相册
Album
应用中心
qidao123.com ToB IT社区-企服评测·应用市场
»
论坛
›
数据库
›
Oracle
›
docker安装Prometheus+Grafana
返回列表
发新帖
docker安装Prometheus+Grafana
[复制链接]
发表于 2025-5-20 14:36:20
|
显示全部楼层
|
阅读模式
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要
登录
才可以下载或查看,没有账号?
立即注册
×
docker 安装Prometheus
下载镜像
很多镜像
服务器
都不可了,我用的这个地址还可以
查看可用docker镜像地址:https://cloud.tencent.com/developer/article/2485043
docker pull docker.xuanyuan.me/prom/prometheus:latest
复制
代码
启动
docker run -itd --name=prometheus --restart=always -p 9090:9090 docker.xuanyuan.me/prom/prometheus
复制
代码
访问
服务地址:
http://192.168.1.2:9090/query
192.168.1.2为
服务器
ip
复制
代码
安装Node_exporter
下载镜像
docker pull docker.xuanyuan.me/prom/node-exporter:latest
复制代码
启动
docker run -itd --name=node-exporter --restart=always -p 9101:9100 -v "/proc:/host/proc:ro" -v "/sys:/host/sys:ro" -v "/:/rootfs:ro" docker.xuanyuan.me/prom/node-exporter
复制代码
访问
访问地址
http://192.168.1.2:9101/metrics
192.168.1.2为
服务器
ip
9101为端口,默认端口是9100,我是端口被占改了一下
复制代码
设置Prometheus
把
容器
内设置文件拷贝出来
docker cp prometheus:/etc/prometheus/prometheus.yml $PWD
复制代码
编辑
vim prometheus.yml
复制代码
内容
# my global config
global:
scrape_interval: 15s # Set the scrape interval to every 15 seconds. Default is every 1 minute.
evaluation_interval: 15s # Evaluate rules every 15 seconds. The default is every 1 minute.
# scrape_timeout is set to the global default (10s).
# Alertmanager configuration
alerting:
alertmanagers:
- static_configs:
- targets:
# - alertmanager:9093
# Load rules once and periodically evaluate them according to the global 'evaluation_interval'.
rule_files:
# - "first_rules.yml"
# - "second_rules.yml"
# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
- job_name: "linux"
static_configs:
- targets: [ '192.168.1.2:9101' ] #被
监控
端的IP地址和端口号(有多个被
监控
端可用 逗号 隔开)
labels:
instance: localhost
# The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
- job_name: "prometheus"
# metrics_path defaults to '/metrics'
# scheme defaults to 'http'.
static_configs:
- targets: ["localhost:9090"]
# The label name is added as a label `label_name=<label_value>` to any timeseries scraped from this config.
labels:
app: "prometheus"
复制代码
生存设置文件到
容器
docker cp $PWD/prometheus.yml prometheus:/etc/prometheus/prometheus.yml
复制代码
重启
容器
docker restart prometheus
复制代码
安装Grafana
安装Grafana时我用上面的镜像地址没有下载下来,我用的github上的一个工具,如果你们有其他方法也行。
工具地址:https://github.com/topcss/docker-pull-tar/releases/tag/v1.0.7
下载镜像
打开下载的工具输入
grafana/grafana
复制代码
上传服务器
加载镜像
docker load -i grafana_grafana_amd64.tar
复制代码
启动
docker run -itd --name=grafana --restart=always -p 3001:3000 grafana
复制代码
访问
http://192.168.1.2:3001/
192.168.1.2为服务期地址
3001为服务端口,默认为3000
复制代码
首次登录默认账号密码都为admin
设置
1、添加数据源
2、设置Prometheus
3、设置地址
4、生存
5、添加面板
6、添加导入面板
7、输入8919下载模板
也可以去官网上下载json文件举行导入
8、创建面板
9、成功
回复
使用道具
举报
返回列表
浏览过的版块
SAP
SQL-Server
Java
.Net
运维.售后
程序人生
医疗.卫生
Mysql
分布式数据库
饭宝
+ 我要发帖
登录后关闭弹窗
登录参与点评抽奖 加入IT实名职场社区
去登录
微信订阅号
微信服务号
微信客服(加群)
H5
小程序
快速回复
返回顶部
返回列表