更新:Agent安装英文文档、API英文文档、设置页英文文档、任务页英文文档、API中文文档

This commit is contained in:
hhhkkk520 2022-05-20 20:13:04 +02:00
parent 9388baa310
commit c6b74042c8
5 changed files with 309 additions and 7 deletions

View File

@ -96,5 +96,5 @@ Run `./nezha-agent --help` to view supported flagsif you are already using th
- `--skip-procs` Disable monitoring the number of processes can also reduce CPU and memory usage
- `--disable-auto-update` Disable **Automatic Update** Agent (security feature)
- `--disable-force-update` Disable **Forced Update** Agent (security feature)
- `--disable-command-execute` Disable execution of scheduled tasks, disallow open online terminals on the Agent side (security feature)
- `--disable-command-execute` Disable execution of scheduled tasks, disallow WebShell (security feature)
- `--tls` Enable SSL/TLS encryption (If you are using nginx to reverse proxy Agent´s grpc connections, and if nginx has SSL/TLS enabled, you need to enable this configuration)

View File

@ -1 +1,150 @@
Comming soon
**Nezha Monitoring now supports querying the status information of the Agent in the Dashboard using the API**
## Create Token
API allows Token authentication method and Cookies authentication method
To create a new Token, after entering the admin panel, click on the avatar in the upper right corner and select "API Token" to enter the Token management page
Click "Add Token" and after customizing the notes, click "Add"
To delete a Token, please select the corresponding Token and click the delete icon on the right
::: warning
Token is the authentication tool of API, it is very important for your Dashboard's information security, please don't leak your Token to others
:::
## Authentication method
Token authentication method:
```
Request Headers:
Authorization: Token
```
## How to use
::: warning
The negative timestamp in the example below is (0000-00-00)
It is currently used to indicate that the Agent has never reported since the Dashboard went live
However, it is not recommended to use positivity or negativity to determine the status
:::
::: tip
**The request method is `Get` and the return format is `JSON`.**
:::
+ Get a list of servers: `GET /api/v1/server/list?tag=`
query: tag (ServerTag means the group of servers, if this value is provided, only the servers in this group are queried)
JSON Return Example:
```
{
"code": 0,
"message": "success",
"result": [
{
"id": 1,
"name": "Server1",
"tag": "Tag1",
"last_active": 1653014667,
"ipv4": "1.1.1.1",
"ipv6": "",
"valid_ip": "1.1.1.1"
},
{
"id": 2,
"name": "Server2",
"tag": "Tag2",
"last_active": -62135596800,
"ipv4": "",
"ipv6": "",
"valid_ip": ""
}
]
}
```
+ Get server details: `GET /api/v1/server/details?id=&tag=`
query: id (ServerID. Multiple IDs are separated by commas, provide this value to query the server corresponding to the ID, while ignoring the tag value)
query: tag (ServerTag, if this value is provided, only the servers in this group are queried)
JSON Return Example:
```
{
"code": 0,
"message": "success",
"result": [
{
"id": 1,
"name": "Server1",
"tag": "Tag1",
"last_active": 1653015042,
"ipv4": "1.1.1.1",
"ipv6": "",
"valid_ip": "1.1.1.1",
"host": {
"Platform": "darwin",
"PlatformVersion": "12.3.1",
"CPU": [
"Apple M1 Pro 1 Physical Core"
],
"MemTotal": 17179869184,
"DiskTotal": 2473496842240,
"SwapTotal": 0,
"Arch": "arm64",
"Virtualization": "",
"BootTime": 1652683962,
"CountryCode": "hk",
"Version": ""
},
"status": {
"CPU": 17.330210772540017,
"MemUsed": 14013841408,
"SwapUsed": 0,
"DiskUsed": 2335048912896,
"NetInTransfer": 2710273234,
"NetOutTransfer": 695454765,
"NetInSpeed": 10806,
"NetOutSpeed": 5303,
"Uptime": 331080,
"Load1": 5.23486328125,
"Load5": 4.873046875,
"Load15": 3.99267578125,
"TcpConnCount": 195,
"UdpConnCount": 70,
"ProcessCount": 437
}
},
{
"id": 2,
"name": "Server2",
"tag": "Tag2",
"last_active": -62135596800,
"ipv4": "",
"ipv6": "",
"valid_ip": "",
"host": {
"Platform": "",
"PlatformVersion": "",
"CPU": null,
"MemTotal": 0,
"DiskTotal": 0,
"SwapTotal": 0,
"Arch": "",
"Virtualization": "",
"BootTime": 0,
"CountryCode": "",
"Version": ""
},
"status": {
"CPU": 0,
"MemUsed": 0,
"SwapUsed": 0,
"DiskUsed": 0,
"NetInTransfer": 0,
"NetOutTransfer": 0,
"NetInSpeed": 0,
"NetOutSpeed": 0,
"Uptime": 0,
"Load1": 0,
"Load5": 0,
"Load15": 0,
"TcpConnCount": 0,
"UdpConnCount": 0,
"ProcessCount": 0
}
}
]
}
```

View File

