月均日95值计算方式新增1024,资源监控模块接口新增

This commit is contained in:
gaoyutao
2025-09-17 09:34:00 +08:00
parent f9d4835d4c
commit f922fb752f
34 changed files with 827 additions and 59 deletions
@@ -89,8 +89,10 @@ public class TableScheduleConfig {
.thenRun(() -> calculateServerMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateSwitchMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.thenRun(() -> calculateServerAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime))
.thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime))
.thenRun(() -> calculateServerAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateServerAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1000"))
.thenRun(() -> calculateSwitchAvgMonthlyBandwidth(monthlyStartTime, monthlyEndTime, "1024"))
.exceptionally(e -> {
log.error("月度带宽计算链执行异常", e); // 仅保留最终异常捕获
return null;
@@ -145,7 +147,7 @@ public class TableScheduleConfig {
/**
* 计算服务器月平均95带宽值
*/
private void calculateServerAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime) {
private void calculateServerAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算服务器月平均95带宽值...");
try {
EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
@@ -154,7 +156,7 @@ public class TableScheduleConfig {
List<AllInterfaceName> snList = allInterfaceNameService.getAllDeviceSn(new AllInterfaceName());
for (AllInterfaceName allInterfaceName : snList) {
processServerAvgBandwidth(epsNodeBandwidth, allInterfaceName);
processServerAvgBandwidth(epsNodeBandwidth, allInterfaceName, calculationMode);
}
log.info("服务器月平均95带宽值计算完成");
} catch (Exception e) {
@@ -165,7 +167,7 @@ public class TableScheduleConfig {
/**
* 处理单个服务器的平均带宽计算
*/
private void processServerAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName allInterfaceName) {
private void processServerAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName allInterfaceName, String calculationMode) {
final String deviceSn = allInterfaceName.getDeviceSn();
try {
@@ -216,6 +218,7 @@ public class TableScheduleConfig {
// 创建业务带宽对象
EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
bandwidthWithBiz.setHardwareSn(deviceSn);
bandwidthWithBiz.setCalculationMode(calculationMode);
bandwidthWithBiz.setNodeName(serverConfig.getNodeName());
bandwidthWithBiz.setStartTime(epsNodeBandwidth.getStartTime());
bandwidthWithBiz.setEndTime(epsNodeBandwidth.getEndTime());
@@ -244,6 +247,7 @@ public class TableScheduleConfig {
// 5. 处理正常情况(无业务变更或无需处理变更)
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
normalBandwidth.setHardwareSn(deviceSn);
normalBandwidth.setCalculationMode(calculationMode);
normalBandwidth.setNodeName(serverConfig.getNodeName());
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());
normalBandwidth.setEndTime(epsNodeBandwidth.getEndTime());
@@ -260,7 +264,7 @@ public class TableScheduleConfig {
/**
* 计算交换机月平均95带宽值
*/
private void calculateSwitchAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime) {
private void calculateSwitchAvgMonthlyBandwidth(String monthlyStartTime, String monthlyEndTime, String calculationMode) {
log.info("开始计算交换机月平均95带宽值...");
try {
EpsNodeBandwidth epsNodeBandwidth = new EpsNodeBandwidth();
@@ -269,7 +273,7 @@ public class TableScheduleConfig {
List<AllInterfaceName> switchSnList = allInterfaceNameService.getAllSwitchSn(new AllInterfaceName());
for (AllInterfaceName switchSnMsg : switchSnList) {
processSwitchAvgBandwidth(epsNodeBandwidth, switchSnMsg);
processSwitchAvgBandwidth(epsNodeBandwidth, switchSnMsg, calculationMode);
}
log.info("交换机月平均95带宽值计算完成");
} catch (Exception e) {
@@ -280,7 +284,7 @@ public class TableScheduleConfig {
/**
* 处理单个交换机的平均带宽计算
*/
private void processSwitchAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName switchSnMsg) {
private void processSwitchAvgBandwidth(EpsNodeBandwidth epsNodeBandwidth, AllInterfaceName switchSnMsg, String calculationMode) {
final String switchSn = switchSnMsg.getSwitchSn();
try {
@@ -346,6 +350,7 @@ public class TableScheduleConfig {
// 创建业务带宽对象
EpsNodeBandwidth bandwidthWithBiz = new EpsNodeBandwidth();
bandwidthWithBiz.setSwitchSn(switchSn);
bandwidthWithBiz.setCalculationMode(calculationMode);
bandwidthWithBiz.setInterfaceName(topology.getInterfaceName());
bandwidthWithBiz.setHardwareSn(serverSn);
bandwidthWithBiz.setNodeName(topology.getServerName());
@@ -377,6 +382,7 @@ public class TableScheduleConfig {
// 5. 处理普通情况(无变更记录)
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
normalBandwidth.setSwitchSn(switchSn);
normalBandwidth.setCalculationMode(calculationMode);
normalBandwidth.setInterfaceName(topology.getInterfaceName());
normalBandwidth.setHardwareSn(topology.getServerSn());
normalBandwidth.setNodeName(topology.getServerName());
@@ -394,6 +400,7 @@ public class TableScheduleConfig {
// 5. 处理机房出口情况
EpsNodeBandwidth normalBandwidth = new EpsNodeBandwidth();
normalBandwidth.setSwitchSn(switchSn);
normalBandwidth.setCalculationMode(calculationMode);
normalBandwidth.setInterfaceName(topology.getInterfaceName());
normalBandwidth.setInterfaceLinkDeviceType(topology.getConnectedDeviceType());
normalBandwidth.setStartTime(epsNodeBandwidth.getStartTime());