From 1c35caf0fb16481c5d8a4e73965114192200a2e0 Mon Sep 17 00:00:00 2001 From: naiba Date: Sun, 23 May 2021 10:25:40 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20=E4=BF=AE=E5=A4=8D=20IPv6=20only?= =?UTF-8?q?=20=E6=9C=BA=E5=99=A8=E5=8F=96=20IP=20=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 12 +- cmd/agent/monitor/myip.go | 7 +- resource/template/theme-default/home.html | 522 ++++++++++++---------- service/dao/dao.go | 2 +- service/dao/servicesentinel.go | 2 +- 5 files changed, 290 insertions(+), 255 deletions(-) diff --git a/README.md b/README.md index 897931f..c973042 100644 --- a/README.md +++ b/README.md @@ -1,14 +1,15 @@


-    +   

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

\>> 交流论坛:[打杂社区](https://daza.net/c/nezha) (Lemmy) -\>> QQ 交流群:872069346 **加群要求:已搭建好哪吒监控 & 有 2+ 服务器** +\>> QQ 交流群:872069346 **加群要求:已搭建好哪吒监控 & 有 2+ 服务器**
+群友互助/服务器交流,作者不答疑,找 naiba 请至论坛发帖 \>> [我们的用户](https://www.google.com/search?q="powered+by+哪吒监控%7C哪吒面板"&filter=0) (Google) @@ -22,17 +23,18 @@ ```shell curl -sSL https://raw.githubusercontent.com/naiba/nezha/master/script/fetch.sh | bash -/opt/nezha/nezha.sh +sudo /opt/nezha/nezha.sh ``` 国内镜像加速: ```shell curl -sSL https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/fetch.sh | CN=true bash -CN=true /opt/nezha/nezha.sh +CN=true sudo /opt/nezha/nezha.sh ``` 再次运行仅需: + ``` /opt/nezha/nezha.sh ``` @@ -284,4 +286,4 @@ restart() { - [哪吒探针 - Windows 客户端安装](https://nyko.me/2020/12/13/nezha-windows-client.html) - [哪吒监控,一个便携服务器状态监控面板搭建教程,不想拥有一个自己的探针吗?](https://haoduck.com/644.html) - [哪吒监控:小鸡们的最佳探针](https://www.zhujizixun.com/2843.html) _(已过时)_ -- [>>更多教程](https://www.google.com/search?q="哪吒"%2B"面板%7C监控%7C探针"+"教程") (Google) \ No newline at end of file +- [>>更多教程](https://www.google.com/search?q="哪吒"%2B"面板%7C监控%7C探针"+"教程") (Google) diff --git a/cmd/agent/monitor/myip.go b/cmd/agent/monitor/myip.go index 1db17d4..a875a68 100644 --- a/cmd/agent/monitor/myip.go +++ b/cmd/agent/monitor/myip.go @@ -108,8 +108,13 @@ func resolveIP(addr string, ipv6 bool) (string, error) { } m.RecursionDesired = true + dnsServer := "2606:4700:4700::1111" + if !ipv6 { + dnsServer = "1.1.1.1" + } + c := new(dns.Client) - r, _, err := c.Exchange(m, net.JoinHostPort("1.1.1.1", "53")) + r, _, err := c.Exchange(m, net.JoinHostPort(dnsServer, "53")) if err != nil { return "", err } diff --git a/resource/template/theme-default/home.html b/resource/template/theme-default/home.html index 16c3cc4..4f06a86 100644 --- a/resource/template/theme-default/home.html +++ b/resource/template/theme-default/home.html @@ -1,257 +1,285 @@ -{{define "theme-default/home"}} -{{template "common/header" .}} -{{if ts .CustomCode}} -{{.CustomCode|safe}} -{{end}} -{{template "common/menu" .}} +{{define "theme-default/home"}} {{template "common/header" .}} {{if ts +.CustomCode}} {{.CustomCode|safe}} {{end}} {{template "common/menu" .}}
-
-
- -
-
@#(group.Tag!==''?group.Tag:'默认')#@
-
-
-
-
-
@#server.Name - + - (server.live?'':' [已离线]')#@ - - -
-
-
-
-
CPU
-
-
-
- @#formatPercent(server.live,server.State.CPU,100).percent#@% -
-
-
-
内存
-
-
-
- @#parseInt(server.State?server.State.MemUsed/server.Host.MemTotal*100:0)#@% -
-
-
-
交换
-
-
-
- @#parseInt(server.State?server.State.SwapUsed/server.Host.SwapTotal*100:0)#@% -
-
-
-
网络
-
- - @#formatByteSize(server.State.NetInSpeed)#@/s - - @#formatByteSize(server.State.NetOutSpeed)#@/s -
-
硬盘
-
-
-
- @#parseInt(server.State?server.State.DiskUsed/server.Host.DiskTotal*100:0)#@% -
-
-
-
在线
-
- @#secondToDate(server.State.Uptime)#@ -
-
-
-
-
-

@#server.Name#@

-

节点已离线

-
-
-
-
-
+
+
+
+
+ @#(group.Tag!==''?group.Tag:'默认')#@
+
+
+
+
+
+ @#server.Name + (server.live?'':' [已离线]')#@ + + +
+
+
+
+
CPU
+
+
+
+ @#formatPercent(server.live,server.State.CPU,100).percent#@% +
+
+
+
内存
+
+
+
+ @#parseInt(server.State?server.State.MemUsed/server.Host.MemTotal*100:0)#@% +
+
+
+
交换
+
+
+
+ @#parseInt(server.State?server.State.SwapUsed/server.Host.SwapTotal*100:0)#@% +
+
+
+
网络
+
+ + @#formatByteSize(server.State.NetInSpeed)#@/s + + @#formatByteSize(server.State.NetOutSpeed)#@/s +
+
硬盘
+
+
+
+ @#parseInt(server.State?server.State.DiskUsed/server.Host.DiskTotal*100:0)#@% +
+
+
+
在线
+
+ @#secondToDate(server.State.Uptime)#@ +
+
+
+
+
+

@#server.Name#@

+

节点已离线

+
+
+
+
+
+
{{template "common/footer" .}} {{end}} diff --git a/service/dao/dao.go b/service/dao/dao.go index 7edd0fe..747a670 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.7.1" // !!记得修改 README 中的 badge 版本!! +var Version = "v0.7.2" // !!记得修改 README 中的 badge 版本!! const ( SnapshotDelay = 3 diff --git a/service/dao/servicesentinel.go b/service/dao/servicesentinel.go index 5872812..7a15532 100644 --- a/service/dao/servicesentinel.go +++ b/service/dao/servicesentinel.go @@ -275,7 +275,7 @@ func (ss *ServiceSentinel) worker() { } stateStr := getStateStr(upPercent) if Conf.Debug { - log.Println(ss.monitors[mh.MonitorID].Target, stateStr, "Agent:", r.Reporter, "Successful:", mh.Successful, "Response:", mh.Data) + log.Println("服务监控上报:", ss.monitors[mh.MonitorID].Target, stateStr, "上报者:", r.Reporter, "是否正常:", mh.Successful, "请求输出:", mh.Data) } if stateStr == "故障" || stateStr != ss.lastStatus[mh.MonitorID] { ss.monitorsLock.RLock()