💄 优化循环流量展示

This commit is contained in:
naiba 2021-11-11 09:40:10 +08:00
parent 57e556eea1
commit 6b3723461b
8 changed files with 18 additions and 7 deletions

View File

@ -4,7 +4,7 @@
<br>
<small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
<br><br>
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.11.6&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.7.1-brightgreen?style=for-the-badge&logo=linux">
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.11.7&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github">&nbsp;<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge">&nbsp;<img src="https://img.shields.io/badge/Installer-v0.7.1-brightgreen?style=for-the-badge&logo=linux">
<br>
<br>
<p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,计划任务和在线终端。</p>

View File

@ -44,6 +44,9 @@ func ServeWeb(port uint) *http.Server {
"sf": func(duration uint64) string {
return time.Duration(time.Duration(duration) * time.Second).String()
},
"sft": func(future time.Time) string {
return time.Until(future).String()
},
"bf": func(b uint64) string {
return bytefmt.ByteSize(b)
},

View File

@ -11,6 +11,8 @@ type CycleTransferStats struct {
Name string
From time.Time
To time.Time
Max uint64
Min uint64
ServerName map[uint64]string
Transfer map[uint64]uint64
NextUpdate map[uint64]time.Time

View File

@ -7,7 +7,7 @@
.nb-container {
padding-top: 75px;
min-height: 100vh;
padding-bottom: 55px;
padding-bottom: 65px;
margin-bottom: -47px;
}

View File

@ -9,7 +9,7 @@
<title>{{.Title}}</title>
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.1/dist/semantic.min.css">
<link rel="stylesheet" type="text/css" href="/static/semantic-ui-alerts.min.css">
<link rel="stylesheet" type="text/css" href="/static/main.css?v2021080602">
<link rel="stylesheet" type="text/css" href="/static/main.css?v2021111109">
<link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
</head>

View File

@ -49,8 +49,10 @@
<th class="ui center aligned">服务器</th>
<th class="ui center aligned"></th>
<th class="ui center aligned"></th>
<th class="ui center aligned">下次刷新</th>
<th class="ui center aligned">流量</th>
<th class="ui center aligned">MAX</th>
<th class="ui center aligned">MIN</th>
<th class="ui center aligned">下次检查</th>
<th class="ui center aligned">当前用量</th>
</tr>
</thead>
<tbody>
@ -62,7 +64,9 @@
<td class="ui center aligned">{{index $stats.ServerName $innerId}}</td>
<td class="ui center aligned">{{$stats.From|tf}}</td>
<td class="ui center aligned">{{$stats.To|tf}}</td>
<td class="ui center aligned">{{(index $stats.NextUpdate $innerId)|tf}}</td>
<td class="ui center aligned">{{$stats.Max|bf}}</td>
<td class="ui center aligned">{{$stats.Min|bf}}</td>
<td class="ui center aligned">{{(index $stats.NextUpdate $innerId)|sft}}</td>
<td class="ui center aligned">{{$transfer|bf}}</td>
</tr>
{{end}}

View File

@ -42,6 +42,8 @@ func addCycleTransferStatsInfo(alert *model.AlertRule) {
Name: alert.Name,
From: from,
To: from.Add(time.Hour * time.Duration(alert.Rules[j].CycleInterval)),
Max: uint64(alert.Rules[j].Max),
Min: uint64(alert.Rules[j].Min),
ServerName: make(map[uint64]string),
Transfer: make(map[uint64]uint64),
NextUpdate: make(map[uint64]time.Time),

View File

@ -13,7 +13,7 @@ import (
pb "github.com/naiba/nezha/proto"
)
var Version = "v0.11.6" // !!记得修改 README 中的 badge 版本!!
var Version = "v0.11.7" // !!记得修改 README 中的 badge 版本!!
var (
Conf *model.Config