ITIL Ops — IT Service Management for AI Agents
Structured incident, problem, and change management adapted from ITIL 4 for autonomous agent operations.
Core Concepts
Severity Levels
| Level | Meaning | Response | Example |
|---|
| P1 | Critical — service down, data at risk | Immediate alert + auto-remediate | Crash loop, disk full, OOM |
| P2 |
High — degraded service | Alert within 1h | Service restarts, auth failures |
|
P3 | Medium — non-critical issue | Next review cycle | Cron timeouts, broken files |
|
P4 | Low — cosmetic/minor | Track, fix when convenient | Log warnings, config drift |
Incident vs Problem vs Change
- - Incident: Something broke. Restore service ASAP. (reactive)
- Problem: Pattern of incidents. Find and fix root cause. (proactive)
- Change: Planned modification. Assess risk before executing. (controlled)
Incident Management
Detection Sources
Scan these in order of criticality:
- 1. Service crashes —
journalctl --user -u SERVICE --since "12 hours ago" for watchdog timeouts, SIGABRT, SIGSEGV, core dumps - Cron failures — consecutive error count > 2 in job state files
- Health endpoints — HTTP health checks returning non-200
- Resource pressure — disk > 80%, RAM > 80%, swap active
- Data integrity — schema validation failures, broken files, load errors
Detection Script
Run scripts/itil-review.sh to scan all sources. It outputs:
- -
ITIL_CLEAR if nothing found (reply HEARTBEAT_OK) - Formatted report with incidents and problems if issues detected
Incident Lifecycle
CODEBLOCK0
Auto-Classification Rules
CODEBLOCK1
Creating Incident Tickets
When incidents are found, create coordination tasks:
CODEBLOCK2
Problem Management
Pattern Detection
An incident becomes a problem when:
- - Same error occurs 3+ times in 24h
- Same incident type recurs across 2+ review cycles
- Multiple related incidents share a common root cause
Root Cause Analysis (RCA)
When a problem is identified:
- 1. Gather evidence — journal logs, error messages, state files, recent changes
- Timeline — reconstruct the sequence of events
- 5 Whys — ask why iteratively until you reach the actual root cause
- Fix classification:
-
Quick fix — config change, file repair, timeout bump
-
Code fix — bug in script or daemon, needs PR
-
Architecture fix — design flaw, needs redesign
Problem Ticket Format
CODEBLOCK3
Known Error Database
Track resolved problems in state file (itil-state.json):
CODEBLOCK4
Change Management
Pre-Change Checklist
Before modifying services, configs, or infrastructure:
- 1. What's changing? — specific files, services, configs
- Why? — linked incident/problem ticket
- Risk? — what could go wrong
- Rollback plan? — how to undo if it breaks
- Test? — how to verify it worked
- Notify? — does the human need to know
Change Categories
| Type | Approval | Example |
|---|
| Standard | Pre-approved, just do it | Restart service, bump timeout |
| Normal |
Inform human, wait for OK | New cron job, config change |
|
Emergency | Fix now, inform after | Service down, data at risk |
Post-Change Verification
After any change:
- 1. Check service status — INLINECODE4
- Watch logs for 60s — INLINECODE5
- Run health check — INLINECODE6
- Verify no new errors in first 5 minutes
Event Management
Log Monitoring Patterns
CODEBLOCK5
Health Check Endpoints
Check services with curl:
CODEBLOCK6
Configure endpoints in the review script for your environment.
Continual Improvement
Review Cadence
| Review | Frequency | Purpose |
|---|
| Incident review | Every 12h | Detect and classify new issues |
| Problem review |
Weekly | Identify patterns, track RCA progress |
|
Capacity review | Weekly | Disk, RAM, memory count trends |
|
Process review | Monthly | Are our detection rules catching real issues? |
KPIs to Track
- - MTTR (Mean Time to Resolve) — how fast do we fix incidents?
- Incident recurrence rate — are the same things breaking?
- False positive rate — are we alerting on non-issues?
- Known error resolution — are problems getting permanent fixes?
State Tracking
The review script maintains itil-state.json with:
- - Last review timestamp and results
- Incident/problem counts per review
- System metrics (disk, RAM, restart count)
- Cross-review pattern detection data
Cron Setup
Recommended Schedule
CODEBLOCK7
File Structure
CODEBLOCK8
Integration Points
- - Coordination tasks —
skcapstone coord create for incident/problem tickets - Memory snapshots —
skmemory_snapshot to record resolutions for future reference - Heartbeat — integrate with existing heartbeat to run lightweight checks
- Cron — scheduled reviews via OpenClaw cron system
- Alerting — Telegram/Discord delivery for P1/P2 issues
技能名称: itil-ops
详细描述:
ITIL运维 — 面向AI代理的IT服务管理
基于ITIL 4框架,为自主代理运维设计的结构化事件、问题和变更管理。
核心概念
严重等级
| 等级 | 含义 | 响应 | 示例 |
|---|
| P1 | 严重 — 服务中断、数据风险 | 立即告警 + 自动修复 | 崩溃循环、磁盘已满、内存溢出 |
| P2 |
高 — 服务降级 | 1小时内告警 | 服务重启、认证失败 |
|
P3 | 中 — 非关键问题 | 下一个评审周期 | 定时任务超时、文件损坏 |
|
P4 | 低 — 外观/次要问题 | 跟踪,方便时修复 | 日志警告、配置漂移 |
事件 vs 问题 vs 变更
- - 事件: 某物故障。尽快恢复服务。(被动)
- 问题: 事件模式。发现并修复根本原因。(主动)
- 变更: 计划性修改。执行前评估风险。(受控)
事件管理
检测来源
按严重性顺序扫描以下来源:
- 1. 服务崩溃 — 使用journalctl --user -u SERVICE --since 12 hours ago检查看门狗超时、SIGABRT、SIGSEGV、核心转储
- 定时任务失败 — 任务状态文件中连续错误计数 > 2
- 健康检查端点 — HTTP健康检查返回非200状态码
- 资源压力 — 磁盘 > 80%、内存 > 80%、交换分区活跃
- 数据完整性 — 模式验证失败、文件损坏、加载错误
检测脚本
运行scripts/itil-review.sh扫描所有来源。输出:
- - 若无发现则输出ITILCLEAR(回复HEARTBEATOK)
- 若检测到问题则输出包含事件和问题的格式化报告
事件生命周期
检测到 → 分类(P1-P4) → 诊断 → 已解决 → 已关闭
↓
(出现3次以上)
↓
升级为问题
自动分类规则
bash
P1 — 严重
- - 12小时内服务崩溃次数 >= 3 (崩溃循环)
- 磁盘使用率 >= 90%
- 内存使用率 >= 90%
- 检测到数据丢失
P2 — 高
- - 服务崩溃1-2次
- 同时3个以上服务宕机
- 认证/令牌故障影响操作
- 定时任务连续失败5次以上
P3 — 中
- - 数据文件损坏(模式违规)
- 12小时内内存加载错误 > 10次
- 定时任务连续失败3-4次
- 磁盘使用率80-89%
P4 — 低
创建事件工单
发现事件时,创建协调任务:
标题: [ITIL-INC] <简要描述>
正文:
- - 严重等级: P1/P2/P3/P4
- 类别: service|cron|memory|disk|security
- 检测时间: <时间戳>
- 详情: <发生了什么>
- 影响: <受影响的内容>
- 操作: <需要做什么>
问题管理
模式检测
当以下情况发生时,事件升级为问题:
- - 同一错误在24小时内出现3次以上
- 同一事件类型在2个以上评审周期中重复出现
- 多个相关事件共享同一根本原因
根本原因分析
当识别出问题时:
- 1. 收集证据 — 日志、错误消息、状态文件、近期变更
- 时间线 — 重构事件序列
- 5个为什么 — 迭代追问为什么直至找到实际根本原因
- 修复分类:
-
快速修复 — 配置变更、文件修复、超时调整
-
代码修复 — 脚本或守护进程中的bug,需要提交PR
-
架构修复 — 设计缺陷,需要重新设计
问题工单格式
标题: [ITIL-PRB] <根本原因描述>
正文:
- - 相关事件: <列表>
- 根本原因: <实际故障点>
- 证据: <日志、模式、数据>
- 已应用修复: <即时补救措施>
- 需要修复: <永久解决方案>
- 预防措施: <如何防止再次发生>
已知错误数据库
在状态文件(itil-state.json)中跟踪已解决的问题:
json
{
last_review: 2026-03-22T04:19:50Z,
lastincidentcount: 2,
lastproblemcount: 1,
known_errors: {
memory-content-dict: {
description: 脚本将内容写入为字典而非字符串,
root_cause: 内存文件写入器中缺少json.dumps(),
fix: 保存前将内容包裹在json.dumps()中,
fixed_date: 2026-03-22
}
}
}
变更管理
变更前检查清单
修改服务、配置或基础设施前:
- 1. 变更什么? — 具体文件、服务、配置
- 为什么? — 关联的事件/问题工单
- 风险? — 可能出现什么问题
- 回滚计划? — 如何撤销变更
- 测试? — 如何验证变更生效
- 通知? — 是否需要告知人类
变更类别
| 类型 | 审批 | 示例 |
|---|
| 标准 | 预批准,直接执行 | 重启服务、调整超时 |
| 正常 |
通知人类,等待确认 | 新增定时任务、配置变更 |
|
紧急 | 立即修复,事后通知 | 服务宕机、数据风险 |
变更后验证
任何变更后:
- 1. 检查服务状态 — systemctl --user status SERVICE
- 观察日志60秒 — journalctl --user -u SERVICE -f --since now
- 运行健康检查 — scripts/itil-review.sh
- 确认前5分钟内无新错误
事件管理
日志监控模式
bash
服务崩溃
journalctl --user -u SERVICE --since 12h ago | grep -ciE watchdog timeout|killed|SIGABRT|SIGSEGV|failed with
内存/资源问题
journalctl --user -u SERVICE --since 12h ago | grep -c Failed to load
认证失败
journalctl --user -u SERVICE --since 12h ago | grep -ciE unauthorized|403|token expired|auth fail
健康检查端点
使用curl检查服务:
bash
curl -sf --max-time 5 $URL >/dev/null 2>&1 || echo DOWN
根据环境在评审脚本中配置端点。
持续改进
评审节奏
| 评审 | 频率 | 目的 |
|---|
| 事件评审 | 每12小时 | 检测并分类新问题 |
| 问题评审 |
每周 | 识别模式,跟踪RCA进展 |
|
容量评审 | 每周 | 磁盘、内存、内存计数趋势 |
|
流程评审 | 每月 | 检测规则是否捕获了实际问题? |
跟踪的关键绩效指标
- - MTTR (平均解决时间) — 修复事件的速度有多快?
- 事件复发率 — 相同问题是否反复出现?
- 误报率 — 是否对非问题发出告警?
- 已知错误解决率 — 问题是否获得永久修复?
状态跟踪
评审脚本维护itil-state.json,包含:
- - 上次评审时间戳和结果
- 每次评审的事件/问题计数
- 系统指标(磁盘、内存、重启次数)
- 跨评审模式检测数据
定时任务设置
推荐计划
bash
事件评审 — 每12小时
openclaw cron add --name itil-review --every 12h \
--model anthropic/claude-sonnet-4-6 --timeout-seconds 180 \
--session isolated \
--message 运行ITIL评审: bash ~/.skcapstone/agents/lumina/scripts/itil-review.sh
每周问题评审(周日上午9点)
分析本周事件,识别模式,提出改进建议
文件结构
itil-ops/
├── SKILL.md # 本文件
├── scripts/
│ └── itil-review.sh # 主评审脚本(扫描 +