Merge branch 'master' into master
This commit is contained in:
		
						commit
						a3b799a2a0
					
				@ -37,6 +37,7 @@ snapshot:
 | 
				
			|||||||
  name_template: "nezha-agent"
 | 
					  name_template: "nezha-agent"
 | 
				
			||||||
archives:
 | 
					archives:
 | 
				
			||||||
  - name_template: "nezha-agent_{{ .Os }}_{{ .Arch }}"
 | 
					  - name_template: "nezha-agent_{{ .Os }}_{{ .Arch }}"
 | 
				
			||||||
 | 
					    format: zip
 | 
				
			||||||
    files:
 | 
					    files:
 | 
				
			||||||
      - none*
 | 
					      - none*
 | 
				
			||||||
changelog:
 | 
					changelog:
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										20
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								README.md
									
									
									
									
									
								
							@ -4,7 +4,7 @@
 | 
				
			|||||||
  <br>
 | 
					  <br>
 | 
				
			||||||
  <small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
 | 
					  <small><i>LOGO designed by <a href="https://xio.ng" target="_blank">熊大</a> .</i></small>
 | 
				
			||||||
  <br><br>
 | 
					  <br><br>
 | 
				
			||||||
<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.12.27&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.8.2-brightgreen?style=for-the-badge&logo=linux">
 | 
					<img src="https://img.shields.io/github/workflow/status/naiba/nezha/Dashboard%20image?label=Dash%20v0.12.30&logo=github&style=for-the-badge"> <img src="https://img.shields.io/github/v/release/naiba/nezha?color=brightgreen&label=Agent&style=for-the-badge&logo=github"> <img src="https://img.shields.io/github/workflow/status/naiba/nezha/Agent%20release?label=Agent%20CI&logo=github&style=for-the-badge"> <img src="https://img.shields.io/badge/Installer-v0.8.3-brightgreen?style=for-the-badge&logo=linux">
 | 
				
			||||||
  <br>
 | 
					  <br>
 | 
				
			||||||
  <br>
 | 
					  <br>
 | 
				
			||||||
  <p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,计划任务和在线终端。</p>
 | 
					  <p>:trollface: <b>哪吒监控</b> 一站式轻监控轻运维系统。支持系统状态、HTTP(SSL 证书变更、即将到期、到期)、TCP、Ping 监控报警,计划任务和在线终端。</p>
 | 
				
			||||||
@ -18,7 +18,7 @@
 | 
				
			|||||||
| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
 | 
					| ---------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------ | -------------------------------------------------------------------------- |
 | 
				
			||||||
|                               | <img src="resource/template/theme-daynight/screenshot.png" width="3000px"/>                            | <img src="resource/template/theme-hotaru/screenshot.png" width="1500px" /> |
 | 
					|                               | <img src="resource/template/theme-daynight/screenshot.png" width="3000px"/>                            | <img src="resource/template/theme-hotaru/screenshot.png" width="1500px" /> |
 | 
				
			||||||
| <div align="center"><b>默认主题魔改 <a href="https://ii.do/43.html">[教程]</a></b></div> | <div align="center"><b>Neko Mdui <a href="https://github.com/MikoyChinese">@MikoyChinese</a></b></div> |                                                                            |
 | 
					| <div align="center"><b>默认主题魔改 <a href="https://ii.do/43.html">[教程]</a></b></div> | <div align="center"><b>Neko Mdui <a href="https://github.com/MikoyChinese">@MikoyChinese</a></b></div> |                                                                            |
 | 
				
			||||||
|        |                                               |                                                                            |
 | 
					|        |                                               |                                                                            |
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## 安装脚本
 | 
					## 安装脚本
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -32,12 +32,24 @@ sudo ./nezha.sh
 | 
				
			|||||||
国内镜像加速:
 | 
					国内镜像加速:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```shell
 | 
					```shell
 | 
				
			||||||
curl -L https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh
 | 
					curl -L https://fastly.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh
 | 
				
			||||||
