付延余
2022-12-16 f0f8ee8c4a945adbc742d9bab69382b28ad311fb
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
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
<!DOCTYPE html>
<html>
<head>
  <div  th:replace="common/header.html"></div>
 
 
</head>
<body th:class="${application.sidebarCollapse}">
<div th:replace="common/chart.html"></div>
 
<div class="wrapper">
 
  <div th:replace="common/navbar.html"></div>
 
  <div th:replace="common/aside.html"></div>
 
  <!-- Content Wrapper. Contains page content -->
  <div class="content-wrapper"  style="font-size:0.90rem">
    <!-- Content Header (Page header) -->
    <section class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
            <h1></h1>
          </div>
          <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item active"></li>
            </ol>
          </div>
        </div>
      </div><!-- /.container-fluid -->
    </section>
 
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <div class="row">
 
  <div class="col-md-12">
    <div class="card card-primary">
      <div class="card-header">
          <h3 class="card-title" ><span th:text="${systemInfo.hostname}"></span>
              <th:block th:if="${systemInfo.remark ne '' && systemInfo.remark ne null}">
                  (备注:<span th:text="${systemInfo.remark}"></span>)
              </th:block>
              </h3>
          <div class=" float-sm-right">
              <a href="javascript:history.back()">返回</a>
          </div>
      </div>
 
 
        <div class="row">
            <div class="col-12 table-responsive">
                <table class="table table-striped"><tbody><tr>
 
                    <th:block th:each="item : ${amList}">
                        <th:block th:if="${item.code eq  am}">
                            <td width="2%" style="vertical-align:bottom;"> <button type="button" title="当前已显示该时间段图表" class="btn btn-block btn-outline-danger btn-sm disabled" th:text="${item.msg}">Primary</button></td>
                        </th:block>
                        <th:block th:unless="${item.code eq  am}">
                            <td width="2%" style="vertical-align:bottom;"> <button type="button"  th:onclick="viewDate([[${systemInfo.id}]],[[${item.code}]])" class="btn btn-block btn-outline-primary btn-sm" th:text="${item.msg}">Primary</button></td>
                        </th:block>
                    </th:block>
 
                    <td width="10%">
                        <form class="form-inline ml-3   float-sm-right" action="/wgcloud/systemInfo/chart">
                            <input type="hidden" name="id" th:value="${systemInfo.id}"/>
                            <div class="input-group input-group-sm">
                            <input type="text" autocomplete="off" value="" class="validate[maxSize[50]] form-control"  th:value="${startTime}" name="startTime" id="startTime" placeholder="开始时间" style="margin-right:5px;">
                            <label style="margin-right:5px;">至</label>
                            <input type="text" autocomplete="off" value="" class="validate[maxSize[50]] form-control"  th:value="${endTime}" name="endTime" id="endTime" placeholder="结束时间" style="margin-right:5px;">
                            <button type="submit" class="btn btn-primary btn-sm" style="margin-right:5px;">查询</button>
                            <button type="button" onclick="resetParam()" class="btn bg-danger btn-sm" style="margin-right:5px;">重置</button>
                            </div>
                        </form>
                    </td>
 
                    <td width="2%" style="vertical-align:bottom;text-align: right"><button type="button" th:onclick="excelExport([[${systemInfo.id}]],[[${am}]])" class="btn btn-primary btn-sm">导出Excel</button></td>
                    </tr></tbody></table>
            </div>
            <!-- /.col -->
        </div>
        <label style="margin-left: .9rem">cpu使用率%
            <span style="margin-left:20px">最高</span><span class="description-percentage text-danger" style="margin-left:10px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${cpuSubtitleDto.maxValue}">18</span></span>
            平均<span class="description-percentage text-warning" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-left"></i> <span th:text="${cpuSubtitleDto.avgValue}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:30px;"><i class="fas fa-caret-up"></i> <span th:text="${cpuSubtitleDto.minValue}">17</span></span></label>
        <div id="cpuStateJson"></div>
 
        <label style="margin-left: .9rem">内存使用率%
            <span style="margin-left:20px">最高</span><span class="description-percentage text-danger" style="margin-left:10px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${memSubtitleDto.maxValue}">18</span></span>
            平均<span class="description-percentage text-warning" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-left"></i> <span th:text="${memSubtitleDto.avgValue}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:30px;"><i class="fas fa-caret-up"></i> <span th:text="${memSubtitleDto.minValue}">17</span></span></label>
        <div id="memStateJson"></div>
 
        <label style="margin-left: .9rem">网络接收/发送流量(即下行/上行传输速率),KB/秒
            <span style="margin-left:20px">下行最高</span><span class="description-percentage text-danger" style="margin-left:10px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${rxbytSubtitleDto.maxValue}">18</span></span>
            平均<span class="description-percentage text-warning" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-left"></i> <span th:text="${rxbytSubtitleDto.avgValue}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:30px;"><i class="fas fa-caret-up"></i> <span th:text="${rxbytSubtitleDto.minValue}">17</span></span>
            上行最高<span class="description-percentage text-danger" style="margin-left:10px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${txbytSubtitleDto.maxValue}">18</span></span>
            平均<span class="description-percentage text-warning" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-left"></i> <span th:text="${txbytSubtitleDto.avgValue}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:30px;"><i class="fas fa-caret-up"></i> <span th:text="${txbytSubtitleDto.minValue}">17</span></span></label>
        <div id="netIoStateByt"></div>
 
        <label style="margin-left: .9rem">网络接收/发送,包数/秒
            <span style="margin-left:20px">接收最高</span><span class="description-percentage text-danger" style="margin-left:10px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${rxpckSubtitleDto.maxValue}">18</span></span>
            平均<span class="description-percentage text-warning" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-left"></i> <span th:text="${rxpckSubtitleDto.avgValue}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:30px;"><i class="fas fa-caret-up"></i> <span th:text="${rxpckSubtitleDto.minValue}">17</span></span>
            发送最高<span class="description-percentage text-danger" style="margin-left:10px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${txpckSubtitleDto.maxValue}">18</span></span>
            平均<span class="description-percentage text-warning" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-left"></i> <span th:text="${txpckSubtitleDto.avgValue}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:30px;"><i class="fas fa-caret-up"></i> <span th:text="${txpckSubtitleDto.minValue}">17</span></span></label>
        <div id="netIoStatePck"></div>
 
        <label style="margin-left: .9rem">网络传入/传出,丢弃包数/秒</label>
        <div id="netIoStateDropPck"></div>
 
        <label style="margin-left: .9rem">系统负载
            <span style="margin-left:20px">1分钟最高</span><span class="description-percentage text-danger" style="margin-left:10px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${oneLoadSubtitleDto.maxValue}">18</span></span>
            平均<span class="description-percentage text-warning" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-left"></i> <span th:text="${oneLoadSubtitleDto.avgValue}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:30px;"><i class="fas fa-caret-up"></i> <span th:text="${oneLoadSubtitleDto.minValue}">17</span></span>
            5分钟最高<span class="description-percentage text-danger" style="margin-left:10px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${fiveLoadSubtitleDto.maxValue}">18</span></span>
            平均<span class="description-percentage text-warning" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-left"></i> <span th:text="${fiveLoadSubtitleDto.avgValue}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:30px;"><i class="fas fa-caret-up"></i> <span th:text="${fiveLoadSubtitleDto.minValue}">17</span></span>
            15分钟最高<span class="description-percentage text-danger" style="margin-left:10px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${fifteenLoadSubtitleDto.maxValue}">18</span></span>
            平均<span class="description-percentage text-warning" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-left"></i> <span th:text="${fifteenLoadSubtitleDto.avgValue}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:30px;"><i class="fas fa-caret-up"></i> <span th:text="${fifteenLoadSubtitleDto.minValue}">17</span></span></label>
        <div id="sysLoadStateJson"></div>
 
        <label style="margin-left: .9rem">主机连接数(包括tcp、udp、inet)
            <span style="margin-left:20px">最高</span><span class="description-percentage text-danger" style="margin-left:10px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${connsSubtitleDto.maxValue}">18</span></span>
            平均<span class="description-percentage text-warning" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-left"></i> <span th:text="${connsSubtitleDto.avgValue}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:30px;"><i class="fas fa-caret-up"></i> <span th:text="${connsSubtitleDto.minValue}">17</span></span></label>
        <div id="netConnectionsJson"></div>
 
    </div>
    <!-- /.card -->
 
 
  </div>
 
        </div>
      </div>
    </section>
  </div>
 
 
  <div th:replace="common/footer.html"></div>
 
