修改:国内镜像CDN、不稳定的邮件告警示例;优化一系列的错误的格式和错字

This commit is contained in:
Kris 2023-02-02 17:14:20 +01:00
parent dafa616636
commit b489ea1a5b
No known key found for this signature in database
GPG Key ID: 36AFAA97D2910652
9 changed files with 62 additions and 80 deletions

View File

@ -15,6 +15,7 @@ If you don't think it's necessary to use port 80 or 443 to access Dashboard, you
::: :::
<br/> <br/>
<br/> <br/>
## Get the Client ID and Client Secret on Github/Gitlab ## Get the Client ID and Client Secret on Github/Gitlab
Nezha Monitor uses a Github account as the login account for the admin panel Nezha Monitor uses a Github account as the login account for the admin panel
+ First we need to create a new authentication application, after logging into Github, open https://github.com/settings/developers and select "OAuth Apps" - "New OAuth App " + First we need to create a new authentication application, after logging into Github, open https://github.com/settings/developers and select "OAuth Apps" - "New OAuth App "

View File

@ -11,20 +11,20 @@ Placeholders can also be placed inside the URL, and it will perform a simple str
Refer to the example below, it is very flexible. Refer to the example below, it is very flexible.
- Bark Example - **Bark Example**
- Name: Bark - Name: Bark
- URL composition: the first part is the key, followed by three matches/: key/: body or/: key/: title/: body or/: key/: category/: title/: body - URL: The first part is the key, followed by three matches/: key/: body or/: key/: title/: body or/: key/: category/: title/: body
- Request method: GET - Request method: GET
- Request Type: Default - Request Type: Default
- Body: null - Body: null
- Name: Bark - Name: Bark
- URL composition:/push - URL:/push
- Request method: POST - Request method: POST
- Request type: FORM - Request type: FORM
- Body: `{"title": "#SERVER.NAME#","device_key":"xxxxxxxxx","body":"#NEZHA#","icon":" https://xxxxxxxx/nz.png "}` - Body: `{"title": "#SERVER.NAME#","device_key":"xxxxxxxxx","body":"#NEZHA#","icon":" https://xxxxxxxx/nz.png "}`
- Telegram Example, contributed by [@haitau](https://github.com/haitau) - **Telegram Example, contributed by [@haitau](https://github.com/haitau)**
- NameTelegram Robot message notification - NameTelegram Robot message notification
- URLhttps://api.telegram.org/botXXXXXX/sendMessage?chat_id=YYYYYY&text=#NEZHA# - URLhttps://api.telegram.org/botXXXXXX/sendMessage?chat_id=YYYYYY&text=#NEZHA#
@ -33,8 +33,7 @@ Refer to the example below, it is very flexible.
- Body: null - Body: null
- Notes for this methodThe XXXXXX in botXXXXXX is the token provided when you follow the official @Botfather in Telegram and enter /newbot to create a new bot. (In the line after _Use this token to access the HTTP API_). The 'bot' are essential. After creating a bot, you need to talk to the BOT in Telegram (send a random message) before you can send a message by using API. YYYYYY is Telegram user's ID, you can get it by talking to the bot @userinfobot. - Notes for this methodThe XXXXXX in botXXXXXX is the token provided when you follow the official @Botfather in Telegram and enter /newbot to create a new bot. (In the line after _Use this token to access the HTTP API_). The 'bot' are essential. After creating a bot, you need to talk to the BOT in Telegram (send a random message) before you can send a message by using API. YYYYYY is Telegram user's ID, you can get it by talking to the bot @userinfobot.
- Email notification example - Outlook, contributed by [@MIKU_N - **Email notification example - Outlook, contributed by [@Cantoblanco](https://github.com/cantoblanco)**
](https://github.com/MIKU-N)
- Name: MS Mail Notification - Name: MS Mail Notification
- URLhttps://graph.microsoft.com/v1.0/me/microsoft.graph.sendMail - URLhttps://graph.microsoft.com/v1.0/me/microsoft.graph.sendMail

View File

@ -36,7 +36,7 @@ curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh
``` ```
如果你的被控服务器位于中国大陆,可以使用镜像: 如果你的被控服务器位于中国大陆,可以使用镜像:
````bash ````bash
curl -L https://jihulab.com/nezha/nezha/-/raw/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh curl -L https://cdn.jsdelivr.net/gh/naiba/nezha/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
```` ````
* 选择“安装监控 Agent” * 选择“安装监控 Agent”
* 输入通信域名”data.example.com“ * 输入通信域名”data.example.com“

View File

@ -44,7 +44,7 @@ curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh
``` ```
如果你的面板服务器位于中国大陆,可以使用镜像: 如果你的面板服务器位于中国大陆,可以使用镜像:
````bash ````bash
curl -L https://jihulab.com/nezha/nezha/-/raw/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh curl -L https://cdn.jsdelivr.net/gh/naiba/nezha/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
```` ````
* 等待Docker安装完毕后分别输入以下值 * 等待Docker安装完毕后分别输入以下值

View File

@ -10,7 +10,7 @@ URL 里面也可放置占位符,请求时会进行简单的字符串替换。
你可以参考以下的通知方式示例,也可以根据自己的需求灵活设置推送方式 你可以参考以下的通知方式示例,也可以根据自己的需求灵活设置推送方式
- Bark 示例 - **Bark 示例**
- 名称Bark - 名称Bark
- URL 组成: 第一个部分是 key,之后有三个匹配 /:key/:body or /:key/:title/:body or /:key/:category/:title/:body - URL 组成: 第一个部分是 key,之后有三个匹配 /:key/:body or /:key/:title/:body or /:key/:category/:title/:body
@ -23,15 +23,15 @@ URL 里面也可放置占位符,请求时会进行简单的字符串替换。
- 请求类型: form - 请求类型: form
- Body: `{"title": "#SERVER.NAME#","device_key":"xxxxxxxxx","body":"#NEZHA#","icon":"https://xxxxxxxx/nz.png"}` - Body: `{"title": "#SERVER.NAME#","device_key":"xxxxxxxxx","body":"#NEZHA#","icon":"https://xxxxxxxx/nz.png"}`
- server 酱示例 - **Server 酱示例**
- 名称:server 酱 - 名称:Server 酱
- URLhttps://sc.ftqq.com/SCUrandomkeys.send?text=#NEZHA# - URLhttps://sc.ftqq.com/SCUrandomkeys.send?text=#NEZHA#
- 请求方式: GET - 请求方式: GET
- 请求类型: 默认 - 请求类型: 默认
- Body: 空 - Body: 空
- wxpusher 示例,需要关注你的应用 - **wxpusher 示例,需要关注你的应用**
- 名称: wxpusher - 名称: wxpusher
- URLhttp://wxpusher.zjiecode.com/api/send/message - URLhttp://wxpusher.zjiecode.com/api/send/message
@ -39,7 +39,7 @@ URL 里面也可放置占位符,请求时会进行简单的字符串替换。
- 请求类型: JSON - 请求类型: JSON
- Body: `{"appToken":"你的appToken","topicIds":[],"content":"#NEZHA#","contentType":"1","uids":["你的uid"]}` - Body: `{"appToken":"你的appToken","topicIds":[],"content":"#NEZHA#","contentType":"1","uids":["你的uid"]}`
- Telegram 示例 贡献者:[@haitau](https://github.com/haitau) - **Telegram 示例 贡献者:[@haitau](https://github.com/haitau)**
- 名称telegram 机器人消息通知 - 名称telegram 机器人消息通知
- URLhttps://api.telegram.org/botXXXXXX/sendMessage?chat_id=YYYYYY&text=#NEZHA# - URLhttps://api.telegram.org/botXXXXXX/sendMessage?chat_id=YYYYYY&text=#NEZHA#
@ -48,34 +48,16 @@ URL 里面也可放置占位符,请求时会进行简单的字符串替换。
- Body: 空 - Body: 空
- URL 参数获取说明botXXXXXX 中的 XXXXXX 是在 telegram 中关注官方 @Botfather ,输入/newbot 创建新的机器人bot会提供的 token在提示 Use this token to access the HTTP API:后面一行)这里 'bot' 三个字母不可少。创建 bot 后,需要先在 telegram 中与 BOT 进行对话(随便发个消息),然后才可用 API 发送消息。YYYYYY 是 telegram 用户的数字 ID。与机器人@userinfobot 对话可获得。 - URL 参数获取说明botXXXXXX 中的 XXXXXX 是在 telegram 中关注官方 @Botfather ,输入/newbot 创建新的机器人bot会提供的 token在提示 Use this token to access the HTTP API:后面一行)这里 'bot' 三个字母不可少。创建 bot 后,需要先在 telegram 中与 BOT 进行对话(随便发个消息),然后才可用 API 发送消息。YYYYYY 是 telegram 用户的数字 ID。与机器人@userinfobot 对话可获得。
- 邮件通知示例 - Outlook 贡献者:[@MIKU_N](https://github.com/MIKU-N) - **邮件通知示例 - SendCloud 贡献者:[@白歌](https://github.com/cantoblanco)**
**注意SendCloud 有每日免费发送邮件限额限制,这里仅作示例,你可以选择付费服务或其他类似的免费服务,使用方法类似。**
- 名称:MS邮件告警 - 名称:邮件告警
- URLhttps://graph.microsoft.com/v1.0/me/microsoft.graph.sendMail - URLhttps://api.sendcloud.net/apiv2/mail/send?apiUser=<替换APIUSER>apiKey=<替换APIKEY>&from=<自定义发件邮箱>&fromName=Nezha&to=<自定义收件邮箱>&subject=Nezha-Notification&html=#NEZHA#
- 请求方式: POST - 请求方式: POST
- 请求类型: JSON - 请求类型: JSON
- Header: `{"Content-type":"application/json", - Header: 留空
"Authorization":"Bearer {Token}"}` - Body: 留空
- Body: - URL 参数获取说明:此方式需提前在 [SendCloud](https://www.sendcloud.net/) 注册账号,创建发件邮箱,然后在[这里](https://www.sendcloud.net/sendSetting/apiuser)获取 APIUSER 和 APIKEY替换 URL 中的 <替换APIUSER><替换APIKEY> 为自己的 APIUSER 和 APIKEY替换 URL 中的 <自定义发件邮箱><自定义收件邮箱> 为自己的发件邮箱和收件邮箱。
```
{
"message": {
"subject": "服务器状态警报",
"body": {
"contentType": "Text",
"content": "#NEZHA#"
},
"toRecipients": [
{
"emailAddress": {
"address": "接收邮件地址"
}
}
]
}
}
```
- URL 参数获取说明:此方式调用 Microsoft Graph V1.0,需要前往 Microsoft Graph 自行创建应用程序,授予 `Mail.Send` 权限并获取 Token;或者你可以使用[Microsoft Graph Explorer](https://developer.microsoft.com/zh-cn/graph/graph-explorer)直接授予权限并获取 Token。将 Header 中的 Token 字段替换为实际字符段即可。
<br/> <br/>

View File

@ -1,11 +1,11 @@
## 准备工作 ## 准备工作
**你可以选择CloudFlare的workers进行反代,但大陆的网络你懂的,这里介绍用你自己服务器反代方式** **你可以选择 CloudFlare 的 workers 进行反代,但大陆的网络你懂的,这里介绍用你自己服务器反代方式**
搭建一个 TGbot api 反代,你需要: 搭建一个 TGbot api 反代,你需要:
1.一个不受GFW封锁的服务器(且安装好nginx) 1.一个不受 GFW 封锁的服务器(且安装好 Nginx)
2.一个域名(提前申请 SSL 证书) 2.一个域名(提前申请 SSL 证书)
<br/> <br/>
## NGINX 配置 ## NGINX 配置
编辑你nginx的配置文件,在http{}中加上如下配置 编辑你 Nginx 的配置文件,在 http{} 中加上如下配置
```nginx ```nginx
# http强制跳转到htpps # http强制跳转到htpps
server { server {
@ -54,10 +54,10 @@ server {
`ssl_certificate_key` - SSL 证书路径 `ssl_certificate_key` - SSL 证书路径
<br/> <br/>
## 使用方式 ## 使用方式
:tada:然后执行`systemctl restart nginx`回到nezha将原来的https://api.telegram.org/ 替换为https://yourDomainName/ ,即可正常推送消息 :tada:然后执行 `systemctl restart nginx` 回到 Nezha 将原来的https://api.telegram.org/ 替换为 https://yourDomainName/ ,即可正常推送消息
<br/> <br/>
## 防止盗用 ## 防止盗用
`serverIp`-你监控鸡的ip地址,你系统安装的那个就用那个命令,ufw iptables都可. `serverIp` - Agent 的 ip 地址,你系统安装的哪个就用哪个命令,ufw iptables 都可.
```bash ```bash
#ubuntu #ubuntu
ufw allow proto tcp from serverIp to any port 443 ufw allow proto tcp from serverIp to any port 443