From 6b3723461b537ec87d43af3d63414b4ca7a6404d Mon Sep 17 00:00:00 2001 From: naiba Date: Thu, 11 Nov 2021 09:40:10 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20=E4=BC=98=E5=8C=96=E5=BE=AA?= =?UTF-8?q?=E7=8E=AF=E6=B5=81=E9=87=8F=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- cmd/dashboard/controller/controller.go | 3 +++ model/alertrule.go | 2 ++ resource/static/main.css | 2 +- resource/template/common/header.html | 2 +- resource/template/theme-default/service.html | 10 +++++++--- service/dao/alertsentinel.go | 2 ++ service/dao/dao.go | 2 +- 8 files changed, 18 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 09c17bd..567a272 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@
LOGO designed by 熊大 .

-    +   

:trollface: 哪吒监控 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,计划任务和在线终端。

diff --git a/cmd/dashboard/controller/controller.go b/cmd/dashboard/controller/controller.go index 4bc7def..7f0cafb 100644 --- a/cmd/dashboard/controller/controller.go +++ b/cmd/dashboard/controller/controller.go @@ -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) }, diff --git a/model/alertrule.go b/model/alertrule.go index a5aee7f..8d9140d 100644 --- a/model/alertrule.go +++ b/model/alertrule.go @@ -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 diff --git a/resource/static/main.css b/resource/static/main.css index 5cc6096..0153942 100644 --- a/resource/static/main.css +++ b/resource/static/main.css @@ -7,7 +7,7 @@ .nb-container { padding-top: 75px; min-height: 100vh; - padding-bottom: 55px; + padding-bottom: 65px; margin-bottom: -47px; } diff --git a/resource/template/common/header.html b/resource/template/common/header.html index c32f1ba..1756499 100644 --- a/resource/template/common/header.html +++ b/resource/template/common/header.html @@ -9,7 +9,7 @@ {{.Title}} - + diff --git a/resource/template/theme-default/service.html b/resource/template/theme-default/service.html index a936771..df20c35 100644 --- a/resource/template/theme-default/service.html +++ b/resource/template/theme-default/service.html @@ -49,8 +49,10 @@ 服务器 自 至 - 下次刷新 - 流量 + MAX + MIN + 下次检查 + 当前用量 @@ -62,7 +64,9 @@ {{index $stats.ServerName $innerId}} {{$stats.From|tf}} {{$stats.To|tf}} - {{(index $stats.NextUpdate $innerId)|tf}} + {{$stats.Max|bf}} + {{$stats.Min|bf}} + {{(index $stats.NextUpdate $innerId)|sft}} {{$transfer|bf}} {{end}} diff --git a/service/dao/alertsentinel.go b/service/dao/alertsentinel.go index 127851a..bdd1767 100644 --- a/service/dao/alertsentinel.go +++ b/service/dao/alertsentinel.go @@ -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), diff --git a/service/dao/dao.go b/service/dao/dao.go index bf43db9..37a7b01 100644 --- a/service/dao/dao.go +++ b/service/dao/dao.go @@ -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