CN=true sudo ./nezha.sh
 | 
					CN=true sudo ./nezha.sh
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
_\* 使用 WatchTower 可以自动更新面板,Windows 终端可以使用 nssm 配置自启动(见尾部教程)_
 | 
					_\* 使用 WatchTower 可以自动更新面板,Windows 终端可以使用 nssm 配置自启动(见尾部教程)_
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					**Windows 一键安装 Agent (请使用 Powershell 管理员权限)**
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					```powershell
 | 
				
			||||||
 | 
					set-ExecutionPolicy RemoteSigned;Invoke-WebRequest https://raw.githubusercontent.com/naiba/nezha/master/script/install.ps1 -OutFile C:\install.ps1;powershell.exe C:\install.ps1 dashboard_host:grpc_port secret
 | 
				
			||||||
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					*如遇此图请选择 Y*
 | 
				
			||||||
 | 
					
 | 
				
			||||||
### Agent 自定义
 | 
					### Agent 自定义
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#### 自定义监控的网卡和硬盘分区
 | 
					#### 自定义监控的网卡和硬盘分区
 | 
				
			||||||
@ -260,7 +272,7 @@ URL 里面也可放置占位符,请求时会进行简单的字符串替换。
 | 
				
			|||||||
<details>
 | 
					<details>
 | 
				
			||||||
    <summary>如何使 新版OpenWRT 自启动?来自 @艾斯德斯</summary>
 | 
					    <summary>如何使 新版OpenWRT 自启动?来自 @艾斯德斯</summary>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
首先在 release 下载对应的二进制解压 tar.gz 包后放置到 `/root`,然后 `chmod +x /root/nezha-agent` 赋予执行权限,然后创建 `/etc/init.d/nezha-service`:
 | 
					首先在 release 下载对应的二进制解压 zip 包后放置到 `/root`,然后 `chmod +x /root/nezha-agent` 赋予执行权限,然后创建 `/etc/init.d/nezha-service`:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
```shell
 | 
					```shell
 | 
				
			||||||
#!/bin/sh /etc/rc.common
 | 
					#!/bin/sh /etc/rc.common
 | 
				
			||||||
 | 
				
			|||||||
@ -31,14 +31,19 @@ func ServeWeb(port uint) *http.Server {
 | 
				
			|||||||
			conf := i18n.LocalizeConfig{
 | 
								conf := i18n.LocalizeConfig{
 | 
				
			||||||
				MessageID: id,
 | 
									MessageID: id,
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if len(dataAndCount) > 1 {
 | 
								if len(dataAndCount) > 0 {
 | 
				
			||||||
				conf.TemplateData = dataAndCount[1]
 | 
									conf.TemplateData = dataAndCount[0]
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			if len(dataAndCount) > 2 {
 | 
								if len(dataAndCount) > 1 {
 | 
				
			||||||
				conf.PluralCount = dataAndCount[2]
 | 
									conf.PluralCount = dataAndCount[1]
 | 
				
			||||||
			}
 | 
								}
 | 
				
			||||||
			return singleton.Localizer.MustLocalize(&conf)
 | 
								return singleton.Localizer.MustLocalize(&conf)
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
							"toValMap": func(val interface{}) map[string]interface{} {
 | 
				
			||||||
 | 
								return map[string]interface{}{
 | 
				
			||||||
 | 
									"Value": val,
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
							},
 | 
				
			||||||
		"tf": func(t time.Time) string {
 | 
							"tf": func(t time.Time) string {
 | 
				
			||||||
			return t.In(singleton.Loc).Format("2006年1月2号 15:04:05")
 | 
								return t.In(singleton.Loc).Format("2006年1月2号 15:04:05")
 | 
				
			||||||
		},
 | 
							},
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								go.mod
									
									
									
									
									
								
							
							
						
						
									
										6
									
								
								go.mod
									
									
									
									
									
								
							@ -5,7 +5,7 @@ go 1.18
 | 
				
			|||||||
require (
 | 
					require (
 | 
				
			||||||
	code.cloudfoundry.org/bytefmt v0.0.0-20211005130812-5bb3c17173e5
 | 
						code.cloudfoundry.org/bytefmt v0.0.0-20211005130812-5bb3c17173e5
 | 
				
			||||||
	github.com/AlecAivazis/survey/v2 v2.3.4
 | 
						github.com/AlecAivazis/survey/v2 v2.3.4
 | 
				
			||||||
	github.com/BurntSushi/toml v1.0.0
 | 
						github.com/BurntSushi/toml v1.1.0
 | 
				
			||||||
	github.com/Erope/goss v0.0.0-20211230093305-df3c03fd1ed4
 | 
						github.com/Erope/goss v0.0.0-20211230093305-df3c03fd1ed4
 | 
				
			||||||
	github.com/artdarek/go-unzip v1.0.0
 | 
						github.com/artdarek/go-unzip v1.0.0
 | 
				
			||||||
	github.com/blang/semver v3.5.1+incompatible
 | 
						github.com/blang/semver v3.5.1+incompatible
 | 
				
			||||||
@ -29,7 +29,7 @@ require (
 | 
				
			|||||||
	github.com/spf13/pflag v1.0.5
 | 
						github.com/spf13/pflag v1.0.5
 | 
				
			||||||
	github.com/spf13/viper v1.11.0
 | 
						github.com/spf13/viper v1.11.0
 | 
				
			||||||
	github.com/stretchr/testify v1.7.1
 | 
						github.com/stretchr/testify v1.7.1
 | 
				
			||||||
	golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
 | 
						golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f
 | 
				
			||||||
	golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
 | 
						golang.org/x/oauth2 v0.0.0-20220411215720-9780585627b5
 | 
				
			||||||
	golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
 | 
						golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
 | 
				
			||||||
	golang.org/x/text v0.3.7
 | 
						golang.org/x/text v0.3.7
 | 
				
			||||||
@ -37,7 +37,7 @@ require (
 | 
				
			|||||||
	google.golang.org/protobuf v1.28.0
 | 
						google.golang.org/protobuf v1.28.0
 | 
				
			||||||
	gopkg.in/yaml.v2 v2.4.0
 | 
						gopkg.in/yaml.v2 v2.4.0
 | 
				
			||||||
	gorm.io/driver/sqlite v1.3.2
 | 
						gorm.io/driver/sqlite v1.3.2
 | 
				
			||||||
	gorm.io/gorm v1.23.4
 | 
						gorm.io/gorm v1.23.5
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require (
 | 
					require (
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										10
									
								
								go.sum
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								go.sum
									
									
									
									
									
								
							@ -41,8 +41,9 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7
 | 
				
			|||||||
github.com/AlecAivazis/survey/v2 v2.3.4 h1:pchTU9rsLUSvWEl2Aq9Pv3k0IE2fkqtGxazskAMd9Ng=
 | 
					github.com/AlecAivazis/survey/v2 v2.3.4 h1:pchTU9rsLUSvWEl2Aq9Pv3k0IE2fkqtGxazskAMd9Ng=
 | 
				
			||||||
github.com/AlecAivazis/survey/v2 v2.3.4/go.mod h1:hrV6Y/kQCLhIZXGcriDCUBtB3wnN7156gMXJ3+b23xM=
 | 
					github.com/AlecAivazis/survey/v2 v2.3.4/go.mod h1:hrV6Y/kQCLhIZXGcriDCUBtB3wnN7156gMXJ3+b23xM=
 | 
				
			||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 | 
					github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
 | 
				
			||||||
github.com/BurntSushi/toml v1.0.0 h1:dtDWrepsVPfW9H/4y7dDgFc2MBUSeJhlaDtK13CxFlU=
 | 
					 | 
				
			||||||
github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
 | 
					github.com/BurntSushi/toml v1.0.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
 | 
				
			||||||
 | 
					github.com/BurntSushi/toml v1.1.0 h1:ksErzDEI1khOiGPgpwuI7x2ebx/uXQNw7xJpn9Eq1+I=
 | 
				
			||||||
 | 
					github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ=
 | 
				
			||||||
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
 | 
					github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
 | 
				
			||||||
github.com/Erope/goss v0.0.0-20211230093305-df3c03fd1ed4 h1:X35U3bryt+j2a9RZyXyBPISNIYQsfNKWC/d/B8J861I=
 | 
					github.com/Erope/goss v0.0.0-20211230093305-df3c03fd1ed4 h1:X35U3bryt+j2a9RZyXyBPISNIYQsfNKWC/d/B8J861I=
 | 
				
			||||||
github.com/Erope/goss v0.0.0-20211230093305-df3c03fd1ed4/go.mod h1:gl55GUYOV6rvsL/V23GdfRNdnreh+McD5Yo1sNc+Qe0=
 | 
					github.com/Erope/goss v0.0.0-20211230093305-df3c03fd1ed4/go.mod h1:gl55GUYOV6rvsL/V23GdfRNdnreh+McD5Yo1sNc+Qe0=
 | 
				
			||||||
@ -347,8 +348,8 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
 | 
				
			|||||||
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
 | 
					golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
 | 
				
			||||||
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
 | 
					golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
 | 
				
			||||||
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
 | 
					golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
 | 
				
			||||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4 h1:kUhD7nTDoI3fVd9G4ORWrbV5NY0liEs/Jg2pv5f+bBA=
 | 
					golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f h1:OeJjE6G4dgCY4PIXvIRQbE8+RX+uXZyGhUy/ksMGJoc=
 | 
				
			||||||
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
 | 
					golang.org/x/crypto v0.0.0-20220427172511-eb4f295cb31f/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
 | 
				
			||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 | 
					golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 | 
				
			||||||
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 | 
					golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
 | 
				
			||||||
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
 | 
					golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
 | 
				
			||||||
@ -692,8 +693,9 @@ gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v
 | 
				
			|||||||
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 | 
					gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 | 
				
			||||||
gorm.io/driver/sqlite v1.3.2 h1:nWTy4cE52K6nnMhv23wLmur9Y3qWbZvOBz+V4PrGAxg=
 | 
					gorm.io/driver/sqlite v1.3.2 h1:nWTy4cE52K6nnMhv23wLmur9Y3qWbZvOBz+V4PrGAxg=
 | 
				
			||||||
gorm.io/driver/sqlite v1.3.2/go.mod h1:B+8GyC9K7VgzJAcrcXMRPdnMcck+8FgJynEehEPM16U=
 | 
					gorm.io/driver/sqlite v1.3.2/go.mod h1:B+8GyC9K7VgzJAcrcXMRPdnMcck+8FgJynEehEPM16U=
 | 
				
			||||||
gorm.io/gorm v1.23.4 h1:1BKWM67O6CflSLcwGQR7ccfmC4ebOxQrTfOQGRE9wjg=
 | 
					 | 
				
			||||||
gorm.io/gorm v1.23.4/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
 | 
					gorm.io/gorm v1.23.4/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
 | 
				
			||||||
 | 
					gorm.io/gorm v1.23.5 h1:TnlF26wScKSvknUC/Rn8t0NLLM22fypYBlvj1+aH6dM=
 | 
				
			||||||
 | 
					gorm.io/gorm v1.23.5/go.mod h1:l2lP/RyAtc1ynaTjFksBde/O8v9oOGIApu2/xRitmZk=
 | 
				
			||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 | 
					honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 | 
				
			||||||
honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 | 
					honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 | 
				
			||||||
honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 | 
					honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 | 
				
			||||||
 | 
				
			|||||||
@ -45,6 +45,9 @@
 | 
				
			|||||||
                            <i class="linux icon"></i>
 | 
					                            <i class="linux icon"></i>
 | 
				
			||||||
                        </button>
 | 
					                        </button>
 | 
				
			||||||
                        <button class="ui icon mini button" data-tooltip="{{tr "NotSupportedYet"}}">
 | 
					                        <button class="ui icon mini button" data-tooltip="{{tr "NotSupportedYet"}}">
 | 
				
			||||||
 | 
					                        <button class="ui icon green mini button"
 | 
				
			||||||
 | 
					                            data-clipboard-text="{{if $.Conf.GRPCHost}}set-ExecutionPolicy RemoteSigned;Invoke-WebRequest https://raw.githubusercontent.com/naiba/nezha/master/script/install.ps1 -OutFile C:\install.ps1;powershell.exe C:\install.ps1 {{$.Conf.GRPCHost}}:{{if $.Conf.ProxyGRPCPort}}{{$.Conf.ProxyGRPCPort}}{{else}}{{$.Conf.GRPCPort}}{{end}} {{$server.Secret}}{{if $.Conf.TLS}} --tls{{end}}{{else}}{{tr "NoDomainAlert"}}{{end}}"
 | 
				
			||||||
 | 
					                            data-tooltip="{{tr "ClickToCopyTheInstallationCommand"}}">
 | 
				
			||||||
                            <i class="windows icon"></i>
 | 
					                            <i class="windows icon"></i>
 | 
				
			||||||
                        </button>
 | 
					                        </button>
 | 
				
			||||||
                        <button class="ui icon mini button" data-tooltip="{{tr "NotSupportedYet"}}">
 | 
					                        <button class="ui icon mini button" data-tooltip="{{tr "NotSupportedYet"}}">
 | 
				
			||||||
@ -74,7 +77,7 @@
 | 
				
			|||||||
</div>
 | 
					</div>
 | 
				
			||||||
{{template "component/server" .}}
 | 
					{{template "component/server" .}}
 | 
				
			||||||
{{template "common/footer" .}}
 | 
					{{template "common/footer" .}}
 | 
				
			||||||
<script src="https://cdn.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
 | 
					<script src="https://fastly.jsdelivr.net/npm/clipboard@2.0.8/dist/clipboard.min.js"></script>
 | 
				
			||||||
<script>
 | 
					<script>
 | 
				
			||||||
    var clipboard = new ClipboardJS('.ui.icon.green.mini.button');
 | 
					    var clipboard = new ClipboardJS('.ui.icon.green.mini.button');
 | 
				
			||||||
    const checkBoxList = document.querySelectorAll('tbody > tr > td > input.nezha-servers[type=checkbox]')
 | 
					    const checkBoxList = document.querySelectorAll('tbody > tr > td > input.nezha-servers[type=checkbox]')
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@
 | 
				
			|||||||
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
					    <meta name="viewport" content="width=device-width, initial-scale=1.0">
 | 
				
			||||||
    <title>tty@{{.ServerName}} - {{.Title}}</title>
 | 
					    <title>tty@{{.ServerName}} - {{.Title}}</title>
 | 
				
			||||||
    <link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
 | 
					    <link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
 | 
				
			||||||
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/xterm@4.13.0/css/xterm.css">
 | 
					    <link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/xterm@4.13.0/css/xterm.css">
 | 
				
			||||||
</head>
 | 
					</head>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
<style>
 | 
					<style>
 | 
				
			||||||
@ -28,9 +28,9 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
<body onresize="onResize()">
 | 
					<body onresize="onResize()">
 | 
				
			||||||
    <div id="terminal-container"></div>
 | 
					    <div id="terminal-container"></div>
 | 
				
			||||||
    <script src="https://cdn.jsdelivr.net/npm/xterm@4.13.0/lib/xterm.min.js"></script>
 | 
					    <script src="https://fastly.jsdelivr.net/npm/xterm@4.13.0/lib/xterm.min.js"></script>
 | 
				
			||||||
    <script src="https://cdn.jsdelivr.net/npm/xterm-addon-attach@0.6.0/lib/xterm-addon-attach.min.js"></script>
 | 
					    <script src="https://fastly.jsdelivr.net/npm/xterm-addon-attach@0.6.0/lib/xterm-addon-attach.min.js"></script>
 | 
				
			||||||
    <script src="https://cdn.jsdelivr.net/npm/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.min.js"></script>
 | 
					    <script src="https://fastly.jsdelivr.net/npm/xterm-addon-fit@0.5.0/lib/xterm-addon-fit.min.js"></script>
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        let sendResizing = false;
 | 
					        let sendResizing = false;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								resource/template/theme-daynight/home.html
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								resource/template/theme-daynight/home.html
									
									
									
									
										vendored
									
									
								
							@ -23,7 +23,7 @@
 | 
				
			|||||||
        <section class="nav-bar clearfix">
 | 
					        <section class="nav-bar clearfix">
 | 
				
			||||||
            <figure class="logo">
 | 
					            <figure class="logo">
 | 
				
			||||||
                <a href="/">
 | 
					                <a href="/">
 | 
				
			||||||
                    <img src="/static/logo.svg?v20210804" alt="{{tr "nezhaMonitor"}}" width="50" height="50">
 | 
					                    <img src="/static/logo.svg?v20210804" alt='{{tr "nezhaMonitor"}}' width="50" height="50">
 | 
				
			||||||
                </a>
 | 
					                </a>
 | 
				
			||||||
                <a href="/">{{.Conf.Site.Brand}}</a>
 | 
					                <a href="/">{{.Conf.Site.Brand}}</a>
 | 
				
			||||||
            </figure>
 | 
					            </figure>
 | 
				
			||||||
@ -165,8 +165,8 @@
 | 
				
			|||||||
    </footer>
 | 
					    </footer>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script src="/static/theme-daynight/js/main.js?v202102012266"></script>
 | 
					    <script src="/static/theme-daynight/js/main.js?v202102012266"></script>
 | 
				
			||||||
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js"></script>
 | 
					    <script src="https://fastly.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js"></script>
 | 
				
			||||||
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@10"></script>
 | 
					    <script src="https://fastly.jsdelivr.net/npm/sweetalert2@10"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        const initData = JSON.parse('{{.Servers}}').servers;
 | 
					        const initData = JSON.parse('{{.Servers}}').servers;
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										8
									
								
								resource/template/theme-hotaru/home.html
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								resource/template/theme-hotaru/home.html
									
									
									
									
										vendored
									
									
								
							@ -14,7 +14,7 @@
 | 
				
			|||||||
    <meta http-equiv="Content-Language" content="zh" />
 | 
					    <meta http-equiv="Content-Language" content="zh" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    <!-- Styles -->
 | 
					    <!-- Styles -->
 | 
				
			||||||
    <link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
 | 
					    <link rel="stylesheet" type="text/css" href="https://fastly.jsdelivr.net/npm/semantic-ui@2.4.2/dist/semantic.min.css">
 | 
				
			||||||
    <link rel="stylesheet" type="text/css" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.1/css/all.min.css">
 | 
					    <link rel="stylesheet" type="text/css" href="https://cdn.bootcdn.net/ajax/libs/font-awesome/5.15.1/css/all.min.css">
 | 
				
			||||||
    <link rel="stylesheet" type="text/css" href="/static/semantic-ui-alerts.min.css">
 | 
					    <link rel="stylesheet" type="text/css" href="/static/semantic-ui-alerts.min.css">
 | 
				
			||||||
    <link rel="stylesheet" href="/static/theme-hotaru/css/core.css?v202012121912" type="text/css">
 | 
					    <link rel="stylesheet" href="/static/theme-hotaru/css/core.css?v202012121912" type="text/css">
 | 
				
			||||||
@ -146,10 +146,10 @@
 | 
				
			|||||||
            <a href="/server">管理后台</a>
 | 
					            <a href="/server">管理后台</a>
 | 
				
			||||||
        </p>
 | 
					        </p>
 | 
				
			||||||
    </footer>
 | 
					    </footer>
 | 
				
			||||||
    <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
 | 
					    <script src="https://fastly.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
 | 
				
			||||||
    <script src="https://cdn.jsdelivr.net/npm/semantic-ui@2.4.1/dist/semantic.min.js"></script>
 | 
					    <script src="https://fastly.jsdelivr.net/npm/semantic-ui@2.4.1/dist/semantic.min.js"></script>
 | 
				
			||||||
    <script src="/static/semantic-ui-alerts.min.js"></script>
 | 
					    <script src="/static/semantic-ui-alerts.min.js"></script>
 | 
				
			||||||
    <script src="https://cdn.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js"></script>
 | 
					    <script src="https://fastly.jsdelivr.net/npm/vue@2.6.12/dist/vue.min.js"></script>
 | 
				
			||||||
    <script>
 | 
					    <script>
 | 
				
			||||||
        const initData = JSON.parse('{{.Servers}}').servers;
 | 
					        const initData = JSON.parse('{{.Servers}}').servers;
 | 
				
			||||||
        var statusCards = new Vue({
 | 
					        var statusCards = new Vue({
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								resource/template/theme-mdui/home.html
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								resource/template/theme-mdui/home.html
									
									
									
									
										vendored
									
									
								
							@ -9,7 +9,7 @@
 | 
				
			|||||||
  <link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
 | 
					  <link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <!-- MDUI CSS -->
 | 
					  <!-- MDUI CSS -->
 | 
				
			||||||
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdui@1.0.2/dist/css/mdui.min.css"/>
 | 
					  <link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/mdui@1.0.2/dist/css/mdui.min.css"/>
 | 
				
			||||||
  <link rel="stylesheet" href="/static/theme-mdui/mdui.css" type="text/css">
 | 
					  <link rel="stylesheet" href="/static/theme-mdui/mdui.css" type="text/css">
 | 
				
			||||||
  <style>
 | 
					  <style>
 | 
				
			||||||
	.mdui-table td, .mdui-table th{padding: 6px;}
 | 
						.mdui-table td, .mdui-table th{padding: 6px;}
 | 
				
			||||||
@ -151,8 +151,8 @@
 | 
				
			|||||||
{{template "theme-mdui/footer" .}}
 | 
					{{template "theme-mdui/footer" .}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <script src="/static/theme-mdui/mdui.js"></script>
 | 
					  <script src="/static/theme-mdui/mdui.js"></script>
 | 
				
			||||||
  <script src="https://cdn.jsdelivr.net/npm/mdui@1.0.2/dist/js/mdui.min.js"></script>
 | 
					  <script src="https://fastly.jsdelivr.net/npm/mdui@1.0.2/dist/js/mdui.min.js"></script>
 | 
				
			||||||
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
 | 
					  <script src="https://fastly.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
 | 
				
			||||||
  <script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.12/vue.min.js"></script>
 | 
					  <script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.12/vue.min.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <script>
 | 
					  <script>
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										6
									
								
								resource/template/theme-mdui/service.html
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								resource/template/theme-mdui/service.html
									
									
									
									
										vendored
									
									
								
							@ -9,7 +9,7 @@
 | 
				
			|||||||
  <link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
 | 
					  <link rel="shortcut icon" type="image/png" href="/static/logo.svg?v20210804" />
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <!-- MDUI CSS -->
 | 
					  <!-- MDUI CSS -->
 | 
				
			||||||
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdui@1.0.2/dist/css/mdui.min.css"/>
 | 
					  <link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/mdui@1.0.2/dist/css/mdui.min.css"/>
 | 
				
			||||||
  <link rel="stylesheet" href="/static/theme-mdui/mdui.css" type="text/css">
 | 
					  <link rel="stylesheet" href="/static/theme-mdui/mdui.css" type="text/css">
 | 
				
			||||||
  {{if ts .CustomCode}}
 | 
					  {{if ts .CustomCode}}
 | 
				
			||||||
  {{.CustomCode|safe}}
 | 
					  {{.CustomCode|safe}}
 | 
				
			||||||
@ -116,8 +116,8 @@
 | 
				
			|||||||
{{template "theme-mdui/footer" .}}
 | 
					{{template "theme-mdui/footer" .}}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <script src="/static/theme-mdui/mdui.js"></script>
 | 
					  <script src="/static/theme-mdui/mdui.js"></script>
 | 
				
			||||||
  <script src="https://cdn.jsdelivr.net/npm/mdui@1.0.2/dist/js/mdui.min.js"></script>
 | 
					  <script src="https://fastly.jsdelivr.net/npm/mdui@1.0.2/dist/js/mdui.min.js"></script>
 | 
				
			||||||
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
 | 
					  <script src="https://fastly.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
 | 
				
			||||||
  <script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.12/vue.min.js"></script>
 | 
					  <script src="https://lf6-cdn-tos.bytecdntp.com/cdn/expire-1-M/vue/2.6.12/vue.min.js"></script>
 | 
				
			||||||
  <script>
 | 
					  <script>
 | 
				
			||||||
    var container=document.querySelector("#container");
 | 
					    var container=document.querySelector("#container");
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@
 | 
				
			|||||||
  <title>{{.Title}}</title>
 | 
					  <title>{{.Title}}</title>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <!-- MDUI CSS -->
 | 
					  <!-- MDUI CSS -->
 | 
				
			||||||
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/mdui@1.0.2/dist/css/mdui.min.css"/>
 | 
					  <link rel="stylesheet" href="https://fastly.jsdelivr.net/npm/mdui@1.0.2/dist/css/mdui.min.css"/>
 | 
				
			||||||
  <link rel="stylesheet" href="/static/theme-mdui/mdui.css" type="text/css">
 | 
					  <link rel="stylesheet" href="/static/theme-mdui/mdui.css" type="text/css">
 | 
				
			||||||
  {{if ts .CustomCode}}
 | 
					  {{if ts .CustomCode}}
 | 
				
			||||||
  {{.CustomCode|safe}}
 | 
					  {{.CustomCode|safe}}
 | 
				
			||||||
@ -34,8 +34,8 @@
 | 
				
			|||||||
    </div>
 | 
					    </div>
 | 
				
			||||||
  </div>
 | 
					  </div>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <script src="https://cdn.jsdelivr.net/npm/mdui@1.0.2/dist/js/mdui.min.js"></script>
 | 
					  <script src="https://fastly.jsdelivr.net/npm/mdui@1.0.2/dist/js/mdui.min.js"></script>
 | 
				
			||||||
  <script src="https://cdn.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
 | 
					  <script src="https://fastly.jsdelivr.net/npm/jquery@3.4.1/dist/jquery.min.js"></script>
 | 
				
			||||||
  <script>
 | 
					  <script>
 | 
				
			||||||
    var $input = mdui.$('#container').find('.mdui-textfield-input');
 | 
					    var $input = mdui.$('#container').find('.mdui-textfield-input');
 | 
				
			||||||
    var $dialog = new mdui.Dialog(mdui.$('.mdui-dialog'));
 | 
					    var $dialog = new mdui.Dialog(mdui.$('.mdui-dialog'));
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										40
									
								
								script/install.ps1
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								script/install.ps1
									
									
									
									
									
										Normal file
									
								
							@ -0,0 +1,40 @@
 | 
				
			|||||||
 | 
					#Get server and key
 | 
				
			||||||
 | 
					param($server, $key)
 | 
				
			||||||
 | 
					# Download latest release from github
 | 
				
			||||||
 | 
					$repo = "naiba/nezha"
 | 
				
			||||||
 | 
					#  x86 or x64
 | 
				
			||||||
 | 
					if ([System.Environment]::Is64BitOperatingSystem) {
 | 
				
			||||||
 | 
					    $file = "nezha-agent_windows_amd64.zip"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					else {
 | 
				
			||||||
 | 
					    $file = "nezha-agent_windows_386.zip"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					$releases = "https://api.github.com/repos/$repo/releases"
 | 
				
			||||||
 | 
					Write-Host "Determining latest nezha release" -BackgroundColor DarkGreen -ForegroundColor White
 | 
				
			||||||
 | 
					[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
 | 
				
			||||||
 | 
					$tag = (Invoke-WebRequest -Uri $releases -UseBasicParsing | ConvertFrom-Json)[0].tag_name
 | 
				
			||||||
 | 
					$download = "https://github.com/$repo/releases/download/$tag/$file"
 | 
				
			||||||
 | 
					Invoke-WebRequest $download -OutFile "C:\nezha.zip"
 | 
				
			||||||
 | 
					#使用nssm安装服务
 | 
				
			||||||
 | 
					Invoke-WebRequest "http://nssm.cc/release/nssm-2.24.zip" -OutFile "C:\nssm.zip"
 | 
				
			||||||
 | 
					#解压
 | 
				
			||||||
 | 
					Expand-Archive "C:\nezha.zip" -DestinationPath "C:\temp" -Force
 | 
				
			||||||
 | 
					Expand-Archive "C:\nssm.zip" -DestinationPath "C:\temp" -Force
 | 
				
			||||||
 | 
					if (!(Test-Path "C:\nezha")) { New-Item -Path "C:\nezha" -type directory }
 | 
				
			||||||
 | 
					#整理文件
 | 
				
			||||||
 | 
					Move-Item -Path "C:\temp\nezha-agent.exe" -Destination "C:\nezha\nezha.exe"
 | 
				
			||||||
 | 
					if ($file = "nezha-agent_windows_amd64.zip") {
 | 
				
			||||||
 | 
					    Move-Item -Path "C:\temp\nssm-2.24\win64\nssm.exe" -Destination "C:\nezha\nssm.exe"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					else {
 | 
				
			||||||
 | 
					    Move-Item -Path "C:\temp\nssm-2.24\win32\nssm.exe" -Destination "C:\nezha\nssm.exe"
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					#清理垃圾
 | 
				
			||||||
 | 
					Remove-Item "C:\nezha.zip"
 | 
				
			||||||
 | 
					Remove-Item "C:\nssm.zip"
 | 
				
			||||||
 | 
					Remove-Item "C:\temp" -Recurse
 | 
				
			||||||
 | 
					#安装部分
 | 
				
			||||||
 | 
					C:\nezha\nssm.exe install nezha C:\nezha\nezha.exe -s $server -p $key -d 
 | 
				
			||||||
 | 
					C:\nezha\nssm.exe start nezha
 | 
				
			||||||
 | 
					#enjoy
 | 
				
			||||||
 | 
					Write-Host "Enjoy It!" -BackgroundColor DarkGreen -ForegroundColor Red
 | 
				
			||||||
@ -11,7 +11,7 @@ NZ_BASE_PATH="/opt/nezha"
 | 
				
			|||||||
NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
 | 
					NZ_DASHBOARD_PATH="${NZ_BASE_PATH}/dashboard"
 | 
				
			||||||
NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
 | 
					NZ_AGENT_PATH="${NZ_BASE_PATH}/agent"
 | 
				
			||||||
NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
 | 
					NZ_AGENT_SERVICE="/etc/systemd/system/nezha-agent.service"
 | 
				
			||||||
NZ_VERSION="v0.8.2"
 | 
					NZ_VERSION="v0.9.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
red='\033[0;31m'
 | 
					red='\033[0;31m'
 | 
				
			||||||
green='\033[0;32m'
 | 
					green='\033[0;32m'
 | 
				
			||||||
@ -75,7 +75,7 @@ pre_check() {
 | 
				
			|||||||
        Get_Docker_Argu=" "
 | 
					        Get_Docker_Argu=" "
 | 
				
			||||||
        Docker_IMG="ghcr.io\/naiba\/nezha-dashboard"
 | 
					        Docker_IMG="ghcr.io\/naiba\/nezha-dashboard"
 | 
				
			||||||
    else
 | 
					    else
 | 
				
			||||||
        GITHUB_RAW_URL="cdn.jsdelivr.net/gh/naiba/nezha@master"
 | 
					        GITHUB_RAW_URL="fastly.jsdelivr.net/gh/naiba/nezha@master"
 | 
				
			||||||
        GITHUB_URL="dn-dao-github-mirror.daocloud.io"
 | 
					        GITHUB_URL="dn-dao-github-mirror.daocloud.io"
 | 
				
			||||||
        Get_Docker_URL="get.daocloud.io/docker"
 | 
					        Get_Docker_URL="get.daocloud.io/docker"
 | 
				
			||||||
        Get_Docker_Argu=" -s docker --mirror Aliyun"
 | 
					        Get_Docker_Argu=" -s docker --mirror Aliyun"
 | 
				
			||||||
@ -124,8 +124,8 @@ before_show_menu() {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
install_base() {
 | 
					install_base() {
 | 
				
			||||||
    (command -v git >/dev/null 2>&1 && command -v curl >/dev/null 2>&1 && command -v wget >/dev/null 2>&1 && command -v tar >/dev/null 2>&1) ||
 | 
					    (command -v git >/dev/null 2>&1 && command -v curl >/dev/null 2>&1 && command -v wget >/dev/null 2>&1 && command -v unzip >/dev/null 2>&1) ||
 | 
				
			||||||
        (install_soft curl wget git tar)
 | 
					        (install_soft curl wget git unzip)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
install_soft() {
 | 
					install_soft() {
 | 
				
			||||||
@ -185,7 +185,7 @@ install_agent() {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    local version=$(curl -m 10 -sL "https://api.github.com/repos/naiba/nezha/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
 | 
					    local version=$(curl -m 10 -sL "https://api.github.com/repos/naiba/nezha/releases/latest" | grep "tag_name" | head -n 1 | awk -F ":" '{print $2}' | sed 's/\"//g;s/,//g;s/ //g')
 | 
				
			||||||
    if [ ! -n "$version" ]; then
 | 
					    if [ ! -n "$version" ]; then
 | 
				
			||||||
        version=$(curl -m 10 -sL "https://cdn.jsdelivr.net/gh/naiba/nezha/" | grep "option\.value" | awk -F "'" '{print $2}' | sed 's/naiba\/nezha@/v/g')
 | 
					        version=$(curl -m 10 -sL "https://fastly.jsdelivr.net/gh/naiba/nezha/" | grep "option\.value" | awk -F "'" '{print $2}' | sed 's/naiba\/nezha@/v/g')
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ ! -n "$version" ]; then
 | 
					    if [ ! -n "$version" ]; then
 | 
				
			||||||
@ -200,14 +200,15 @@ install_agent() {
 | 
				
			|||||||
    chmod 777 -R $NZ_AGENT_PATH
 | 
					    chmod 777 -R $NZ_AGENT_PATH
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    echo -e "正在下载监控端"
 | 
					    echo -e "正在下载监控端"
 | 
				
			||||||
    wget -O nezha-agent_linux_${os_arch}.tar.gz https://${GITHUB_URL}/naiba/nezha/releases/download/${version}/nezha-agent_linux_${os_arch}.tar.gz >/dev/null 2>&1
 | 
					    wget -O nezha-agent_linux_${os_arch}.zip https://${GITHUB_URL}/naiba/nezha/releases/download/${version}/nezha-agent_linux_${os_arch}.zip >/dev/null 2>&1
 | 
				
			||||||
    if [[ $? != 0 ]]; then
 | 
					    if [[ $? != 0 ]]; then
 | 
				
			||||||
        echo -e "${red}Release 下载失败,请检查本机能否连接 ${GITHUB_URL}${plain}"
 | 
					        echo -e "${red}Release 下载失败,请检查本机能否连接 ${GITHUB_URL}${plain}"
 | 
				
			||||||
        return 0
 | 
					        return 0
 | 
				
			||||||
    fi
 | 
					    fi
 | 
				
			||||||
    tar xf nezha-agent_linux_${os_arch}.tar.gz &&
 | 
					
 | 
				
			||||||
 | 
					    unzip -qo nezha-agent_linux_${os_arch}.zip &&
 | 
				
			||||||
        mv nezha-agent $NZ_AGENT_PATH &&
 | 
					        mv nezha-agent $NZ_AGENT_PATH &&
 | 
				
			||||||
        rm -rf nezha-agent_linux_${os_arch}.tar.gz README.md
 | 
					        rm -rf nezha-agent_linux_${os_arch}.zip README.md
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [ $# -ge 3 ]; then
 | 
					    if [ $# -ge 3 ]; then
 | 
				
			||||||
        modify_agent_config "$@"
 | 
					        modify_agent_config "$@"
 | 
				
			||||||
@ -294,8 +295,8 @@ modify_dashboard_config() {
 | 
				
			|||||||
        read -ep "请输入 Oauth2 应用的 Client Secret: " nz_github_oauth_client_secret &&
 | 
					        read -ep "请输入 Oauth2 应用的 Client Secret: " nz_github_oauth_client_secret &&
 | 
				
			||||||
        read -ep "请输入 GitHub/Gitee 登录名作为管理员,多个以逗号隔开: " nz_admin_logins &&
 | 
					        read -ep "请输入 GitHub/Gitee 登录名作为管理员,多个以逗号隔开: " nz_admin_logins &&
 | 
				
			||||||
        read -ep "请输入站点标题: " nz_site_title &&
 | 
					        read -ep "请输入站点标题: " nz_site_title &&
 | 
				
			||||||
        read -ep "请输入站点访问端口: (8008)" nz_site_port &&
 | 
					        read -ep "请输入站点访问端口: (默认 8008)" nz_site_port &&
 | 
				
			||||||
        read -ep "请输入用于 Agent 接入的 RPC 端口: (5555)" nz_grpc_port
 | 
					        read -ep "请输入用于 Agent 接入的 RPC 端口: (默认 5555)" nz_grpc_port
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if [[ -z "${nz_admin_logins}" || -z "${nz_github_oauth_client_id}" || -z "${nz_github_oauth_client_secret}" || -z "${nz_site_title}" ]]; then
 | 
					    if [[ -z "${nz_admin_logins}" || -z "${nz_github_oauth_client_id}" || -z "${nz_github_oauth_client_secret}" || -z "${nz_site_title}" ]]; then
 | 
				
			||||||
        echo -e "${red}所有选项都不能为空${plain}"
 | 
					        echo -e "${red}所有选项都不能为空${plain}"
 | 
				
			||||||
 | 
				
			|||||||
@ -12,7 +12,7 @@ import (
 | 
				
			|||||||
	"github.com/naiba/nezha/pkg/utils"
 | 
						"github.com/naiba/nezha/pkg/utils"
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var Version = "v0.12.27" // !!记得修改 README 中的 badge 版本!!
 | 
					var Version = "v0.12.30" // !!记得修改 README 中的 badge 版本!!
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var (
 | 
					var (
 | 
				
			||||||
	Conf  *model.Config
 | 
						Conf  *model.Config
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user