phonginreallife/inres

GitHub: phonginreallife/inres

InRes 是一个 AI 原生的开源事件响应与值班管理平台,通过智能告警去重、可视化排班和内置 AI Agent 帮助 DevOps 团队高效处置事件。

Stars: 3 | Forks: 0

# InRes InRes ### AI 原生的事件响应平台 [![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0) [![Go](https://img.shields.io/badge/Go-1.21+-00ADD8?logo=go)](https://go.dev) [![Next.js](https://img.shields.io/badge/Next.js-15-black?logo=next.js)](https://nextjs.org) [![Python](https://img.shields.io/badge/Python-3.11+-3776AB?logo=python)](https://python.org) InRes 是一个开源的值班和事件管理平台,它内置了可以调查、诊断和帮助解决问题的 AI agent —— 对于敏感操作需要经过 human-in-the-loop 批准。

InRes Dashboard

## 功能 ### 事件管理 - **完整生命周期** - 触发 → 确认 → 解决,附带审计跟踪 - **智能去重** - 基于 fingerprint 的告警分组 - **自动解决** - 恢复告警自动解决事件 - **优先级映射** - P1-P5 兼容 PagerDuty/Datadog ### 值班与升级 - **可视化排班** - 支持拖拽的交互式时间线 - **轮班管理** - 每周、每日、自定义轮班 - **排班覆盖** - 假期换班、临时变更 - **多级升级** - 基于时间的升级链 - **自动分配** - 将事件路由给合适的人员 ### AI Agent (基于 Claude) - **实时聊天** - WebSocket 流式响应 - **工具执行** - 查询系统、运行命令、分析日志 - **Human-in-the-Loop** - 在执行前批准敏感操作 - **记忆与上下文** - 跨会话的持久对话 - **MCP 集成** - 可扩展的工具生态 ### 集成 **告警源** - Prometheus/AlertManager - Datadog - Grafana - AWS CloudWatch - PagerDuty - Coralogix - 通用 Webhook **可用性监控** - HTTP/HTTPS 健康检查 - 响应时间跟踪 - SSL 证书监控 - UptimeRobot, Cloudflare Workers, Checkly **沟通** - Slack(交互式通知) ### 多租户 - 组织与项目 - 基于角色的访问(Owner, Admin, Member, Viewer) - 基于关系的访问控制 (ReBAC) - 通过 Supabase 进行 JWT 认证 ## 快速开始 ### 前置条件 - Docker & Docker Compose - Anthropic API key(用于 AI 功能) ### 1. 克隆与配置 ``` git clone https://github.com/phonginreallife/InRes.git cd InRes # 设置部署目录 mkdir -p ../inres-project cp -r deploy/docker ../inres-project/ ``` ### 2. 创建环境文件 ``` cat > ../inres-project/docker/.env << 'EOF' ANTHROPIC_API_KEY=sk-ant-your-key DATABASE_URL=postgresql://postgres:postgres@supabase_db_supabase:5432/postgres EOF ``` ### 3. 配置应用 ``` cp ../inres-project/docker/volumes/config/cfg.ex.yaml \ ../inres-project/docker/volumes/config/dev.config.yaml # 使用你的 Supabase 凭据编辑 dev.config.yaml ``` ### 4. 启动服务 ``` cd ../inres-project/docker docker compose up -d ``` ### 5. 访问 | 服务 | URL | |---------|-----| | **Frontend** | http://localhost:8000 | | **API** | http://localhost:8080 | | **AI Agent** | http://localhost:8002 | ## 架构 ``` ┌─────────────────┐ │ Frontend │ │ (Next.js) │ └────────┬────────┘ │ ┌────────▼────────┐ │ Kong Gateway │ │ :8000 │ └────────┬────────┘ ┌──────────────┼──────────────┐ │ │ │ ┌────────▼────┐ ┌──────▼──────┐ ┌────▼────────┐ │ Go API │ │ AI Agent │ │ Workers │ │ :8080 │ │ :8002 │ │ (Slack, │ └──────┬──────┘ └──────┬──────┘ │ Escalation)│ │ │ └─────────────┘ │ ┌──────▼──────┐ │ │ Anthropic │ │ │ Claude API │ │ └─────────────┘ ┌──────▼──────────────────────┐ │ Supabase │ │ (PostgreSQL + Auth + PGMQ) │ └─────────────────────────────┘ ``` ## 开发 ### 后端 (Go) ``` cd api go install github.com/cosmtrek/air@latest air # Hot reload on http://localhost:8080 ``` ### AI Agent (Python) ``` cd api/ai python3 -m venv venv && source venv/bin/activate pip install -r requirements.txt python claude_agent_api_v1.py # http://localhost:8002 ``` ### 前端 (Next.js) ``` cd frontend/inres npm install npm run dev # http://localhost:3000 ``` ### 数据库 ``` cd supabase supabase link supabase db push ``` ## Webhook 配置 配置你的监控工具以将告警发送到 InRes: ``` POST /webhook/{provider}/{integration_id} ``` | 提供商 | Webhook 路径 | |----------|--------------| | Prometheus | `/webhook/prometheus/{id}` | | Datadog | `/webhook/datadog/{id}` | | Grafana | `/webhook/grafana/{id}` | | AWS CloudWatch | `/webhook/aws/{id}` | | PagerDuty | `/webhook/pagerduty/{id}` | | Coralogix | `/webhook/coralogix/{id}` | | 通用 | `/webhook/webhook/{id}` | **示例:Prometheus AlertManager** ``` receivers: - name: 'inres' webhook_configs: - url: 'https://your-domain/webhook/prometheus/YOUR_ID' send_resolved: true ``` ## API 参考 ### 事件 ``` GET /incidents List incidents POST /incidents Create incident GET /incidents/:id Get incident PUT /incidents/:id/ack Acknowledge PUT /incidents/:id/resolve Resolve ``` ### 日程安排 ``` GET /schedules List schedules GET /schedules/timeline Get timeline POST /overrides Create override ``` ### 可用性 ``` GET /uptime/services List monitors POST /uptime/services Create monitor GET /uptime/services/:id Get status GET /uptime/dashboard Dashboard data ``` ### AI Agent ``` WS /ws/chat AI chat (block mode) WS /ws/stream AI chat (streaming mode) GET /conversations List conversations GET /mcp/servers List MCP tools ``` ## 安全 - **认证** - 带有 RS256/ES256 验证的 Supabase JWT - **授权** - 用于细粒度租户隔离的 ReBAC - **AI 安全** - 敏感工具执行需要人工批准 - **审计跟踪** - 对所有操作和 AI 运行进行完整日志记录 - **SQL 注入** - 全面使用参数化查询 ## 路线图 - [x] 具有生命周期的事件管理 - [x] 值班排班与升级 - [x] AI 驱动的调查助手 - [x] 7+ 监控集成 - [x] 带有 SSL 跟踪的可用性监控 - [x] 多租户组织 - [x] Token 级别的 AI 流式传输 - [ ] 高级路由规则(regex, CEL) - [ ] Runbook 自动化 - [ ] 移动应用 - [ ] 公共状态页 - [ ] 事后总结模板 ## 许可证 [AGPLv3](LICENSE) - 自由自托管,无供应商锁定。 ## 致谢 - [slar](https://github.com/SlarOps/slar) - 原始灵感 - [Anthropic Claude](https://anthropic.com) - AI 能力 - [Supabase](https://supabase.com) - 认证与数据库

为厌倦了告警疲劳的 SRE 和 DevOps 团队而生。

标签:AI智能体, Go, Ruby工具, 值班调度, 告警管理, 日志审计, 测试用例, 自定义脚本, 请求拦截, 运维监控, 逆向工具