懒羊羊
2023-08-30 71e81ed1d12e4d69f53c8ad9e066650ad4186293
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>${constants.getSystemName()}</title>
    <link rel="stylesheet" href="${ctxPath}/assets/common/libs/layui/css/layui.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/common/module/admin.css?v=${constants.getReleaseVersion()}"/>
    <link rel="stylesheet" href="${ctxPath}/assets/expand/css/style.css?v=${constants.getReleaseVersion()}" media="all"/>
</head>
 
<body>
 
<!-- 加载动画,移除位置在common.js中 -->
<div class="page-loading">
    <div class="ball-loader">
        <span></span><span></span><span></span><span></span>
    </div>
</div>
 
<!-- 正文开始 -->
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
 
        <div class="layui-col-lg6">
            <div class="layui-card">
                <div class="layui-card-header">CPU信息</div>
                <div class="layui-card-body">
                    <table class="layui-table layui-text">
                        <thead>
                        <tr>
                            <th>属性</th>
                            <td>值</td>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>核心数</td>
                            <td>${server.cpu.cpuNum!'0'}</td>
                        </tr>
                        <tr>
                            <td>用户使用率</td>
                            <td>${server.cpu.used!'0'}%</td>
                        </tr>
                        <tr>
                            <td>系统使用率</td>
                            <td id="sysUsage">${server.cpu.sys!'0'}%</td>
                        </tr>
                        <tr>
                            <td>当前空闲率</td>
                            <td>${server.cpu.free!'0'}%</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
 
        <div class="layui-col-lg6">
            <div class="layui-card">
                <div class="layui-card-header">内存信息</div>
                <div class="layui-card-body">
                    <table class="layui-table layui-text">
                        <thead>
                        <tr>
                            <th>属性</th>
                            <th>内存</th>
                            <th>JVM</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <td>总内存</td>
                            <td>${server.mem.total!'0'}GB</td>
                            <td>${server.jvm.total!'0'}MB</td>
                        </tr>
                        <tr>
                            <td>已用内存</td>
                            <td>${server.mem.used!'0'}GB</td>
                            <td>${server.jvm.used!'0'}MB</td>
                        </tr>
                        <tr>
                            <td>剩余内存</td>
                            <td>${server.mem.free!'0'}GB</td>
                            <td>${server.jvm.free!'0'}MB</td>
                        </tr>
                        <tr>
                            <td>使用率</td>
                            <td id="memUsage">${server.mem.usage!'0'}%</td>
                            <td id="jvmUsage">${server.jvm.usage!'0'}%</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
 
        <div class="layui-col-lg12">
            <div class="layui-card">
                <div class="layui-card-header">JAVA虚拟机信息</div>
                <div class="layui-card-body">
                    <table class="layui-table layui-text">
                        <tbody>
                        <tr>
                            <td class="layui-table-header">Jvm名称</td>
                            <td>${server.jvm.name!}</td>
                            <td class="layui-table-header">Java版本</td>
                            <td>${server.jvm.version!}</td>
                        </tr>
                        <tr>
                            <td class="layui-table-header">启动时间</td>
                            <td>${server.jvm.startTime}</td>
                            <td class="layui-table-header">运行时长</td>
                            <td>${server.jvm.runTime}</td>
                        </tr>
                        <tr>
                            <td colspan="1" class="layui-table-header">安装路径</td>
                            <td colspan="3">${server.jvm.home}</td>
                        </tr>
                        <tr>
                            <td colspan="1" class="layui-table-header">项目路径</td>
                            <td colspan="3">${server.sys.userDir}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
 
        <div class="layui-col-lg12">
            <div class="layui-card">
                <div class="layui-card-header">服务器信息</div>
                <div class="layui-card-body">
                    <table class="layui-table layui-text">
                        <tbody>
                        <tr>
                            <td class="layui-table-header">服务器名称</td>
                            <td>${server.sys.computerName}</td>
                            <td class="layui-table-header">操作系统</td>
                            <td>${server.sys.osName}</td>
                        </tr>
                        <tr>
                            <td class="layui-table-header">服务器IP</td>
                            <td>${server.sys.computerIp}</td>
                            <td class="layui-table-header">系统架构</td>
                            <td>${server.sys.osArch}</td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
 
        <div class="layui-col-lg12">
            <div class="layui-card">
                <div class="layui-card-header">磁盘信息</div>
                <div class="layui-card-body">
                    <table class="layui-table layui-text">
                        <thead>
                        <tr>
                            <th>盘符路径</th>
                            <th>文件系统</th>
                            <th>盘符类型</th>
                            <th>总大小</th>
                            <th>可用大小</th>
                            <th>已用大小</th>
                            <th>已用百分比</th>
                        </tr>
                        </thead>
                        <tbody>
                        @for(sysFile in server.sysFiles){
                        <tr>
                            <td>${sysFile.dirName!}</td>
                            <td>${sysFile.sysTypeName!}</td>
                            <td>${sysFile.typeName!}</td>
                            <td>${sysFile.total!'0'}GB</td>
                            <td>${sysFile.free!'0'}GB</td>
                            <td>${sysFile.used!'0'}GB</td>
                            <td>${sysFile.usage}%</td>
                        </tr>
                        @}
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
 
    </div>
</div>
 
<!-- js部分 -->
@/* 加入contextPath属性和session超时的配置 */
<script type="text/javascript">
    var Feng = {
        ctxPath: "${ctxPath}",
        version: '${constants.getReleaseVersion()}'
    };
</script>
 
<script type="text/javascript" src="${ctxPath}/assets/common/libs/layui/layui.js?v=${constants.getReleaseVersion()}"></script>
<script type="text/javascript" src="${ctxPath}/assets/common/js/common.js?v=${constants.getReleaseVersion()}"></script>
 
<script>
    layui.use(['layer'], function () {
        var $ = layui.jquery;
        var layer = layui.layer;
 
        var cpuUsage = ${server.cpu.sys!'0'};
        var memUsage = ${server.mem.usage!'0'};
        var jvmUsage = ${server.jvm.usage!'0'};
 
        var msg = "";
 
        if (cpuUsage >= 80) {
            $("#sysUsage").addClass("text-danger");
            msg += "提示:CPU使用率过高!</br>";
        }
 
        if (memUsage >= 80) {
            $("#memUsage").addClass("text-danger");
            msg += "提示:内存使用率过高!</br>";
        }
 
        if (jvmUsage >= 80) {
            $("#jvmUsage").addClass("text-danger");
            msg += "提示:jvm使用率过高!";
        }
 
        if (msg !== "") {
            layer.msg(msg)
        }
 
    });
</script>
</body>
 
</html>