SuperAPI AI 工具集

incident-management

部署与运维

查看项目

更新于 10-16 02:12

技能介绍

用途

Incident Management 用于在 ServiceNow 中管理事件,目标是在尽量降低业务影响的前提下尽快恢复正常服务运行。它覆盖事件从创建、分配、升级、重大事件处理到解决与度量的完整流程。

事件生命周期

资料给出的状态流转为:New (1) → In Progress (2) → Resolved (6) → Closed (7);On Hold (3) 可从 In Progress 进入;Cancelled (8) 可从 New 或 In Progress 发生。

关键表

  • incident:事件记录
  • incident_task:事件子任务
  • incident_alert:相关告警
  • problem:相关问题

主要能力

创建事件

使用 GlideRecord 初始化 incident,设置必填字段 caller_id、short_description、description,并设置分类字段 category、subcategory、impact、urgency。优先级由 impact 与 urgency 自动计算。可设置 assignment_group 与受影响的 cmdb_ci,最后 insert 并输出事件编号。

优先级矩阵

资料提供 impact × urgency 的优先级矩阵:1-1 为 1(Critical),1-2 为 2(High),1-3 为 3(Moderate),2-1 为 2(High),2-2 为 3(Moderate),2-3 为 4(Low),3-1 为 3(Moderate),3-2 为 4(Low),3-3 为 5(Planning)。并提供 calculatePriority 函数按该矩阵返回优先级,未命中时默认返回 4。

自动分配

通过 before insert 业务规则实现:若已有 assignment_group 则跳过;否则根据 category 与 subcategory 映射到处理组(如 network→Network Support、hardware→Desktop Support、software-email→Email Support、software-erp→ERP Support、database→Database Admins),未命中时回退到 Service Desk。可进一步查询值班人员并设置 assigned_to。

重新分配跟踪

通过 before update 业务规则实现:当 assignment_group 发生变化时,reassignment_count 加一,写入 work_notes 记录从哪个组转到哪个组;当累计次数达到 3 次及以上时,触发 incident.excessive.reassignments 事件。

重大事件管理

declareMajorIncident 函数可将事件标记为重大事件:设置 major_incident_state 为 confirmed、priority 为 1,记录重大事件开始时间与原因,分配到 Major Incident Team,写入工作备注,触发 incident.major.declared 事件,并创建桥接电话记录(含拨入号码、PIN、开始时间)。sendMajorIncidentUpdate 函数可写入重大事件更新备注,汇总接收组人员,并通过 incident.major.update 事件发送通知。

事件升级

提供基于时间的定时任务脚本:P1 未在 15 分钟内确认、P2 未在 30 分钟内确认时升级;P1 未在 4 小时内解决、P2 未在 8 小时内解决时升级。未确认升级会设置 escalation 并写入备注、触发 incident.escalation.unacknowledged;未解决升级会递增 escalation(上限小于 3),写入备注并通知上级(incident.escalation.manager)。

事件解决

resolveIncident 函数校验状态(已解决或已关闭则拒绝)、校验 resolution.code 与 resolution.notes 必填,然后设置 state 为 6、resolution_code、close_notes、resolved_at、resolved_by,可选关联 problem_id 与知识文章,更新后触发 incident.resolved 事件并返回结果。

事件指标

calculateMTTR 函数使用 GlideAggregate 按 resolved_at 时间范围与 state 6、7 查询,可附加 priority、category 过滤,聚合 AVG calendar_duration 与 COUNT,将平均时长换算为小时返回 mttr_hours 与 incident_count。

使用方式

资料中的脚本均标注为 ES5 ONLY,要求使用 ES5 语法,不使用现代 JavaScript 语法。脚本以业务规则、定时任务或函数形式在 ServiceNow 中执行。

MCP 工具集成

可用工具包括:snow_record_manage(action='query')查询事件记录、snow_query_table 高级查询、snow_execute_script 测试脚本、snow_create_business_rule 创建自动化。示例工作流包括查询未关闭的 P1 事件、执行脚本检查 MTTR、查询未分配事件。

最佳实践

资料列出:清晰分类(正确的 category/subcategory)、准确评估影响度与紧急度、配置分配规则实现自动路由、定义升级路径、保持沟通更新、使用一致的解决代码、关联知识库文章、仅使用 ES5。

限制

资料明确要求所有脚本使用 ES5 语法,不支持现代 JavaScript 语法。其他平台、收费、价格等信息暂未提供。