说明:1、优化服务监控页面以及后端获取的参数

pull/254/head
xjs 4 years ago
parent dbdf918fe9
commit e4868fec9e

@ -1,80 +1,95 @@
<template> <template>
<div> <div>
<el-row :gutter="20"> <el-row :gutter="24">
<el-col :span="12"> <el-col :md="12" :sm="24">
<div class="grid-content bg-purple"> <el-card header="系统信息" style="margin-bottom: 20px" :bordered="false">
<el-tag type="info">jvm版本</el-tag> <table class="sysInfo_table">
{{serviceMonitorInfo.jvmVersion}} <tr>
<br> <td class="sysInfo_td">系统名称</td>
<el-tag type="info">jre安装路径</el-tag> <td class="sysInfo_td">{{ serviceMonitorInfo.osName }}</td>
{{serviceMonitorInfo.jreHoneDir}} </tr>
<br> <tr>
<el-tag type="info">jre版本</el-tag> <td class="sysInfo_td">系统架构</td>
{{serviceMonitorInfo.jreVersion}} <td class="sysInfo_td">{{ serviceMonitorInfo.osArch }}</td>
<br> </tr>
<el-tag type="info">jre名称</el-tag> <tr>
{{serviceMonitorInfo.jreName}} <td class="sysInfo_td">系统版本</td>
<br> <td class="sysInfo_td">{{ serviceMonitorInfo.osVersion }}</td>
</div> </tr>
<tr>
<td class="sysInfo_td">主机名称</td>
<td class="sysInfo_td">{{ serviceMonitorInfo.hostName }}</td>
</tr>
<tr>
<td>主机IP地址</td>
<td>{{ serviceMonitorInfo.hostAddress }}</td>
</tr>
</table>
</el-card>
</el-col> </el-col>
<el-col :span="12"> <el-col :md="12" :sm="24">
<div class="grid-content bg-purple"> <el-card header="Java信息" style="margin-bottom: 20px">
<el-tag type="info">系统名称</el-tag> <table class="sysInfo_table">
{{serviceMonitorInfo.osName}} <tr>
<br> <td class="sysInfo_td">虚拟机名称</td>
<el-tag type="info">系统版本</el-tag> <td class="sysInfo_td">{{ serviceMonitorInfo.jreName }}</td>
{{serviceMonitorInfo.osVersion}} </tr>
<br> <tr>
<el-tag type="info">系统架构</el-tag> <td class="sysInfo_td">虚拟机版本</td>
{{serviceMonitorInfo.osArch}} <td class="sysInfo_td">{{ serviceMonitorInfo.jvmVersion }}</td>
<br> </tr>
</div> <tr>
</el-col> <td class="sysInfo_td">JAVA版本</td>
</el-row> <td class="sysInfo_td">{{ serviceMonitorInfo.jreVersion }}</td>
<el-row :gutter="20"> </tr>
<el-col :span="12"> <tr>
<div class="grid-content bg-purple"> <td class="sysInfo_td">JRE安装路径</td>
<el-tag type="info">主机名</el-tag> <td class="sysInfo_td">{{ serviceMonitorInfo.jreHoneDir }}</td>
{{serviceMonitorInfo.hostName}} </tr>
<br> <tr>
<el-tag type="info">主机地址</el-tag> <td class="sysInfo_td">项目路径</td>
{{serviceMonitorInfo.hostAddress}} <td class="sysInfo_td">{{ serviceMonitorInfo.currentDir }}</td>
<br> </tr>
<el-tag type="info">登录名</el-tag> </table>
{{serviceMonitorInfo.userName}} </el-card>
<br>
<el-tag type="info">用户路径</el-tag>
{{serviceMonitorInfo.homeDir}}
<br>
<el-tag type="info">当前目录</el-tag>
{{serviceMonitorInfo.currentDir}}
<br>
<el-tag type="info">登录语言</el-tag>
{{serviceMonitorInfo.userLanguage}}
<br>
<el-tag type="info">登录区域</el-tag>
{{serviceMonitorInfo.userCountry}}
<br>
</div>
</el-col>
<el-col :span="12">
<div class="grid-content bg-purple">
<el-tag type="info">最大jvm内存</el-tag>
{{serviceMonitorInfo.maxMemory/1024/1024+"M"}}
<br>
<el-tag type="info">已分配内存</el-tag>
{{serviceMonitorInfo.totalMemory/1024/1024+"M"}}
<br>
<el-tag type="info">剩余内存</el-tag>
{{parseFloat(Number(serviceMonitorInfo.freeMemory/1024/1024).toFixed(0))+"M"}}
<br>
<el-tag type="info">最大可用内存</el-tag>
{{parseFloat(Number(serviceMonitorInfo.usableMemory/1024/1024).toFixed(0))+"M"}}
<br>
</div>
</el-col> </el-col>
</el-row> </el-row>
<el-card header="JVM内存信息">
<table class="sysInfo_table">
<tr>
<td class="sysInfo_td">可用内存</td>
<td class="sysInfo_td">
{{ parseFloat(Number(serviceMonitorInfo.usableMemory / 1024 / 1024).toFixed(0)) + "M" }}
</td>
<td class="sysInfo_td">已使用内存</td>
<td class="sysInfo_td">{{ serviceMonitorInfo.totalMemory / 1024 / 1024 + "M" }}</td>
</tr>
<tr>
<td class="sysInfo_td">总内存</td>
<td class="sysInfo_td">{{ serviceMonitorInfo.maxMemory / 1024 / 1024 + "M" }}</td>
<td class="sysInfo_td">空余内存</td>
<td class="sysInfo_td">
{{ parseFloat(Number(serviceMonitorInfo.freeMemory / 1024 / 1024).toFixed(0)) + "M" }}
</td>
</tr>
</table>
</el-card>
<el-card header="浏览器信息">
<table class="sysInfo_table">
<tr>
<td class="sysInfo_td">端口号</td>
<td class="sysInfo_td">{{ serviceMonitorInfo.serverPort }}</td>
</tr>
<tr>
<td class="sysInfo_td">字符编码</td>
<td class="sysInfo_td">{{ serviceMonitorInfo.characterEncoding }}</td>
</tr>
<tr>
<td class="sysInfo_td">浏览器标识</td>
<td class="sysInfo_td">{{ serviceMonitorInfo.userAgent }}</td>
</tr>
</table>
</el-card>
</div> </div>
</template> </template>
@ -86,9 +101,7 @@ export default {
name: "Online", name: "Online",
data() { data() {
return { return {
serviceMonitorInfo:{ serviceMonitorInfo: {}
}
} }
}, },
@ -97,8 +110,8 @@ export default {
}, },
methods: { methods: {
getServiceMonitor() { getServiceMonitor() {
getServiceMonitor().then(res =>{ getServiceMonitor().then(res => {
this.serviceMonitorInfo=res.data this.serviceMonitorInfo = res.data
}) })
}, },
}, },
@ -106,21 +119,15 @@ export default {
</script> </script>
<style scoped> <style scoped>
.el-row { .sysInfo_table {
margin: 100px; width: 100%;
padding: 0 20px; min-height: 45px;
line-height: 45px;
text-align: center;
} }
.el-col {
border-radius: 4px; .sysInfo_td {
} border-bottom: 1px solid #e8e8e8;
.grid-content {
border-radius: 4px;
min-height: 36px;
padding: 0 180px;
}
.row-bg {
padding: 10px 0;
background-color: #f9fafc;
} }
</style> </style>

@ -9,6 +9,8 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import javax.servlet.http.HttpServletRequest;
/** /**
* @author xiejs * @author xiejs
* @desc * @desc
@ -25,8 +27,16 @@ public class ServiceMonitorController {
@GetMapping @GetMapping
public AjaxResult getServiceMonitor() { public AjaxResult getServiceMonitor(HttpServletRequest request) {
ServiceMonitorInfo serviceMonitorInfo = new ServiceMonitorInfo(); ServiceMonitorInfo serviceMonitorInfo = new ServiceMonitorInfo();
//获取客户端信息
String characterEncoding = request.getCharacterEncoding();
int serverPort = request.getServerPort();
String userAgent = request.getHeader("user-agent");
serviceMonitorInfo.setCharacterEncoding(characterEncoding);
serviceMonitorInfo.setServerPort(serverPort);
serviceMonitorInfo.setUserAgent(userAgent);
//获取服务器信息
serviceMonitorInfo.setFreeMemory(systemOSService.getRuntimeInfo().getFreeMemory()); serviceMonitorInfo.setFreeMemory(systemOSService.getRuntimeInfo().getFreeMemory());
serviceMonitorInfo.setCurrentDir(systemOSService.getUserInfo().getCurrentDir()); serviceMonitorInfo.setCurrentDir(systemOSService.getUserInfo().getCurrentDir());
serviceMonitorInfo.setHomeDir(systemOSService.getUserInfo().getHomeDir()); serviceMonitorInfo.setHomeDir(systemOSService.getUserInfo().getHomeDir());

@ -101,4 +101,19 @@ public class ServiceMonitorInfo {
*/ */
private Long usableMemory; private Long usableMemory;
/**
*
*/
private String characterEncoding;
/**
*
*/
private Integer serverPort;
/**
*
*/
private String userAgent;
} }

Loading…
Cancel
Save