增加cpu温度处理
This commit is contained in:
+8
@@ -112,4 +112,12 @@ public class InitialCpuInfoController extends BaseController
|
||||
Map<String, Object> echartsData = initialCpuInfoService.cpuTimeEcharts(initialCpuInfo);
|
||||
return success(echartsData);
|
||||
}
|
||||
/**
|
||||
* 查询CPU温度信息并封装为多折线ECharts图表数据
|
||||
*/
|
||||
@PostMapping("/cupTemperatureEcharts")
|
||||
public AjaxResult cupTemperatureEcharts(@RequestBody InitialCpuInfo initialCpuInfo) {
|
||||
Map<String, Object> echartsData = initialCpuInfoService.cupTemperatureEcharts(initialCpuInfo);
|
||||
return success(echartsData);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -29,6 +29,9 @@ public class AllDiskName extends BaseEntity
|
||||
/** 磁盘状态(0:丢失,1:存在) */
|
||||
@Excel(name = "磁盘状态(0:丢失,1:存在)")
|
||||
private Integer status;
|
||||
/** 执行卸载(0未执行,1已执行) */
|
||||
@Excel(name = "执行卸载(0未执行,1已执行)")
|
||||
private Integer umountFlag;
|
||||
|
||||
/** 读取IOPS */
|
||||
@Excel(name = "读取IOPS")
|
||||
|
||||
@@ -72,6 +72,8 @@ public class InitialCpuInfo extends BaseEntity
|
||||
/** CPU用户进程所花费的时间(秒) */
|
||||
@Excel(name = "CPU用户进程所花费的时间")
|
||||
private Long user;
|
||||
/** cpu温度 */
|
||||
private Long temperature;
|
||||
/** 开始时间 */
|
||||
private String startTime;
|
||||
/** 结束时间 */
|
||||
|
||||
@@ -549,6 +549,9 @@ public class MessageHandler {
|
||||
cpus.forEach(iface -> {
|
||||
iface.setClientId(message.getClientId());
|
||||
iface.setCreateTime(createTime);
|
||||
if(iface.getTemperature() == 0L){
|
||||
iface.setTemperature(null);
|
||||
}
|
||||
});
|
||||
// 初始CPU数据入库
|
||||
initialCpuInfoService.batchInsertInitialCpuInfo(cpus);
|
||||
|
||||
+7
@@ -71,4 +71,11 @@ public interface IInitialCpuInfoService
|
||||
Map<String, Object> cupLoadEcharts(InitialCpuInfo initialCpuInfo);
|
||||
|
||||
Map<String, Object> cpuTimeEcharts(InitialCpuInfo initialCpuInfo);
|
||||
|
||||
/**
|
||||
* cpu温度
|
||||
* @param initialCpuInfo
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> cupTemperatureEcharts(InitialCpuInfo initialCpuInfo);
|
||||
}
|
||||
|
||||
+4
@@ -137,6 +137,10 @@ public class AllDiskNameServiceImpl implements IAllDiskNameService
|
||||
if(processType == 1){
|
||||
policyTypeVo.setDiskIopsTest(allDiskName.getName());
|
||||
}else if(processType ==2){
|
||||
AllDiskName updateDisk = new AllDiskName();
|
||||
updateDisk.setId(id);
|
||||
updateDisk.setUmountFlag(1);
|
||||
allDiskNameMapper.updateAllDiskName(updateDisk);
|
||||
policyTypeVo.setUmountDisk(allDiskName.getName());
|
||||
}
|
||||
MessageProducer messageProducer = new MessageProducer();
|
||||
|
||||
+15
@@ -160,5 +160,20 @@ public class InitialCpuInfoServiceImpl implements IInitialCpuInfoService
|
||||
|
||||
return EchartsDataUtils.buildEchartsData(list,InitialCpuInfo::getCreateTime, extractors);
|
||||
}
|
||||
/**
|
||||
* cpu负载
|
||||
* @param initialCpuInfo
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> cupTemperatureEcharts(InitialCpuInfo initialCpuInfo) {
|
||||
// 查询原始CPU监控数据并按时间排序
|
||||
List<InitialCpuInfo> list = initialCpuInfoMapper.selectInitialCpuInfoList(initialCpuInfo);
|
||||
|
||||
Map<String, Function<InitialCpuInfo, ?>> extractors = new LinkedHashMap<>();
|
||||
extractors.put("temperatureData", InitialCpuInfo::getTemperature);
|
||||
|
||||
return EchartsDataUtils.buildEchartsDataAutoPadding(list, InitialCpuInfo::getCreateTime, extractors, initialCpuInfo.getStartTime(), initialCpuInfo.getEndTime());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+1
-1
@@ -253,7 +253,7 @@ public class InitialDiskInfoServiceImpl implements IInitialDiskInfoService
|
||||
public Map<String, Object> usedSpaceEcharts(InitialDiskInfo initialDiskInfo) {
|
||||
initialDiskInfo.setType("HDD");
|
||||
List<InitialDiskInfo> list = getDistInfoSharding(initialDiskInfo);
|
||||
String unit = "KB";
|
||||
String unit = "Kb";
|
||||
if(list != null && !list.isEmpty()){
|
||||
Long totalUsedSpace = 0L;
|
||||
for (InitialDiskInfo diskInfo : list) {
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tongran.rocketmq.mapper.AllDiskNameMapper">
|
||||
|
||||
|
||||
<resultMap type="AllDiskName" id="AllDiskNameResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="clientId" column="client_id" />
|
||||
@@ -11,6 +11,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="status" column="status" />
|
||||
<result property="readIops" column="read_iops" />
|
||||
<result property="writeIops" column="write_iops" />
|
||||
<result property="umountFlag" column="umount_flag" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateTime" column="update_time" />
|
||||
<result property="createBy" column="create_by" />
|
||||
@@ -18,7 +19,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectAllDiskNameVo">
|
||||
select id, client_id, name, status, read_iops, write_iops, create_time, update_time, create_by, update_by from all_disk_name
|
||||
select id, client_id, name, status, read_iops, write_iops, umount_flag, create_time, update_time, create_by, update_by from all_disk_name
|
||||
</sql>
|
||||
|
||||
<select id="selectAllDiskNameList" parameterType="AllDiskName" resultMap="AllDiskNameResult">
|
||||
@@ -29,9 +30,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="readIops != null and readIops != ''"> and read_iops = #{readIops}</if>
|
||||
<if test="writeIops != null and writeIops != ''"> and write_iops = #{writeIops}</if>
|
||||
<if test="umountFlag != null "> and umount_flag = #{umountFlag}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectAllDiskNameById" parameterType="Long" resultMap="AllDiskNameResult">
|
||||
<include refid="selectAllDiskNameVo"/>
|
||||
where id = #{id}
|
||||
@@ -45,6 +47,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null">status,</if>
|
||||
<if test="readIops != null">read_iops,</if>
|
||||
<if test="writeIops != null">write_iops,</if>
|
||||
<if test="umountFlag != null">umount_flag,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
@@ -56,6 +59,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null">#{status},</if>
|
||||
<if test="readIops != null">#{readIops},</if>
|
||||
<if test="writeIops != null">#{writeIops},</if>
|
||||
<if test="umountFlag != null">#{umountFlag},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
@@ -67,6 +71,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="readIops != null">read_iops = #{readIops},</if>
|
||||
<if test="writeIops != null">write_iops = #{writeIops},</if>
|
||||
<if test="umountFlag != null">umount_flag = #{umountFlag},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
</trim>
|
||||
@@ -78,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="status != null">status = #{status},</if>
|
||||
<if test="readIops != null">read_iops = #{readIops},</if>
|
||||
<if test="writeIops != null">write_iops = #{writeIops},</if>
|
||||
<if test="umountFlag != null">umount_flag = #{umountFlag},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
@@ -103,14 +109,14 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteAllDiskNameByIds" parameterType="String">
|
||||
delete from all_disk_name where id in
|
||||
delete from all_disk_name where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</delete>
|
||||
<insert id="batchInsertAllDistName" parameterType="java.util.List">
|
||||
insert IGNORE into all_disk_name
|
||||
(client_id, name, status, read_iops, write_iops, create_time, update_time, create_by, update_by)
|
||||
(client_id, name, status, read_iops, write_iops, umount_flag, create_time, update_time, create_by, update_by)
|
||||
values
|
||||
<foreach collection="list" item="item" separator=",">
|
||||
(
|
||||
@@ -119,6 +125,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item.status},
|
||||
#{item.readIops},
|
||||
#{item.writeIops},
|
||||
#{item.umountFlag},
|
||||
#{item.createTime},
|
||||
#{item.updateTime},
|
||||
#{item.createBy},
|
||||
@@ -135,6 +142,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
a.status,
|
||||
a.read_iops as readIops,
|
||||
a.write_iops as writeIops,
|
||||
a.umount_flag as umountFlag,
|
||||
a.create_time as createTime,
|
||||
a.update_time as updateTime,
|
||||
b.serial,
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.tongran.rocketmq.mapper.InitialCpuInfoMapper">
|
||||
|
||||
|
||||
<resultMap type="InitialCpuInfo" id="InitialCpuInfoResult">
|
||||
<result property="id" column="id" />
|
||||
<result property="clientId" column="client_id" />
|
||||
@@ -20,6 +20,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<result property="system" column="system" />
|
||||
<result property="noresp" column="noresp" />
|
||||
<result property="user" column="user" />
|
||||
|
||||
<result property="temperature" column="temperature" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
@@ -27,19 +29,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectInitialCpuInfoVo">
|
||||
select id, client_id, avg1, avg5, avg15, interrupt, uti, num, cores, normal, idle, iowait, system, noresp, user, create_by, update_by, create_time, update_time from initial_cpu_info
|
||||
select
|
||||
id,
|
||||
client_id,
|
||||
avg1,
|
||||
avg5,
|
||||
avg15,
|
||||
interrupt,
|
||||
uti,
|
||||
num,
|
||||
cores,
|
||||
normal,
|
||||
idle,
|
||||
iowait,
|
||||
system,
|
||||
noresp,
|
||||
user,
|
||||
temperature,
|
||||
create_by,
|
||||
update_by,
|
||||
create_time,
|
||||
update_time
|
||||
from initial_cpu_info
|
||||
</sql>
|
||||
|
||||
<select id="selectInitialCpuInfoList" parameterType="InitialCpuInfo" resultMap="InitialCpuInfoResult">
|
||||
<include refid="selectInitialCpuInfoVo"/>
|
||||
<where>
|
||||
<where>
|
||||
<if test="clientId != null and clientId != ''"> and client_id = #{clientId}</if>
|
||||
<if test="temperature != null"> and temperature = #{temperature}</if>
|
||||
<if test="startTime != null and startTime != ''"> and create_time >= #{startTime}</if>
|
||||
<if test="endTime != null and endTime != ''"> and create_time <= #{endTime}</if>
|
||||
</where>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectInitialCpuInfoById" parameterType="Long" resultMap="InitialCpuInfoResult">
|
||||
<include refid="selectInitialCpuInfoVo"/>
|
||||
where id = #{id}
|
||||
@@ -62,11 +86,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="system != null">system,</if>
|
||||
<if test="noresp != null">noresp,</if>
|
||||
<if test="user != null">user,</if>
|
||||
|
||||
<if test="temperature != null">temperature,</if>
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="clientId != null and clientId != ''">#{clientId},</if>
|
||||
<if test="avg1 != null">#{avg1},</if>
|
||||
@@ -82,11 +108,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="system != null">#{system},</if>
|
||||
<if test="noresp != null">#{noresp},</if>
|
||||
<if test="user != null">#{user},</if>
|
||||
|
||||
<if test="temperature != null">#{temperature},</if>
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateInitialCpuInfo" parameterType="InitialCpuInfo">
|
||||
@@ -106,6 +134,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="system != null">system = #{system},</if>
|
||||
<if test="noresp != null">noresp = #{noresp},</if>
|
||||
<if test="user != null">user = #{user},</if>
|
||||
|
||||
<if test="temperature != null">temperature = #{temperature},</if>
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
@@ -119,7 +149,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
</delete>
|
||||
|
||||
<delete id="deleteInitialCpuInfoByIds" parameterType="String">
|
||||
delete from initial_cpu_info where id in
|
||||
delete from initial_cpu_info where id in
|
||||
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
@@ -142,6 +172,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
`system`,
|
||||
noresp,
|
||||
`user`,
|
||||
temperature,
|
||||
create_by,
|
||||
update_by,
|
||||
create_time,
|
||||
@@ -164,6 +195,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{item.system},
|
||||
#{item.noresp},
|
||||
#{item.user},
|
||||
#{item.temperature},
|
||||
#{item.createBy},
|
||||
#{item.updateBy},
|
||||
<choose>
|
||||
@@ -185,6 +217,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
)
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="getCpuInfoByClientId" parameterType="String" resultMap="InitialCpuInfoResult">
|
||||
<include refid="selectInitialCpuInfoVo"/>
|
||||
where client_id = #{clientId}
|
||||
|
||||
Reference in New Issue
Block a user