From b69b069f27cd6518f6a5316ec7ccddf64644f795 Mon Sep 17 00:00:00 2001 From: naiba Date: Thu, 22 Apr 2021 22:18:55 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E7=BC=96=E8=BE=91=E5=B7=B2=E5=88=9B=E5=BB=BA=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E7=9B=91=E6=8E=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- resource/static/main.js | 6 +++--- resource/template/common/footer.html | 2 +- resource/template/dashboard/monitor.html | 16 +++++++--------- service/dao/dao.go | 2 +- service/dao/servicesentinel.go | 2 ++ 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 4a6bb4d..307cd0a 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@


-    +   

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

diff --git a/resource/static/main.js b/resource/static/main.js index f36bb93..82ad95b 100644 --- a/resource/static/main.js +++ b/resource/static/main.js @@ -201,8 +201,8 @@ function addOrEditMonitor(monitor) { } var servers; if (monitor) { - servers = monitor.SkipServersRaw || "[]"; - const serverList = JSON.parse(servers); + servers = monitor.SkipServersRaw; + const serverList = JSON.parse(servers || "[]"); const node = modal.find("i.dropdown.icon"); for (let i = 0; i < serverList.length; i++) { node.after( @@ -237,7 +237,7 @@ function addOrEditCron(cron) { var servers; if (cron) { servers = cron.ServersRaw; - const serverList = JSON.parse(servers); + const serverList = JSON.parse(servers || "[]"); const node = modal.find("i.dropdown.icon"); for (let i = 0; i < serverList.length; i++) { node.after( diff --git a/resource/template/common/footer.html b/resource/template/common/footer.html index afbd9b0..52824af 100644 --- a/resource/template/common/footer.html +++ b/resource/template/common/footer.html @@ -9,7 +9,7 @@ - + diff --git a/resource/template/dashboard/monitor.html b/resource/template/dashboard/monitor.html index 723bfb2..c726c4b 100644 --- a/resource/template/dashboard/monitor.html +++ b/resource/template/dashboard/monitor.html @@ -1,6 +1,5 @@ -{{define "dashboard/monitor"}} -{{template "common/header" .}} -{{template "common/menu" .}} +{{define "dashboard/monitor"}} {{template "common/header" .}} {{template +"common/menu" .}}
@@ -18,10 +17,10 @@ ID 名称 - 通知 目标 - 类型 跳过的服务器 + 类型 + 通知 管理 @@ -30,13 +29,13 @@ {{$monitor.ID}} {{$monitor.Name}} - {{$monitor.Notify}} {{$monitor.Target}} + {{$monitor.SkipServersRaw}} {{if eq $monitor.Type 1}}HTTP(S)/SSL证书 {{else if eq $monitor.Type 2}} ICMP Ping {{else}} TCP 端口 {{end}} - {{$monitor.SkipServersRaw}} + {{$monitor.Notify}}
-{{template "component/monitor"}} -{{template "common/footer" .}} +{{template "component/monitor"}} {{template "common/footer" .}} diff --git a/service/dao/dao.go b/service/dao/dao.go index 03af4cf..f1301d8 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.6.3" // !!记得修改 README 中的 badge 版本!! +var Version = "v0.6.4" // !!记得修改 README 中的 badge 版本!! const ( SnapshotDelay = 3 diff --git a/service/dao/servicesentinel.go b/service/dao/servicesentinel.go index 77390bf..65f2ff3 100644 --- a/service/dao/servicesentinel.go +++ b/service/dao/servicesentinel.go @@ -180,8 +180,10 @@ func (ss *ServiceSentinel) LoadStats() map[uint64]*model.ServiceItemResponse { for i := 0; i < len(v); i++ { if v[i].Successful { msm[k].Up[29]++ + msm[k].TotalUp++ } else { msm[k].Down[29]++ + msm[k].TotalDown++ } msm[k].Delay[29] = (msm[k].Delay[29]*float32(msm[k].Up[29]) + v[i].Delay) / float32(msm[k].Up[29]+1) }