kongdeqiang
2023-02-14 18d6ac5798b9ef96077f592ccc3f94b365006e6a
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
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
<!DOCTYPE html>
<html>
<head>
  <div  th:replace="common/header.html"></div>
 
 
</head>
<body th:class="${application.sidebarCollapse}">
 
<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">
    <!-- Content Header (Page header) -->
    <div class="content-header">
      <div class="container-fluid">
        <div class="row mb-2">
          <div class="col-sm-6">
          </div><!-- /.col -->
         <!-- <div class="col-sm-6">
            <ol class="breadcrumb float-sm-right">
              <li class="breadcrumb-item"><a href="#">Home</a></li>
              <li class="breadcrumb-item active">Dashboard v1</li>
            </ol>
          </div>--><!-- /.col -->
        </div><!-- /.row -->
      </div><!-- /.container-fluid -->
    </div>
    <!-- /.content-header -->
 
    <!-- Main content -->
    <section class="content">
      <div class="container-fluid">
        <!-- Small boxes (Stat box) -->
 
 
        <!-- Small boxes (Stat box) -->
        <div class="row">
          <div class="col-lg-3 col-6">
            <!-- small box -->
            <th:block th:if="${downAppSize > 0}">
              <div class="small-box bg-maroon"/>
            </th:block>
            <th:block th:if="${downAppSize <= 0}">
              <div class="small-box bg-info"/>
            </th:block>
              <div class="inner" title="已下线/总数量">
                <h3><font color="#DCDCDC"  th:text="${downAppSize}">0</font>/<span th:text="${totalSizeApp}">1</span></h3>
 
                <p>监控进程</p>
              </div>
              <div class="icon">
                <i class="ion " style="opacity:0.6; filter: alpha(opacity=60);"><img src="/tssw/static/images/jincheng.png"/></i>
              </div>
              <a th:href="@{'/appInfo/list'}" class="small-box-footer">更多 <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-6">
            <!-- small box -->
            <th:block th:if="${downDockerSize > 0}">
              <div class="small-box bg-maroon"/>
            </th:block>
            <th:block th:if="${downDockerSize <= 0}">
              <div class="small-box bg-olive"/>
            </th:block>
              <div class="inner" title="已下线/总数量">
                <h3><font color="#DCDCDC"  th:text="${downDockerSize}">0</font>/<span th:text="${dockerSize}">1</span></h3>
 
                <p>DOCKER</p>
              </div>
              <div class="icon">
                <i class="ion " style="opacity:0.6; filter: alpha(opacity=60);"><img src="/tssw/static/images/docker.png"/></i>
              </div>
              <a th:href="@{'/dockerInfo/list'}" class="small-box-footer">更多 <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-6">
            <!-- small box -->
            <th:block th:if="${dbInfoDownSize > 0}">
              <div class="small-box bg-maroon"/>
            </th:block>
            <th:block th:if="${dbInfoDownSize <= 0}">
              <div class="small-box bg-info"/>
            </th:block>
              <div class="inner" title="已下线/总数量">
                <h3><font color="#DCDCDC"  th:text="${dbInfoDownSize}">0</font>/<span th:text="${dbInfoSize}">1</span></h3>
                <p>数据源</p>
              </div>
                <div class="icon">
                    <i class="ion " style="opacity:0.6; filter: alpha(opacity=60);"><img src="/tssw/static/images/db.png"/></i>
                </div>
              <a th:href="@{'/dbInfo/list'}" class="small-box-footer">更多 <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-6">
            <!-- small box -->
            <th:block th:if="${dceDownSize > 0}">
              <div class="small-box bg-maroon"/>
            </th:block>
            <th:block th:if="${dceDownSize <= 0}">
              <div class="small-box bg-info"/>
            </th:block>
              <div class="inner" title="已下线/总数量">
                <h3><font color="#DCDCDC"  th:text="${dceDownSize}">0</font>/<span th:text="${dceSize}">1</span></h3>
 
                <p>数通PING设备</p>
              </div>
              <div class="icon">
                <i class="ion " style="opacity:0.6; filter: alpha(opacity=60);"><img src="/tssw/static/images/yun.png"/></i>
              </div>
              <a th:href="@{'/dceInfo/list'}" class="small-box-footer">更多 <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
        </div>
        <!-- /.row -->
 
        <!-- Small boxes (Stat box) -->
        <div class="row">
          <div class="col-lg-3 col-6">
            <!-- small box -->
              <div class="small-box bg-info">
              <div class="inner">
                <h3 th:text="${fileWarnSize}"></h3>
 
                <p>日志监控</p>
              </div>
              <div class="icon">
                <i class="ion " style="opacity:0.6; filter: alpha(opacity=60);"><img src="/tssw/static/images/log.png"/></i>
              </div>
              <a th:href="@{'/fileWarnInfo/list'}" class="small-box-footer">更多 <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-6">
            <!-- small box -->
            <th:block th:if="${heatherrSize > 0}">
              <div class="small-box bg-maroon"/>
            </th:block>
            <th:block th:if="${heatherrSize <= 0}">
              <div class="small-box bg-info"/>
            </th:block>
              <div class="inner" title="已下线/总数量">
                <h3><font color="#DCDCDC"  th:text="${heatherrSize}">0</font>/<span th:text="${heathSize}">1</span></h3>
 
                <p>服务接口</p>
              </div>
              <div class="icon">
                <i class="ion " style="opacity:0.6; filter: alpha(opacity=60);"><img src="/tssw/static/images/api.png"/></i>
              </div>
              <a th:href="@{'/heathMonitor/list'}" class="small-box-footer">更多 <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <!-- ./col -->
          <div class="col-lg-3 col-6">
            <!-- small box -->
            <th:block th:if="${hostDownSize > 0}">
              <div class="small-box bg-maroon"/>
            </th:block>
            <th:block th:if="${hostDownSize <= 0}">
              <div class="small-box bg-purple"/>
            </th:block>
              <div class="inner" title="已下线/总数量">
                <h3><font color="#DCDCDC"  th:text="${hostDownSize}">0</font>/<span th:text="${totalSystemInfoSize}">1</span></h3>
 
                <p>监控主机</p>
              </div>
              <div class="icon">
                <i class="ion " style="opacity:0.6; filter: alpha(opacity=60);"><img src="/tssw/static/images/pc.png"/></i>
              </div>
              <a th:href="@{'/systemInfo/systemInfoList'}" class="small-box-footer">更多 <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
          <!-- ./col -->
          <!-- ./col -->
          <div class="col-lg-3 col-6">
            <!-- small box -->
            <th:block th:if="${portDownSize > 0}">
              <div class="small-box bg-maroon"/>
            </th:block>
            <th:block th:if="${portDownSize <= 0}">
              <div class="small-box bg-success"/>
            </th:block>
              <div class="inner" title="已下线/总数量">
                <h3><font color="#DCDCDC"  th:text="${portDownSize}">0</font>/<span th:text="${portSize}">1</span></h3>
 
                <p>监控端口</p>
              </div>
              <div class="icon">
                <i class="ion " style="opacity:0.6; filter: alpha(opacity=60);"><img src="/tssw/static/images/telnet.png"/></i>
              </div>
              <a th:href="@{'/portInfo/list'}"class="small-box-footer">更多 <i class="fas fa-arrow-circle-right"></i></a>
            </div>
          </div>
        </div>
        <!-- /.row -->
 
      <div class="row  mb-2">
          <div class="col-sm-12" style="font-weight: 500">
              累积告警(次数):<span style="margin-right:10px;"><small class="badge badge-danger"><span th:text="${warnCount}">18</span></small></span>
              主机平均上报频率(秒):<span style="margin-right:10px;"><small class="badge badge-primary"><i class="far fa-clock"></i><span style="margin-left:5px;" th:text="${avgSubmitSeconds}">18</span></small></span>
              <!--历史数据保留(天):<span style="margin-right:10px;"><small class="badge badge-primary"><span th:text="${historyDataOut}">0</span></small></span>-->
              告警通知:<span style="margin-right:10px;"><small class="badge badge-primary"><span th:text="${warnType}">17</span></small></span>
              公众看板:<span style="margin-right:10px;"><small class="badge badge-primary"><span th:text="${dapingView}"></span></small></span>
              管理员密码:<span style="margin-right:10px;"><small class="badge badge-primary"><span th:text="${adminPwd}"></span></small></span>
              只读账号密码:<span style="margin-right:10px;"><small class="badge badge-primary"><span th:text="${guestAccountPwd}"></span></small></span>
              通信Token:<span style="margin-right:10px;"><small class="badge badge-primary"><span th:text="${wgToken}"></span></small></span>
              web ssh:<span style="margin-right:10px;"><small class="badge badge-primary"><span th:text="${webSSH}"></span></small></span></div>
      </div>
 
        <div class="row  mb-2">
          <div class="col-sm-12" style="font-weight: 500">当前所有主机最近5分钟状态,下行传输速率:
            最高<span class="description-percentage text-danger" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${maxRxbyt}">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="${avgRxbyt}">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="${minRxbyt}">17</span></span>
            上行传输速率:最高<span class="description-percentage text-danger" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${maxTxbyt}"></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="${avgTxbyt}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-up"></i> <span th:text="${minTxbyt}">17</span></span></div>
        </div>
 
        <div class="row  mb-2">
          <div class="col-sm-12" style="font-weight: 500">当前所有主机最近5分钟状态,5分钟系统负载:
            最高<span class="description-percentage text-danger" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${maxFiveLoad}">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="${avgFiveLoad}">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="${minFiveLoad}">17</span></span>
            15分钟系统负载:最高<span class="description-percentage text-danger" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-down"></i> <span th:text="${maxFifteenLoad}"></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="${avgFifteenLoad}">0</span></span>
            最低<span class="description-percentage text-success" style="margin-left:5px;margin-right:10px;"><i class="fas fa-caret-up"></i> <span th:text="${minFifteenLoad}">17</span></span></div>
        </div>
 
 
        <div class="row">
          <!-- Left col -->
          <section class="col-lg-5 connectedSortable" title="当前所有主机最近5分钟内存状态">
            <!-- Custom tabs (Charts with tabs)-->
            <div id="chartMemInfo"></div>
            <!-- /.card -->
          </section>
          <section class="col-lg-2 connectedSortable">
            <!-- Custom tabs (Charts with tabs)-->
            <div style="font-weight: 500"><p><p>内存总和:<span class="description-percentage text-danger"><span th:text="${memSum}">18</span>G</span><p>
              CPU核数总和:<span class="description-percentage text-danger"><span th:text="${cpuCoresSum}">18</span></span><p>
              磁盘容量总和:<span class="description-percentage text-danger">
               <th:block th:if="${session.LOGIN_KEY == null || session.LOGIN_KEY.role != 'user'}"><span th:text="${application.sumDiskSizeCache}">18</span></th:block>
               <th:block th:if="${session.LOGIN_KEY != null && session.LOGIN_KEY.role == 'user'}"><span th:text="${sumDiskSizeCache}">18</span></th:block></span></div>
            <!-- /.card -->
          </section>
          <section class="col-lg-5 connectedSortable" title="当前所有主机最近5分钟CPU状态">
            <!-- Custom tabs (Charts with tabs)-->
            <div  id="chartCpuInfo"></div>
            <!-- /.card -->
          </section>
        </div>
 
        <!-- Main row -->
        <div class="row">
          <!-- Left col -->
          <section class="col-lg-4 connectedSortable">
            <!-- Custom tabs (Charts with tabs)-->
            <div id="chartInfoList1"></div>
            <!-- /.card -->
          </section>
          <section class="col-lg-4 connectedSortable">
            <!-- Custom tabs (Charts with tabs)-->
            <div id="chartInfoHuantu"></div>
            <!-- /.card -->
          </section>
          <section class="col-lg-4 connectedSortable">
            <!-- Custom tabs (Charts with tabs)-->
            <div id="chartInfoList2"></div>
            <!-- /.card -->
          </section>
 
        </div>
 
        <!-- Main row -->
        <div class="row" th:if="${not #lists.isEmpty(dbTableList)}">
 
          <section class="col-lg-12 connectedSortable ui-sortable">
            <div id="dbTableList"> </div>
          </section>
        </div>
 
 
      </div><!-- /.container-fluid -->
    </section>
    <!-- /.content -->
  </div>
  <div th:replace="common/chart.html"></div>
  <div th:replace="common/footer.html"></div>
 
