Browse Source

(*)告警推送字段优化

dev
wuqun 2 years ago
parent
commit
30abf74200
  1. 10
      api/app/lib/utils/alarmHandle.js

10
api/app/lib/utils/alarmHandle.js

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

Loading…
Cancel
Save