feat:修改Host指标信息
This commit is contained in:
parent
fc1ff16fac
commit
4ccf691ed9
|
@ -125,4 +125,35 @@ public class NumUtil {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static String kb2Gb(String kb, int scale){
|
||||||
|
if (StrUtil.isBlank(kb))
|
||||||
|
return null;
|
||||||
|
BigDecimal decimal = new BigDecimal(kb);
|
||||||
|
double v = decimal.divide(new BigDecimal(1024), scale, RoundingMode.HALF_UP)
|
||||||
|
.divide(new BigDecimal(1024), scale, RoundingMode.HALF_UP)
|
||||||
|
.doubleValue();
|
||||||
|
return String.valueOf(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String byte2Mb(String bytes, int scale){
|
||||||
|
if (StrUtil.isBlank(bytes))
|
||||||
|
return null;
|
||||||
|
BigDecimal decimal = new BigDecimal(bytes);
|
||||||
|
double v = decimal.divide(new BigDecimal(1024), scale, RoundingMode.HALF_UP)
|
||||||
|
.divide(new BigDecimal(1024), scale, RoundingMode.HALF_UP)
|
||||||
|
.doubleValue();
|
||||||
|
return String.valueOf(v);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String byte2Gb(String bytes, int scale){
|
||||||
|
if (StrUtil.isBlank(bytes))
|
||||||
|
return null;
|
||||||
|
BigDecimal decimal = new BigDecimal(bytes);
|
||||||
|
double v = decimal.divide(new BigDecimal(1024), scale, RoundingMode.HALF_UP)
|
||||||
|
.divide(new BigDecimal(1024), scale, RoundingMode.HALF_UP)
|
||||||
|
.divide(new BigDecimal(1024), scale, RoundingMode.HALF_UP)
|
||||||
|
.doubleValue();
|
||||||
|
return String.valueOf(v);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.jeecg.modules.base.dto;
|
package org.jeecg.modules.base.dto;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.experimental.Accessors;
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@ -21,21 +22,29 @@ public class DatabaseDto implements Serializable {
|
||||||
|
|
||||||
private boolean online;
|
private boolean online;
|
||||||
|
|
||||||
private String slowQuery;
|
|
||||||
|
|
||||||
private Integer alarms;
|
private Integer alarms;
|
||||||
|
|
||||||
private boolean alarmRed;
|
private boolean alarmRed;
|
||||||
|
|
||||||
private String cpuUutilzation;
|
private String dbMemory; // kb
|
||||||
|
|
||||||
private boolean cpuRed;
|
private String logRemainingSize; // byte
|
||||||
|
|
||||||
private String memoryUsage;
|
private String dbSize; // byte
|
||||||
|
|
||||||
private boolean memoryRed;
|
public void setDbMemory(String dbMemory) {
|
||||||
|
if (StrUtil.isNotBlank(dbMemory))
|
||||||
|
this.dbMemory = dbMemory + "GB";
|
||||||
|
}
|
||||||
|
|
||||||
private String diskUsage;
|
public void setLogRemainingSize(String logRemainingSize) {
|
||||||
|
if (StrUtil.isNotBlank(logRemainingSize))
|
||||||
|
this.logRemainingSize = logRemainingSize + "MB";
|
||||||
|
|
||||||
private boolean diskRed;
|
}
|
||||||
|
|
||||||
|
public void setDbSize(String dbSize) {
|
||||||
|
if (StrUtil.isNotBlank(dbSize))
|
||||||
|
this.dbSize = dbSize + "GB";
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,17 +15,10 @@ public class NameValue implements Serializable {
|
||||||
|
|
||||||
private Boolean value;
|
private Boolean value;
|
||||||
|
|
||||||
private String valueT;
|
|
||||||
|
|
||||||
private Integer usage; // 单位 MB
|
private Integer usage; // 单位 MB
|
||||||
|
|
||||||
public NameValue(String name, Boolean value) {
|
public NameValue(String name, Boolean value) {
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.value = value;
|
this.value = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
public NameValue(String name, String valueT) {
|
|
||||||
this.name = name;
|
|
||||||
this.valueT = valueT;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,14 @@
|
||||||
|
package org.jeecg.modules.base.enums;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public enum DbItem {
|
||||||
|
DBMEMORY("dbMemory"),
|
||||||
|
LOGREMAININGSIZE("logRemainingSize"),
|
||||||
|
DBSIZE("dblSize");
|
||||||
|
|
||||||
|
private final String value;
|
||||||
|
}
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.aspect;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ArrayUtil;
|
import cn.hutool.core.util.ArrayUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
@ -103,8 +104,7 @@ public class StatusAspect {
|
||||||
databaseService.status2Redis(database);
|
databaseService.status2Redis(database);
|
||||||
String token = ManageUtil.getToken();
|
String token = ManageUtil.getToken();
|
||||||
Page<Host> hostPage = monitorAlarm.dbList(null, 1, 99, token).getResult();
|
Page<Host> hostPage = monitorAlarm.dbList(null, 1, 99, token).getResult();
|
||||||
if (ObjectUtil.isNull(hostPage) || CollUtil.isEmpty(hostPage.getRecords()))
|
if (ObjectUtil.isNull(hostPage) || CollUtil.isEmpty(hostPage.getRecords())) return;
|
||||||
return;
|
|
||||||
List<Host> hosts = hostPage.getRecords();
|
List<Host> hosts = hostPage.getRecords();
|
||||||
String name = database.getName();
|
String name = database.getName();
|
||||||
Host host = null;
|
Host host = null;
|
||||||
|
@ -112,8 +112,7 @@ public class StatusAspect {
|
||||||
if (StrUtil.equals(name, oneHost.getCode()))
|
if (StrUtil.equals(name, oneHost.getCode()))
|
||||||
host = oneHost;
|
host = oneHost;
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNull(host))
|
if (ObjectUtil.isNull(host)) return;
|
||||||
return;
|
|
||||||
// 更新数据源的HostId
|
// 更新数据源的HostId
|
||||||
database.setHostId(host.getHostId());
|
database.setHostId(host.getHostId());
|
||||||
databaseService.updateById(database);
|
databaseService.updateById(database);
|
||||||
|
@ -127,7 +126,7 @@ public class StatusAspect {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 新增|修改服务器信息后 异步更新其状态信息
|
* 新增|修改服务器信息后 异步更新其状态信息
|
||||||
* 更新服务器的状态(-1:未知 1:正常 2:离线 3:告警)和它对应的系统监控的HostId
|
* 更新服务器的状态(1:正常 2:离线 3:告警)和它对应的系统监控的HostId
|
||||||
* */
|
* */
|
||||||
@Async
|
@Async
|
||||||
@AfterReturning("execution(* org.jeecg.modules.service.impl.SysServerServiceImpl.update(..)) || " +
|
@AfterReturning("execution(* org.jeecg.modules.service.impl.SysServerServiceImpl.update(..)) || " +
|
||||||
|
@ -136,7 +135,7 @@ public class StatusAspect {
|
||||||
Object[] args = point.getArgs();
|
Object[] args = point.getArgs();
|
||||||
if (ArrayUtil.length(args) == 0) return;
|
if (ArrayUtil.length(args) == 0) return;
|
||||||
String key = RedisConstant.SERVER_STATUS;
|
String key = RedisConstant.SERVER_STATUS;
|
||||||
String status = ServerStatus.OFF.getValue();
|
Boolean online = null;
|
||||||
SysServer server = (SysServer) args[0];
|
SysServer server = (SysServer) args[0];
|
||||||
String id = server.getId();
|
String id = server.getId();
|
||||||
String name = server.getName();
|
String name = server.getName();
|
||||||
|
@ -146,7 +145,7 @@ public class StatusAspect {
|
||||||
Page<Host> hostPage = monitorAlarm.listApp(ipAddress, MonitorConstant.SERVER_APP,
|
Page<Host> hostPage = monitorAlarm.listApp(ipAddress, MonitorConstant.SERVER_APP,
|
||||||
MonitorConstant.pageNo, MonitorConstant.pageSize, token).getResult();
|
MonitorConstant.pageNo, MonitorConstant.pageSize, token).getResult();
|
||||||
if (ObjectUtil.isNull(hostPage) || CollUtil.isEmpty(hostPage.getRecords())){
|
if (ObjectUtil.isNull(hostPage) || CollUtil.isEmpty(hostPage.getRecords())){
|
||||||
redisUtil.hset(key, id, new NameValue(name, status));
|
redisUtil.hset(key, id, new NameValue(name, online));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
List<Host> hosts = hostPage.getRecords();
|
List<Host> hosts = hostPage.getRecords();
|
||||||
|
@ -156,12 +155,14 @@ public class StatusAspect {
|
||||||
host = oneHost;
|
host = oneHost;
|
||||||
}
|
}
|
||||||
if (ObjectUtil.isNull(host)){
|
if (ObjectUtil.isNull(host)){
|
||||||
redisUtil.hset(key, id, new NameValue(name, status));
|
redisUtil.hset(key, id, new NameValue(name, online));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
// 更新该服务器状态信息
|
// 更新该服务器状态信息
|
||||||
status = host.getStatus();
|
String status = host.getStatus();
|
||||||
redisUtil.hset(key, id, new NameValue(name, status));
|
online = CollUtil.contains(ListUtil.toList(ServerStatus.ON.getValue(),
|
||||||
|
ServerStatus.WARN.getValue()), status);
|
||||||
|
redisUtil.hset(key, id, new NameValue(name, online));
|
||||||
// 更新该服务器的HostId
|
// 更新该服务器的HostId
|
||||||
server.setHostId(host.getHostId());
|
server.setHostId(host.getHostId());
|
||||||
serverService.updateById(server);
|
serverService.updateById(server);
|
||||||
|
|
|
@ -2,24 +2,33 @@ package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.map.MapUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.ReUtil;
|
import cn.hutool.core.util.ReUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import feign.FeignException;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.jeecg.common.api.QueryRequest;
|
import org.jeecg.common.api.QueryRequest;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.*;
|
import org.jeecg.common.constant.*;
|
||||||
import org.jeecg.common.constant.enums.DbType;
|
import org.jeecg.common.constant.enums.DbType;
|
||||||
import org.jeecg.common.system.vo.DictModel;
|
import org.jeecg.common.system.vo.DictModel;
|
||||||
import org.jeecg.common.util.JDBCUtil;
|
import org.jeecg.common.util.JDBCUtil;
|
||||||
|
import org.jeecg.common.util.NumUtil;
|
||||||
import org.jeecg.common.util.RedisUtil;
|
import org.jeecg.common.util.RedisUtil;
|
||||||
import org.jeecg.common.util.SpringContextUtils;
|
import org.jeecg.common.util.SpringContextUtils;
|
||||||
import org.jeecg.modules.base.dto.*;
|
import org.jeecg.modules.base.dto.*;
|
||||||
|
import org.jeecg.modules.base.entity.monitor.Host;
|
||||||
|
import org.jeecg.modules.base.entity.monitor.Item;
|
||||||
import org.jeecg.modules.base.entity.postgre.SysDatabase;
|
import org.jeecg.modules.base.entity.postgre.SysDatabase;
|
||||||
import org.jeecg.modules.base.bizVo.SourceVo;
|
import org.jeecg.modules.base.bizVo.SourceVo;
|
||||||
|
import org.jeecg.modules.base.enums.DbItem;
|
||||||
import org.jeecg.modules.entity.AlarmHistory;
|
import org.jeecg.modules.entity.AlarmHistory;
|
||||||
|
import org.jeecg.modules.feignclient.ManageUtil;
|
||||||
|
import org.jeecg.modules.feignclient.MonitorAlarm;
|
||||||
import org.jeecg.modules.feignclient.SystemClient;
|
import org.jeecg.modules.feignclient.SystemClient;
|
||||||
import org.jeecg.modules.mapper.DBRowMapper;
|
import org.jeecg.modules.mapper.DBRowMapper;
|
||||||
import org.jeecg.modules.mapper.SpaceRowMapper;
|
import org.jeecg.modules.mapper.SpaceRowMapper;
|
||||||
|
@ -40,7 +49,7 @@ import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static org.jeecg.common.constant.enums.DbType.*;
|
import static org.jeecg.common.constant.enums.DbType.*;
|
||||||
|
@Slf4j
|
||||||
@Service("sysDatabaseService")
|
@Service("sysDatabaseService")
|
||||||
public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDatabase> implements ISysDatabaseService {
|
public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDatabase> implements ISysDatabaseService {
|
||||||
|
|
||||||
|
@ -50,6 +59,9 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
|
||||||
@Autowired
|
@Autowired
|
||||||
private SystemClient systemClient;
|
private SystemClient systemClient;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MonitorAlarm monitorAlarm;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Result<?> findPage(QueryRequest query) {
|
public Result<?> findPage(QueryRequest query) {
|
||||||
Integer pageNo = query.getPageNo();
|
Integer pageNo = query.getPageNo();
|
||||||
|
@ -72,23 +84,53 @@ public class SysDatabaseServiceImpl extends ServiceImpl<SysDatabaseMapper, SysDa
|
||||||
// 数据库连接状态Map key:id value:状态值(true|false)
|
// 数据库连接状态Map key:id value:状态值(true|false)
|
||||||
String statusKey = RedisConstant.DATABASE_STATUS;
|
String statusKey = RedisConstant.DATABASE_STATUS;
|
||||||
Map<Object, Object> statusMap = redisUtil.hmget(statusKey);
|
Map<Object, Object> statusMap = redisUtil.hmget(statusKey);
|
||||||
|
// 向运管系统查询数据库相关指标信息
|
||||||
|
Map<String,Host> dbMap = new HashMap<>();
|
||||||
|
try {
|
||||||
|
String token = ManageUtil.getToken();
|
||||||
|
Page<Host> dbPage = monitorAlarm.dbList(null, 1, 99, token).getResult();
|
||||||
|
if (ObjectUtil.isNotNull(dbPage) && CollUtil.isNotEmpty(dbPage.getRecords()))
|
||||||
|
dbMap = dbPage.getRecords().stream().collect(Collectors.toMap(Host::getName, host -> host));
|
||||||
|
}catch (FeignException.Unauthorized e){
|
||||||
|
ManageUtil.refreshToken();
|
||||||
|
log.warn("向运管系统查询DB信息异常: Token失效,已刷新Token");
|
||||||
|
}catch (Exception e){
|
||||||
|
log.error("向运管系统查询DB信息异常: {}", e.getMessage());
|
||||||
|
}
|
||||||
for (DatabaseDto databaseDto : databaseDtos) {
|
for (DatabaseDto databaseDto : databaseDtos) {
|
||||||
boolean online = false;
|
boolean online = false;
|
||||||
String id = databaseDto.getId();
|
String id = databaseDto.getId();
|
||||||
String type = databaseDto.getType();
|
String type = databaseDto.getType();
|
||||||
|
String name = databaseDto.getName();
|
||||||
Integer alarms = databaseDto.getAlarms();
|
Integer alarms = databaseDto.getAlarms();
|
||||||
boolean alarmRed = ObjectUtil.isNotNull(alarms) && alarms > 0;
|
boolean alarmRed = ObjectUtil.isNotNull(alarms) && alarms > 0;
|
||||||
NameValue nameValue = (NameValue) statusMap.get(id);
|
NameValue nameValue = (NameValue) statusMap.get(id);
|
||||||
if (ObjectUtil.isNotNull(nameValue)){
|
if (ObjectUtil.isNotNull(nameValue)){
|
||||||
Boolean value = nameValue.getValue();
|
Boolean value = nameValue.getValue();
|
||||||
if (ObjectUtil.isNotNull(value))
|
if (ObjectUtil.isNotNull(value)) online = value;
|
||||||
online = value;
|
|
||||||
}
|
}
|
||||||
String dataBaseType = dataSourceMap.get(type);
|
String dataBaseType = dataSourceMap.get(type);
|
||||||
databaseDto.setDataBaseType(dataBaseType)
|
databaseDto.setDataBaseType(dataBaseType)
|
||||||
.setOnline(online).setSlowQuery("328/s")
|
.setAlarmRed(alarmRed).setOnline(online);
|
||||||
.setAlarmRed(alarmRed).setCpuUutilzation("35.8%")
|
|
||||||
.setMemoryUsage("55.8%").setDiskUsage("35.6%");
|
// 获取数据库指标信息
|
||||||
|
Host db = dbMap.get(name);
|
||||||
|
if (ObjectUtil.isNull(db)) continue;
|
||||||
|
if (!online) continue;
|
||||||
|
Map<String, Item> itemMap = db.getItems();
|
||||||
|
if (MapUtil.isEmpty(itemMap)) continue;
|
||||||
|
// dbMemory kb -> GB
|
||||||
|
Item item = itemMap.get(DbItem.DBMEMORY.getValue());
|
||||||
|
if (ObjectUtil.isNotNull(item))
|
||||||
|
databaseDto.setDbMemory(NumUtil.kb2Gb(item.getLastValue(), 2));
|
||||||
|
// logRemainingSize byte -> MB
|
||||||
|
item = itemMap.get(DbItem.LOGREMAININGSIZE.getValue());
|
||||||
|
if (ObjectUtil.isNotNull(item))
|
||||||
|
databaseDto.setLogRemainingSize(NumUtil.byte2Mb(item.getLastValue(), 2));
|
||||||
|
// dbSize byte -> GB
|
||||||
|
item = itemMap.get(DbItem.DBSIZE.getValue());
|
||||||
|
if (ObjectUtil.isNotNull(item))
|
||||||
|
databaseDto.setDbSize(NumUtil.byte2Gb(item.getLastValue(), 2));
|
||||||
}
|
}
|
||||||
page.setRecords(databaseDtos);
|
page.setRecords(databaseDtos);
|
||||||
return Result.OK(page);
|
return Result.OK(page);
|
||||||
|
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.ListUtil;
|
||||||
import cn.hutool.core.convert.Convert;
|
import cn.hutool.core.convert.Convert;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.map.MapUtil;
|
import cn.hutool.core.map.MapUtil;
|
||||||
|
@ -100,13 +101,10 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
|
||||||
serverDto.setAlarmRed(alarms > 0);
|
serverDto.setAlarmRed(alarms > 0);
|
||||||
// 设置服务器状态信息
|
// 设置服务器状态信息
|
||||||
NameValue nameValue = (NameValue) statusMap.get(id);
|
NameValue nameValue = (NameValue) statusMap.get(id);
|
||||||
String status = OFF.getValue();
|
Boolean value = null;
|
||||||
if (ObjectUtil.isNotNull(nameValue)){
|
if (ObjectUtil.isNotNull(nameValue))
|
||||||
String valueT = nameValue.getValueT();
|
value = nameValue.getValue();
|
||||||
if (StrUtil.isNotBlank(valueT))
|
boolean online = ObjectUtil.isNotNull(value) && value;
|
||||||
status = valueT;
|
|
||||||
}
|
|
||||||
boolean online = StrUtil.equals(status, ON.getValue());
|
|
||||||
// 设置服务器的硬件使用情况信息
|
// 设置服务器的硬件使用情况信息
|
||||||
Host host = hostMap.get(hostId);
|
Host host = hostMap.get(hostId);
|
||||||
if (ObjectUtil.isNull(host))
|
if (ObjectUtil.isNull(host))
|
||||||
|
@ -123,7 +121,6 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
|
||||||
String memory = StrUtil.isBlank(memoryValue) ? "--" :
|
String memory = StrUtil.isBlank(memoryValue) ? "--" :
|
||||||
NumUtil.keepStr(memoryValue, 1) + "%";
|
NumUtil.keepStr(memoryValue, 1) + "%";
|
||||||
// 磁盘使用率
|
// 磁盘使用率
|
||||||
|
|
||||||
serverDto.setOnline(online).setCpuUutilzation(cpu)
|
serverDto.setOnline(online).setCpuUutilzation(cpu)
|
||||||
.setMemoryUsage(memory).setDiskUsage("--");
|
.setMemoryUsage(memory).setDiskUsage("--");
|
||||||
}
|
}
|
||||||
|
@ -372,6 +369,7 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
|
||||||
MonitorConstant.pageNo, MonitorConstant.pageSize, token).getResult().getRecords();
|
MonitorConstant.pageNo, MonitorConstant.pageSize, token).getResult().getRecords();
|
||||||
Map<String, Host> hostMap = hosts.stream().collect(Collectors.toMap(Host::getHostId, Host -> Host));
|
Map<String, Host> hostMap = hosts.stream().collect(Collectors.toMap(Host::getHostId, Host -> Host));
|
||||||
for (SysServer server : sysServers) {
|
for (SysServer server : sysServers) {
|
||||||
|
Boolean online = null;
|
||||||
String hostId = server.getHostId();
|
String hostId = server.getHostId();
|
||||||
String name = server.getName();
|
String name = server.getName();
|
||||||
String serverId = server.getId();
|
String serverId = server.getId();
|
||||||
|
@ -379,11 +377,13 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
|
||||||
// 获取该服务器的状态并保存
|
// 获取该服务器的状态并保存
|
||||||
if (ObjectUtil.isNotNull(host)) {
|
if (ObjectUtil.isNotNull(host)) {
|
||||||
String status = host.getStatus();
|
String status = host.getStatus();
|
||||||
values.put(serverId, new NameValue(name, status));
|
online = CollUtil.contains(ListUtil.toList(ServerStatus.ON.getValue(),
|
||||||
|
ServerStatus.WARN.getValue()), status);
|
||||||
|
values.put(serverId, new NameValue(name, online));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// 当前服务器不在监控服务器列表 将它的状态设置为未知
|
// 当前服务器不在监控服务器列表
|
||||||
values.put(serverId, new NameValue(name, OFF.getValue()));
|
values.put(serverId, new NameValue(name, online));
|
||||||
}
|
}
|
||||||
redisUtil.hmset(key, values);
|
redisUtil.hmset(key, values);
|
||||||
}catch (FeignException.Unauthorized e){
|
}catch (FeignException.Unauthorized e){
|
||||||
|
@ -412,7 +412,7 @@ public class SysServerServiceImpl extends ServiceImpl<SysServerMapper, SysServer
|
||||||
for (SysServer sysServer : sysServers) {
|
for (SysServer sysServer : sysServers) {
|
||||||
String id = sysServer.getId();
|
String id = sysServer.getId();
|
||||||
String name = sysServer.getName();
|
String name = sysServer.getName();
|
||||||
values.put(id, new NameValue(name, OFF.getValue()));
|
values.put(id, new NameValue(name, null));
|
||||||
}
|
}
|
||||||
redisUtil.hmset(key, values);
|
redisUtil.hmset(key, values);
|
||||||
}
|
}
|
||||||
|
|
|
@ -63,11 +63,11 @@ public class JeecgSpectrumAnalysisApplication extends SpringBootServletInitializ
|
||||||
@Override
|
@Override
|
||||||
public void run(String... args) throws Exception {
|
public void run(String... args) throws Exception {
|
||||||
//Windows加载dll工具库
|
//Windows加载dll工具库
|
||||||
System.loadLibrary("ReadPHDFile");
|
/*System.loadLibrary("ReadPHDFile");
|
||||||
System.loadLibrary("GammaAnaly");
|
System.loadLibrary("GammaAnaly");*/
|
||||||
//Linux版本加载dll工具库
|
//Linux版本加载dll工具库
|
||||||
// System.load("/usr/local/jdk/lib/libReadPHDFile.so");
|
System.load("/usr/local/jdk/lib/libReadPHDFile.so");
|
||||||
// System.load("/usr/local/jdk/lib/libGammaAnalyALG.so");
|
System.load("/usr/local/jdk/lib/libGammaAnalyALG.so");
|
||||||
//创建缓存
|
//创建缓存
|
||||||
betaCache.initCache();
|
betaCache.initCache();
|
||||||
localCache.initCache();
|
localCache.initCache();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user