统一监控 Oracle、MySQL、SQLServer、PostgreSQL,支持自定义 SQL 监控 + 可视化仪表盘 + Telegram/微信告警。
- 🔧 自定义 SQL 监控 - 界面配置监控模块,无需改代码
- 📊 可视化仪表盘 - ECharts 图表展示历史趋势
- 🔔 多渠道告警 - 支持 Telegram、企业微信推送
- 🎯 多数据库支持 - Oracle、MySQL、SQLServer、PostgreSQL
- 📦 模块化设计 - 新增监控项只需配置 SQL
cd backend
pip install -r requirements.txt编辑 config.yaml 或通过 Web 界面添加数据库连接。
cd backend
python main.py访问 http://localhost:8000 打开管理界面。
docker-compose up -ddbmonitor/
├── backend/
│ ├── main.py # FastAPI 入口
│ ├── models.py # 数据模型
│ ├── database.py # 数据库连接器
│ ├── collector.py # SQL 采集引擎
│ ├── alerter.py # 告警发送
│ ├── scheduler.py # 定时任务调度
│ └── requirements.txt # Python 依赖
├── frontend/
│ └── index.html # 单页应用 (内嵌)
├── config.yaml # 配置文件
├── docker-compose.yml # Docker 部署
└── README.md # 项目说明
databases:
- name: "生产Oracle-主库"
type: oracle
host: 192.168.1.100
port: 1521
service_name: ORCL
user: monitor
password: ${ORACLE_PASSWORD}monitors:
- name: "表空间使用率"
db_types: [oracle]
sql: |
SELECT tablespace_name,
ROUND((used_space/total_space)*100, 2) as used_pct
FROM dba_tablespace_usage_metrics
WHERE (used_space/total_space)*100 > :threshold
threshold: 85
alert_message: "⚠️ 表空间 {tablespace_name} 使用率 {used_pct}%"- 创建 Bot: https://t.me/BotFather
- 获取 Chat ID: https://t.me/userinfobot
- 创建群机器人
- 获取 Webhook URL
MIT License