@ -1 +1,122 @@
settings
## Site Title
You can customize your site title here
<br/>
## Admin List
+ If you have changed your Github/Gitee username, you can change it in this item, otherwise you can't log in, please separate multiple users with commas: `user1,user2`
+ To change your administrator account, please go to `/opt/nezha/dashboard/data/config.yaml` to set the new administrator `Client ID` and `Client Secret`.
<br/>
## Theme
Select the home page theme here, and update the panel if there is not an existing theme in the options
<br/>
## Language
Nezha Monitoring currently supports the following languages:
+ 简体中文
+ English
+ Español
[![Crowdin](https://badges.crowdin.net/nezha/localized.svg)](https://crowdin.com/project/nezha)
We welcome corrections to translations and contributions of additional languages
<br/>
## Custom code (style, script)
Change logo, change color tone, add statistics code, etc.
:::warning
The custom code only takes effect in the visitor's home page, not in the admin panel.
Since the code of different themes is different, if you really need to modify the content of the admin panel, please enter Docker to changes it by yourself.
:::
<br/>
#### Example of changing the default theme progress bar color
```html
<style>
.ui.fine.progress> .bar {
background-color: pink !important;
}
</style>
```
#### Example of modifying DayNight theme progress bar color and footer (by [@hyt-allen-xu](https://github.com/hyt-allen-xu))
```html
<style>
.ui.fine.progress> .progress-bar {
background-color: #00a7d0 !important;
}
</style>
<script>
window.onload = function(){
var footer=document.querySelector("div.footer-container")
footer.innerHTML="©2022 "your name" & Powered by "your name"
footer.style.visibility="visible"
}
</script>
```
#### Example of modifying the logo of the default theme, modifying the footer (by [@iLay1678](https://github.com/iLay1678))
```html
<style>
.right.menu>a{
visibility: hidden;
}
.footer .is-size-7{
visibility: hidden;
}
.item img{
visibility: hidden;
}
</style>
<script>
window.onload = function(){
var avatar=document.querySelector(".item img")
var footer=document.querySelector("div.is-size-7")
footer.innerHTML="Powered by YOUR NAME"
footer.style.visibility="visible"
avatar.src="Your square logo link"
avatar.style.visibility="visible"
}
</script>
```
#### Example of modifying the background image of hotaru theme
```html
<style>
.hotaru-cover {
background: url(https://s3.ax1x.com/2020/12/08/DzHv6A.jpg) center;
}
</style>
```
## Access Password
If you don't want to show your homepage directly, you can set a access password here
After setting the password, you need to enter the password to access the homepage
<br/>
## CDN Bypassed Domain/IP
This setting is a prerequisite for using the one-click script to install the Agent, see [here](/en_US/guide/agent.html#preparation) for details
<br/>
## IP Change Alert
If you want to be notified when a server's ip changes, you can set it up here
#### Coverage
Select a rule here to determine which servers need to be monitored, and you can choose according to your needs
#### Specific Servers
In conjunction with the coverage settings, set the exclusions for the selected rule here
#### Send Notification To Specific Notification Group
Select the notification method, please set the notification method in the "Notifications" page
<br/>
:::warning
**When the settings are completed, the notification takes effect when `enabled` is activated**
:::
<br/>
:::warning
IP Change Alert does not show ip by default, if you don't want to hide it, you can activate "Do NOT desensitize Server IP In Notification Messages"
:::

View File

@ -1 +1,33 @@
tasks
**In the task area, you can set up scheduled tasks, periodic tasks, and multi-server batch execution tasks**
Nezha monitoring supports pushing commands to the Agent for execution, so this feature is very flexible and can be used to periodically back up the server in conjunction with restic, rclone, or periodically restart a service to reset the network connection.
## How to use
Go to the "Tasks" page of the admin panel and click "Add Scheduled Task"
To add a scheduled task you need to make the following settings:
+ `Name` - Customize a task name
+ `Cron Expression` - Set schedule time, the Cron Expression is like: `* * * * * *` `sec min hour day month week`, see details in [CRON Expression Format](https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format)
For example: `0 0 3 * * *` is `Every day at 3 o'clock`
+ `Command` - Just like writing shell/bat scripts, **but line wrap is not recommended**, **Multiple Commands should be connected with `&&/&`**
For example, to execute a periodic reboot command, you can type `reboot` here
+ `Coverage` and `Specific Servers` - Similar to the settings on the Services page, select rules to determine which Agents need to execute scheduled tasks
+ `Notification Group` - Select the notification method you have set up on the "Notification" page. [Click here](/en_US/guide/notifications.html#flexible-notification-methods) for more information
+ `Send Success Notification` - When this item is activated, a message notification will be triggered when the task is successfully executed
<br/>
## Manage tasks
To manage existing scheduled tasks, you can go to the "Tasks" page in the administration panel
Select a task configuration and the three icons on the right, which are:
+ `Execute Now` - When clicked, the scheduled time will be ignored and the task will be executed immediately
+ `Edit` - Click to modify the task configuration
+ `Delete` - Delete this scheduled task
<br/>
## FAQ
1. Command not found
Command not found may cause by missing PATH environment variable, for Linux Server, you may try adding `source ~/.bashrc` at beginning of your command or execute by absolute path.

View File

@ -18,14 +18,14 @@ Authorization: Token
## 使用说明
::: warning
下面示例中的负数时间戳为0000-00-00
目前表示面板上线后该服务器从未汇报过
目前表示Dashboard上线后该Agent从未汇报过
但不建议用正负性判断状态
:::
::: tip
**请求方式为 `Get`,返回格式为 `JSON`**
:::
+ 获取服务器列表:`GET /api/v1/server/list?tag=`
query: tag (ServerTag是服务器的分组提供此参数则仅查询该分组的服务器)
query: tag (ServerTag是服务器的分组提供此参数则仅查询该分组的服务器)
JSON返回示例
```
@ -56,7 +56,7 @@ JSON返回示例
```
+ 获取服务器详情:`GET /api/v1/server/details?id=&tag=`
query: id (ServerID 多个ID以逗号分隔提供此参数则查询该列表对应的服务器同时无视tag参数)
query: id (ServerID 多个ID以逗号分隔提供此参数则查询该ID对应的服务器同时无视tag参数)
query: tag (ServerTag 提供此参数则仅查询该分组下的服务器)
JSON返回示例