// Package alert define alert event struct of modelRT project package alert // EventRecord define struct for CIM event record type EventRecord struct { // 事件名称 Event string `json:"event"` // 事件唯一标识符 EventUUID string `json:"event_uuid"` // 事件类型 Type int `json:"type"` // 事件优先级 (0-9) Priority int `json:"priority"` // 事件状态 Status int `json:"status"` // 可选模板参数 Category string `json:"category,omitempty"` // 毫秒级时间戳 (Unix epoch) Timestamp int64 `json:"timestamp"` // 事件来源 (station, platform, msa) From string `json:"from"` // 事件场景描述对象 (如阈值、当前值) Condition map[string]any `json:"condition"` // 与事件相关的订阅信息 AttachedSubscriptions []any `json:"attached_subscriptions"` // 事件分析结果对象 Result map[string]any `json:"result,omitempty"` // 操作历史记录 (CIM ActivityRecord) Operations []OperationRecord `json:"operations"` // 子站告警原始数据 (CIM Alarm 数据) Alarm map[string]any `json:"alarm,omitempty"` } // OperationRecord 描述对事件的操作记录,如确认(acknowledgment)等 type OperationRecord struct { Action string `json:"action"` // 执行的动作,如 "acknowledgment" Op string `json:"op"` // 操作人/操作账号标识 TS int64 `json:"ts"` // 操作发生的毫秒时间戳 } // 定义事件类型常量,便于逻辑判断 const ( TypeGeneralHard = 0 TypeGeneralPlatformSoft = 1 TypeGeneralApplicationSoft = 2 TypeWarnHard = 3 TypeWarnPlatformSoft = 4 TypeWarnApplicationSoft = 5 TypeCriticalHard = 6 TypeCriticalPlatformSoft = 7 TypeCriticalApplicationSoft = 8 ) const ( FromStation = "station" FromPlatform = "platform" FromMSA = "msa" )