</div>
<!-- ./wrapper -->
 
<script th:src="@{'/static/js/host.js?v=3.4.0'}"></script>
 
 
<script th:inline="javascript">
 
    var startTimeResponse =[[${startTime}]];
    var endTimeResponse =[[${endTime}]];
    $(document).ready(function(){
        var startTime = $('#startTime');
        if(startTime!=null && startTime != undefined){
            startTime.daterangepicker({
                singleDatePicker: true,
                timePicker: true,
                timePicker24Hour : true,
                "opens": "center",
                "locale": {
                    format: 'YYYY-MM-DD HH:mm',
                    applyLabel: "应用",
                    cancelLabel: "取消",
                    daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                    monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                }
            });
            if(startTimeResponse=='' || startTimeResponse==null){
                startTime.val("");
            }
        }
 
        var endTime = $('#endTime');
        if(endTime!=null && endTime != undefined){
            endTime.daterangepicker({
                singleDatePicker: true,
                timePicker: true,
                timePicker24Hour : true,
                "opens": "center",
                "locale": {
                    format: 'YYYY-MM-DD HH:mm',
                    applyLabel: "应用",
                    cancelLabel: "取消",
                    daysOfWeek: ['日', '一', '二', '三', '四', '五', '六'],
                    monthNames: ['一月', '二月', '三月', '四月', '五月', '六月', '七月', '八月', '九月', '十月', '十一月', '十二月'],
                }
            });
            if(endTimeResponse=='' || endTimeResponse==null){
                endTime.val("");
            }
        }
 
    });
 
    function resetParam(){
        $("#startTime").val("");
        $("#endTime").val("");
    }
 
 
    var cpuStateJson =[[${cpuStateList}]];
    var memStateJson =[[${memStateList}]];
    var sysLoadStateJson =[[${sysLoadStateList}]];
    var netIoStateJson =[[${netIoStateList}]];
    $(function(){
        var chart = new G2.Chart({
            container: 'cpuStateJson',
            forceFit: true,
            height: 400,
            padding: [30, 40, 70, 40]
        });
 
        chart.axis('dateStr', {
            label: {
                textStyle: {
                    fill: '#aaaaaa'
                }
            }
        });
        chart.tooltip({
            crosshairs: false
        });
        chart.legend({
            position: 'top-center'
        });
 
        chart.source(cpuStateJson, {
            sys: {
                alias: 'cpu使用率'
            }
        });
        chart.scale('dateStr',{tickCount: 12,alias: '时间'});
        chart.line().position('dateStr*sys').color('#1890ff');
        chart.render();
 
        var chart2 = new G2.Chart({
            container: 'memStateJson',
            forceFit: true,
            height: 400,
            padding: [30, 40, 70, 40]
        });
        chart2.axis('dateStr', {
            label: {
                textStyle: {
                    fill: '#aaaaaa'
                }
            }
        });
        chart2.axis('usePer', {
            label: {
                textStyle: {
                    fill: '#aaaaaa'
                }
            }
        });
        chart2.tooltip({
            crosshairs: false
        });
        chart2.legend({
            position: 'top-center'
        });
        chart2.source(memStateJson, {
            usePer: {
                alias: '内存使用率'
            }
        });
        chart2.scale('dateStr',{tickCount: 12,alias: '时间'});
        chart2.line().position('dateStr*usePer').color('#1890ff');
        chart2.render();
 
        var chart3 = new G2.Chart({
            container: 'sysLoadStateJson',
            forceFit: true,
            height: 400,
            padding: [30, 40, 70, 40]
        });
        chart3.axis('dateStr', {
            label: {
                textStyle: {
                    fill: '#aaaaaa'
                }
            }
        });
        chart3.axis('fiveLoad', false);
        chart3.axis('fifteenLoad', false);
        chart3.tooltip({
            crosshairs: false
        });
        chart3.legend({
            position: 'top-center'
        });
        chart3.source(sysLoadStateJson, {
            oneLoad: {
                alias: '1分钟负载',
                min: 0,
                max: [[${sysLoadStateMaxVal}]]
            },
            fiveLoad: {
                alias: '5分钟负载',
                min: 0,
                max: [[${sysLoadStateMaxVal}]]
            },
            fifteenLoad: {
                alias: '15分钟负载',
                min: 0,
                max: [[${sysLoadStateMaxVal}]]
            }
        });
        chart3.scale('dateStr',{tickCount: 12,alias: '时间'});
        chart3.line().position('dateStr*oneLoad').color('#1890ff');
        chart3.line().position('dateStr*fiveLoad').color('#2fc25b');
        chart3.line().position('dateStr*fifteenLoad').color('#ffca0b');
        chart3.render();
 
        var chart4 = new G2.Chart({
            container: 'netIoStateByt',
            forceFit: true,
            height: 400,
            padding: [30, 40, 70, 48]
        });
        chart4.axis('dateStr', {
            label: {
                textStyle: {
                    fill: '#aaaaaa'
                }
            }
        });
        chart4.axis('txbyt', false);
        chart4.tooltip({
            crosshairs: false
        });
        chart4.legend({
            position: 'top-center'
        });
        chart4.source(netIoStateJson, {
            rxbyt: {
                alias: '接收KB/秒',
                min: 0,
                max: [[${netIoStateBytMaxVal}]]
            },
            txbyt: {
                alias: '发送KB/秒',
                    min: 0,
                    max: [[${netIoStateBytMaxVal}]]
            }
        });
        chart4.scale('dateStr',{tickCount: 12,alias: '时间'});
        chart4.line().position('dateStr*rxbyt').color('#1890ff');
        chart4.line().position('dateStr*txbyt').color('#2fc25b');
        chart4.render();
 
 
        var chart5 = new G2.Chart({
            container: 'netIoStatePck',
            forceFit: true,
            height: 400,
            padding: [30, 40, 70, 48]
        });
        chart5.axis('dateStr', {
            label: {
                textStyle: {
                    fill: '#aaaaaa'
                }
            }
        });
        chart5.axis('txpck', false);
        chart5.tooltip({
            crosshairs: false
        });
        chart5.legend({
            position: 'top-center'
        });
        chart5.source(netIoStateJson, {
            rxpck: {
                alias: '接收包数/秒',
                min: 0,
                max: [[${netIoStatePckMaxVal}]]
            },
            txpck: {
                alias: '发送包数/秒',
                    min: 0,
                    max: [[${netIoStatePckMaxVal}]]
            }
        });
        chart5.scale('dateStr',{tickCount: 12,alias: '时间'});
        chart5.line().position('dateStr*rxpck').color('#1890ff');
        chart5.line().position('dateStr*txpck').color('#2fc25b');
        chart5.render();
 
 
        var chart6 = new G2.Chart({
            container: 'netIoStateDropPck',
            forceFit: true,
            height: 400,
            padding: [30, 40, 70, 48]
        });
        chart6.axis('dateStr', {
            label: {
                textStyle: {
                    fill: '#aaaaaa'
                }
            }
        });
        chart6.axis('dropin', false);
        chart6.tooltip({
            crosshairs: false
        });
        chart6.legend({
            position: 'top-center'
        });
        chart6.source(netIoStateJson, {
            dropin: {
                alias: '传入丢弃包数/秒',
                min: 0,
                max: [[${netIoStateDropPckMaxVal}]]
            },
            dropout: {
                alias: '传出丢弃包数/秒',
                min: 0,
                max: [[${netIoStateDropPckMaxVal}]]
            }
        });
        chart6.scale('dateStr',{tickCount: 12,alias: '时间'});
        chart6.line().position('dateStr*dropin').color('#FFD22F');
        chart6.line().position('dateStr*dropout').color('#FF5371');
        chart6.render();
 
        var chart7 = new G2.Chart({
            container: 'netConnectionsJson',
            forceFit: true,
            height: 400,
            padding: [30, 40, 70, 40]
        });
        chart7.axis('dateStr', {
            label: {
                textStyle: {
                    fill: '#aaaaaa'
                }
            }
        });
        chart7.axis('netConnections', {
            label: {
                textStyle: {
                    fill: '#aaaaaa'
                }
            }
        });
        chart7.tooltip({
            crosshairs: false
        });
        chart7.legend({
            position: 'top-center'
        });
        chart7.source(netIoStateJson, {
            netConnections: {
                alias: '连接数'
            }
        });
        chart7.scale('dateStr',{tickCount: 12,alias: '时间'});
        chart7.line().position('dateStr*netConnections');
        chart7.render();
    })
 
    var msg = [[${msg}]];
    if(msg!='' && msg!=null){
        toastr.info(msg);
    }
</script>
 
 
</body>
</html>