第一次

This commit is contained in:
ZhuJW
2026-04-16 15:44:32 +08:00
commit 5a98242f2f
171 changed files with 42954 additions and 0 deletions

63
infra/monitor/README.md Normal file
View File

@@ -0,0 +1,63 @@
# Cloud infra monitor
## 环境准备
> Docker Engine
>Grafana & Prometheus docker images
## 服务部署
### 创建工作目录
```bash
mkdir -p ~/grafana/{prometheus,grafana,data}
cd grafana/
sudo chown -R 65534:65534 ~/grafana/data
```
### 部署Grafana
使用docker命令启动
```bash
sudo docker run -d \
--name grafana \
-p 3000:3000 \
-v ~/grafana/grafana:/var/lib/grafana \
-e "GF_SECURITY_ADMIN_PASSWORD=${password}" \
grafana/grafana:latest
```
### 部署Prometheus
使用docker命令启动
```bash
sudo docker run -d \
--name prometheus \
-p 9090:9090 \
-v ~/grafana/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml \
-v ~/grafana/data:/prometheus \
prom/prometheus:latest \
--config.file=/etc/prometheus/prometheus.yml \
--storage.tsdb.path=/prometheus \
--web.console.libraries=/etc/prometheus/console_libraries \
--web.console.templates=/etc/prometheus/consoles \
--web.enable-lifecycle
```
## 验证服务
| 服务 | 地址 | 默认账号/密码 |
| ---------- | ----------------------- |-------------------|
| Prometheus | <http://localhost:9090> | - |
| Grafana | <http://localhost:3000> | admin/${password} |
## 配置数据源
1. 登录 Grafana → Configuration → Data Sources → Add data source
2. 选择 Prometheus
3. 配置参数:
- URL: http://<host>:<port>
- Access: Server (默认)
- 点击 Save & Test
## 导入模板
1. 点击 + → Import → Upload JSON file
2. 选择对应的json文件
3. 点击 Import