Browse Source

告警统计接口

dev
CODE 2 years ago
parent
commit
0736cff456
  1. 16
      api/app/lib/controllers/project/group.js
  2. 3
      api/app/lib/routes/project/index.js

16
api/app/lib/controllers/project/group.js

@ -318,10 +318,26 @@ async function groupStatisticOnline (ctx) {
}
}
async function groupStatisticAlarm (ctx) {
try {
const { models } = ctx.fs.dc;
ctx.status = 200;
ctx.body = []
} catch (error) {
ctx.fs.logger.error(`path: ${ctx.path}, error: ${error}`);
ctx.status = 400;
ctx.body = {
message: typeof error == 'string' ? error : undefined
}
}
}
module.exports = {
groupList,
editGroup,
delGroup,
groupStatistic,
groupStatisticOnline,
groupStatisticAlarm,
};

3
api/app/lib/routes/project/index.js

@ -45,4 +45,7 @@ module.exports = function (app, router, opts) {
app.fs.api.logAttr['GET/project/group/statistic/online'] = { content: '获取项目分组在线率统计信息', visible: true };
router.get('/project/group/statistic/online', projectGroup.groupStatisticOnline);
app.fs.api.logAttr['GET/project/group/statistic/alarm'] = { content: '获取项目分组告警统计信息', visible: true };
router.get('/project/group/statistic/alarm', projectGroup.groupStatisticAlarm);
};
Loading…
Cancel
Save