v0.6.1 优化CSS、服务报警、服务状态展示

This commit is contained in:
naiba
2021-04-19 23:11:00 +08:00
parent 114f47cb0f
commit d3c3e55c88
9 changed files with 87 additions and 46 deletions

View File

@@ -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
},

View File

@@ -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()
}

View File

@@ -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() {