|
@ -111,17 +111,23 @@ module.exports = async function factory(app, opts) { |
|
|
let exist = structs.find(s => s.strucId == structureId); |
|
|
let exist = structs.find(s => s.strucId == structureId); |
|
|
if (exist) { |
|
|
if (exist) { |
|
|
let alarm_group = await clickHouse.anxinyun.query( |
|
|
let alarm_group = await clickHouse.anxinyun.query( |
|
|
`SELECT alarm_group FROM t_alarm_code WHERE code='${alarmCode}'`).toPromise(); |
|
|
`SELECT alarm_group, alarm_group_unit FROM t_alarm_code WHERE code='${alarmCode}'`).toPromise(); |
|
|
|
|
|
|
|
|
let type = alarm_group.length ? constAlarmGroups[alarm_group[0].alarm_group] : null//告警类型
|
|
|
let type = null, alarmGroup = null;//告警类型 异常类型
|
|
|
|
|
|
if (alarm_group) { |
|
|
|
|
|
type = constAlarmGroups[alarm_group[0].alarm_group];//告警类型
|
|
|
|
|
|
let gId = alarm_group[0].alarm_group_unit; |
|
|
|
|
|
let alarm_group_unit = await clickHouse.anxinyun.query( |
|
|
|
|
|
`SELECT name FROM t_alarm_group_unit WHERE id=${gId}`).toPromise(); |
|
|
|
|
|
alarmGroup = alarm_group_unit.length ? alarm_group_unit[0].name : null//异常类型
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
let projects = exist.pomsProject.filter(d => !d.del).map(p => p.id); |
|
|
let projects = exist.pomsProject.filter(d => !d.del).map(p => p.id); |
|
|
if (messageMode == 'AlarmGeneration') {//告警产生--------------------------------------------------1
|
|
|
if (messageMode == 'AlarmGeneration') {//告警产生--------------------------------------------------1
|
|
|
let datas = projects.map(d => {//需要 项目,告警源,异常类型,时间
|
|
|
let datas = projects.map(d => {//需要 项目,告警源,异常类型,时间
|
|
|
return { |
|
|
return { |
|
|
projectCorrelationId: d, |
|
|
projectCorrelationId: d, |
|
|
alarmInfo: { messageMode, sourceName, alarmTypeCode, alarmCode, content }, |
|
|
alarmInfo: { messageMode, sourceName, alarmTypeCode, alarmCode, content, type: alarmGroup }, |
|
|
time: time, |
|
|
time: time, |
|
|
type//告警类型
|
|
|
type//告警类型
|
|
|
} |
|
|
} |
|
@ -148,7 +154,7 @@ module.exports = async function factory(app, opts) { |
|
|
return { |
|
|
return { |
|
|
pepUserId: null, |
|
|
pepUserId: null, |
|
|
projectCorrelationId: d, |
|
|
projectCorrelationId: d, |
|
|
alarmInfo: { source: sourceName, type },//包含告警id,type,source
|
|
|
alarmInfo: { source: sourceName, type: alarmGroup },//包含告警id,type,source
|
|
|
confirmTime: time, |
|
|
confirmTime: time, |
|
|
confirmContent: '自动恢复' |
|
|
confirmContent: '自动恢复' |
|
|
} |
|
|
} |
|
|