From d3c3e55c88904fc6c3dc3e92d78c9a12387073b3 Mon Sep 17 00:00:00 2001 From: naiba Date: Mon, 19 Apr 2021 23:11:00 +0800 Subject: [PATCH] =?UTF-8?q?v0.6.1=20=E4=BC=98=E5=8C=96CSS=E3=80=81?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E6=8A=A5=E8=AD=A6=E3=80=81=E6=9C=8D=E5=8A=A1?= =?UTF-8?q?=E7=8A=B6=E6=80=81=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 | 4 +- cmd/dashboard/main.go | 2 +- cmd/playground/main.go | 14 ++-- resource/static/main.css | 2 +- resource/template/common/header.html | 2 +- resource/template/common/menu.html | 2 +- service/dao/dao.go | 2 +- service/dao/servicesentinel.go | 103 +++++++++++++++++-------- 9 files changed, 87 insertions(+), 46 deletions(-) diff --git a/README.md b/README.md index 06651cf..5c9bc75 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@


-    +   

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

diff --git a/cmd/dashboard/controller/controller.go b/cmd/dashboard/controller/controller.go index 484dc07..282d6f8 100644 --- a/cmd/dashboard/controller/controller.go +++ b/cmd/dashboard/controller/controller.go @@ -54,7 +54,7 @@ func ServeWeb(port uint) { } if a == 0 { // 这是从未在线的情况 - return 1 / float32(b) * 100 + return 0.00001 / float32(b) * 100 } return float32(a) / float32(b) * 100 }, @@ -67,7 +67,7 @@ func ServeWeb(port uint) { } if a == 0 { // 这是从未在线的情况 - return 1 / float32(b) * 100 + return 0.00001 / float32(b) * 100 } return float32(a) / float32(b) * 100 }, diff --git a/cmd/dashboard/main.go b/cmd/dashboard/main.go index df70e3b..a2c4fa8 100644 --- a/cmd/dashboard/main.go +++ b/cmd/dashboard/main.go @@ -110,6 +110,6 @@ func loadCrons() { func main() { go controller.ServeWeb(dao.Conf.HTTPPort) go rpc.ServeRPC(dao.Conf.GRPCPort) - go rpc.DispatchTask(time.Minute * 3) + go rpc.DispatchTask(time.Second * 30) dao.AlertSentinelStart() } diff --git a/cmd/playground/main.go b/cmd/playground/main.go index cecfcdb..81c80d4 100644 --- a/cmd/playground/main.go +++ b/cmd/playground/main.go @@ -10,6 +10,7 @@ import ( "os/exec" "time" + "github.com/genkiroid/cert" "github.com/go-ping/ping" "github.com/naiba/nezha/pkg/utils" "github.com/shirou/gopsutil/v3/cpu" @@ -20,8 +21,8 @@ import ( func main() { // icmp() // tcpping() - // httpWithSSLInfo() - sysinfo() + httpWithSSLInfo() + // sysinfo() // cmdExec() } @@ -72,11 +73,12 @@ func httpWithSSLInfo() { httpClient := &http.Client{Transport: transCfg, CheckRedirect: func(req *http.Request, via []*http.Request) error { return http.ErrUseLastResponse }} - resp, err := httpClient.Get("http://mail.nai.ba") - fmt.Println(err, resp.StatusCode) + url := "https://ops.naibahq.com" + resp, err := httpClient.Get(url) + fmt.Println(err, resp) // SSL 证书信息获取 - // c := cert.NewCert("expired-ecc-dv.ssl.com") - // fmt.Println(c.Error) + c := cert.NewCert(url[8:]) + fmt.Println(c.Error) } func icmp() { diff --git a/resource/static/main.css b/resource/static/main.css index 2c0aff9..7513463 100644 --- a/resource/static/main.css +++ b/resource/static/main.css @@ -6,7 +6,7 @@ .nb-container { padding-top: 75px; - min-height: 100%; + min-height: 100vh; padding-bottom: 55px; margin-bottom: -47px; } diff --git a/resource/template/common/header.html b/resource/template/common/header.html index 2f4d903..3e9e04c 100644 --- a/resource/template/common/header.html +++ b/resource/template/common/header.html @@ -9,7 +9,7 @@ {{.Title}} - + diff --git a/resource/template/common/menu.html b/resource/template/common/menu.html index e315049..fa373a1 100644 --- a/resource/template/common/menu.html +++ b/resource/template/common/menu.html @@ -14,7 +14,7 @@ {{else}} 首页 - 服务状态 + 服务 {{end}}