|
@ -17,7 +17,7 @@ module.exports = function (app, opts) { |
|
|
async function sendAppearToWeb(datas, ttype) { |
|
|
async function sendAppearToWeb(datas, ttype) { |
|
|
try { |
|
|
try { |
|
|
//告警类型
|
|
|
//告警类型
|
|
|
let alarmGroup = null |
|
|
let alarmTypee = null |
|
|
|
|
|
|
|
|
//项目信息
|
|
|
//项目信息
|
|
|
let { projects, pepProjects } = await getProjectsInfo(datas); |
|
|
let { projects, pepProjects } = await getProjectsInfo(datas); |
|
@ -27,9 +27,9 @@ module.exports = function (app, opts) { |
|
|
let alarm_group = await clickHouse.anxinyun.query( |
|
|
let alarm_group = await clickHouse.anxinyun.query( |
|
|
`SELECT alarm_group FROM t_alarm_code WHERE code='${datas[0].alarmInfo.alarmCode}'`).toPromise(); |
|
|
`SELECT alarm_group FROM t_alarm_code WHERE code='${datas[0].alarmInfo.alarmCode}'`).toPromise(); |
|
|
|
|
|
|
|
|
alarmGroup = alarm_group.length ? constAlarmGroups[alarm_group[0].alarm_group] : null |
|
|
alarmTypee = alarm_group.length ? constAlarmGroups[alarm_group[0].alarm_group] : null |
|
|
} else { |
|
|
} else { |
|
|
alarmGroup = constAlarmGroups[ttype] |
|
|
alarmTypee = constAlarmGroups[ttype] |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
let sendData = [] |
|
|
let sendData = [] |
|
@ -39,9 +39,9 @@ module.exports = function (app, opts) { |
|
|
projectCorrelationId: ld.projectCorrelationId, |
|
|
projectCorrelationId: ld.projectCorrelationId, |
|
|
project: projects.find(p => p.id == ld.projectCorrelationId).name || pepProjects.find(pp => pp.id == pepPId).project_name,//前者为自定义项目名称
|
|
|
project: projects.find(p => p.id == ld.projectCorrelationId).name || pepProjects.find(pp => pp.id == pepPId).project_name,//前者为自定义项目名称
|
|
|
source: ld.alarmInfo.sourceName, |
|
|
source: ld.alarmInfo.sourceName, |
|
|
type: ld.alarmInfo.type,//异常类型
|
|
|
alarmGroup: ld.alarmInfo.type,//异常类型
|
|
|
time: ld.time, |
|
|
time: ld.time, |
|
|
alarmGroup//告警类型
|
|
|
type: alarmTypee//告警类型
|
|
|
}) |
|
|
}) |
|
|
}) |
|
|
}) |
|
|
//app.socket.emit('alarmSendSocket', { type: 'alarmAppear', sendData })
|
|
|
//app.socket.emit('alarmSendSocket', { type: 'alarmAppear', sendData })
|
|
|