</div>
<!-- ./wrapper -->
 
 
<script th:inline="javascript">
 
  const data1 = [[${chartInfoList1}]];
  const data2 = [[${chartInfoList2}]];
  const data4 = [[${cpuInfoList}]];
  const data5 = [[${memInfoList}]];
 
  const chart4 = new G2.Chart({
    container: 'chartCpuInfo',
    height: 130,
    padding: 0
  });
  chart4.source(data4, {
    value: {
      min: 0,
      max: 100
    }
  });
  chart4.legend(false);
  chart4.axis(false);
  chart4.interval()
          .position('item*value')
          .color('item',['#FF5371','#FFD22F','#26CD7B'])
          // .shape('path', path => [ 'liquid-fill-path', path ])
          .shape('liquid-fill-gauge')
          .style({
            lineWidth: 10,
            opacity: 0.75
          });
  data4.forEach(row => {
    chart4.guide().text({
      top: true,
      position: {
        item: row.item,
        value: 50
      },
      content: `${row.value}%`,
      style: {
        opacity: 1,
        fontSize: 22,
        textAlign: 'center'
      }
    });
  });
  chart4.render();
 
  const chart5 = new G2.Chart({
    container: 'chartMemInfo',
    height: 130,
    padding: 0
  });
  chart5.source(data5, {
    value: {
      min: 0,
      max: 100
    }
  });
  chart5.legend(false);
  chart5.axis(false);
  chart5.interval()
          .position('item*value')
          .color('item',['#FF5371','#FFD22F','#26CD7B'])
          // .shape('path', path => [ 'liquid-fill-path', path ])
          .shape('liquid-fill-gauge')
          .style({
            lineWidth: 10,
            opacity: 0.75
          });
  data5.forEach(row => {
    chart5.guide().text({
      top: true,
      position: {
        item: row.item,
        value: 50
      },
      content: `${row.value}%`,
      style: {
        opacity: 1,
        fontSize: 22,
        textAlign: 'center'
      }
    });
  });
  chart5.render();
 
  const chart1 = new G2.Chart({
    container: 'chartInfoList1',
    forceFit: true,
    height: 400
  });
  chart1.source(data1, {
    percent: {
      formatter: val => {
      val = (val * 100) + '%';
  if(val.length > 10 ){
    val = val.substr(0,5)+'%';
  }
  return val;
  }
  }
  });
  chart1.tooltip({
    showTitle: false,
    itemTpl: '<li><span style="background-color:{color};" class="g2-tooltip-marker"></span>{name}的主机数量: {value}</li>'
  });
  chart1.coord('theta', {
    startAngle: Math.PI, // 起始角度
    endAngle: Math.PI * (3 / 2) // 结束角度
  });
  chart1.intervalStack()
          .position('percent')
          .color('item',['#FF5371','#FFD22F','#26A3FF','#26CD7B']);
  chart1.render();
 
  const chart3 = new G2.Chart({
      container: 'chartInfoList2',
      forceFit: true,
      height: 400
  });
  chart3.source(data2, {
      percent: {
          formatter: val => {
          val = (val * 100) + '%';
          if(val.length > 10 ){
              val = val.substr(0,5)+'%';
          }
          return val;
  }
  }
  });
  chart3.coord('theta');
  chart3.tooltip({
      showTitle: false,
  });
  chart3.intervalStack()
          .position('percent')
          .color('item',['#FF5371','#FFD22F','#26A3FF','#26CD7B'])
          .tooltip('item*percent', (item, percent) => {
            percent = (percent * 100) + '%';
            if(percent.length > 10 ){
              percent = percent.substr(0,5)+'%';
            }
          return {
            name: item+"的主机数量",
            value: percent
          };
          })
          .style({
            lineWidth: 1,
            stroke: '#fff'
          });
  chart3.render();
 
 
  const dataTable = [[${dbTableList}]];
  if(dataTable.length>0){
    const chart2 = new G2.Chart({
      container: 'dbTableList',
      forceFit: true,
      height: 400
    });
    chart2.source(dataTable);
    chart2.scale('value', {
      tickInterval: 20
    });
    chart2.axis('remark', {
      label: {
        textStyle: {
          fill: '#aaaaaa'
        }
      }
    });
    chart2.source(dataTable, {
      value: {
        min: 0,
        nice: false,
        alias: '数据监控'
      }
    });
    chart2.axis('value', {
      label: null,
      title: {
        offset: 30,
        textStyle: {
          fontSize: 12,
          fontWeight: 300
        }
      }
    });
    chart2.interval().position('remark*value').size(28);
    chart2.render();
  }
 
  const huantuChartInfos = [[${huantuChartInfos}]];
  const chart6 = new G2.Chart({
    container: 'chartInfoHuantu',
    forceFit: true,
    height: 400,
    animate: false
  });
  // chart6.legend(false);
  chart6.source(huantuChartInfos, {
    percent: {
      formatter: val => {
        val = (val * 100) + '%';
        return val;
      }
    }
  });
  chart6.coord('theta', {
    radius: 0.95,
    innerRadius: 0.6
  });
  chart6.tooltip({
    showTitle: false,
    itemTpl: '<li><span style="background-color:{color};" class="g2-tooltip-marker"></span>{name}: {value}</li>'
  });
  // 辅助文本
  chart6.guide().html({
    position: [ '50%', '50%' ],
    html: '<div style="color:#8c8c8c;font-size: 14px;text-align: center;width: 10em;">监控资源总数量<br><span style="color:#8c8c8c;font-size:20px">[[${huantuTotalSize}]]</span></div>',
    alignX: 'middle',
    alignY: 'middle'
  });
  const interval6 = chart6.intervalStack()
          .position('percent')
          .color('item')
          .tooltip('item*percent', (item, percent) => {
            percent = percent * 100 + '%';
            return {
              name: item,
              value: percent
            };
          })
          .style({
            lineWidth: 1,
            stroke: '#fff'
          });
  chart6.render();
  interval6.setSelected(huantuChartInfos[0]);
 
</script>
</body>
</html>