哪吒监控的Dashboard已经添加本地化,支持多个语言,你可以在开发新功能时遵循以下步骤来支持本地化
WARNING
哪吒监控使用 Crowdin 平台翻译文本,请不要直接修改除 zh-CN.toml
以外的toml文件
介绍
- 你可以直接使用
/resource/l10n/zh-CN.toml
中的配置来替换新功能中的文本 - 如果新功能中有新的文本,请将新文本拉取到
zh-CN.toml
中 - 在Pull Request被合并后,你可以前往 Crowdin 平台贡献新文本的翻译
diff --git a/assets/en_US_guide_api.md.d519a59e.js b/assets/en_US_guide_api.md.28a2e5f3.js similarity index 72% rename from assets/en_US_guide_api.md.d519a59e.js rename to assets/en_US_guide_api.md.28a2e5f3.js index fd389c91..c8559428 100644 --- a/assets/en_US_guide_api.md.d519a59e.js +++ b/assets/en_US_guide_api.md.28a2e5f3.js @@ -1,4 +1,4 @@ -import{_ as t,c as o,o as e,d as u}from"./app.9c3473cb.js";const v='{"title":"Create Token","description":"","frontmatter":{},"headers":[{"level":2,"title":"Create Token","slug":"create-token"},{"level":2,"title":"Authentication method","slug":"authentication-method"},{"level":2,"title":"How to use","slug":"how-to-use"}],"relativePath":"en_US/guide/api.md"}',n={},q=u(`
Nezha Monitoring now supports querying the status information of the Agent in the Dashboard using the API
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
Token authentication method:
Request Headers:
+import{_ as t,c as o,o as e,d as u}from"./app.9c3473cb.js";const m='{"title":"Create Token","description":"","frontmatter":{},"headers":[{"level":2,"title":"Create Token","slug":"create-token"},{"level":2,"title":"Authentication method","slug":"authentication-method"},{"level":2,"title":"How to use","slug":"how-to-use"},{"level":2,"title":"Case - Build your own Telegram bot to query server information","slug":"case-build-your-own-telegram-bot-to-query-server-information"}],"relativePath":"en_US/guide/api.md"}',n={},q=u(`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,
@@ -110,4 +110,4 @@ Authorization: Token
}
]
}
-
`,16),a=[q];function i(r,s,d,l,c,p){return e(),o("div",null,a)}var m=t(n,[["render",i]]);export{v as __pageData,m as default};
+
Refer to Community Project (Chinese)
The bot can request server status information from the Dashboard through the API, and then send the information to the user.
You can build this bot to easily view the current status of a given server without opening the Dashboard.
\u54EA\u5412\u9762\u677F\u73B0\u5728\u5DF2\u7ECF\u652F\u6301\u4F7F\u7528API\u63A5\u53E3\u67E5\u8BE2\u9762\u677F\u4E2DAgent\u7684\u72B6\u6001\u4FE1\u606F
\u54EA\u5412\u9762\u677F\u7684API\u63A5\u53E3\u5141\u8BB8\u4F7F\u7528Token\u8BA4\u8BC1\u4E0ECookies\u8BA4\u8BC1
\u8981\u65B0\u5EFA\u4E00\u4E2AToken\uFF0C\u5728\u8FDB\u5165\u7BA1\u7406\u9762\u677F\u540E\uFF0C\u70B9\u51FB\u53F3\u4E0A\u89D2\u7684\u5934\u50CF\uFF0C\u9009\u62E9 \u201CAPI Token\u201D\uFF0C\u8FDB\u5165Token\u7BA1\u7406\u9875\u9762
\u70B9\u51FB \u201C\u6DFB\u52A0Token\u201D\uFF0C\u81EA\u5B9A\u4E49\u5907\u6CE8\u540E\uFF0C\u70B9\u51FB \u201C\u6DFB\u52A0\u201D
\u5982\u9700\u5220\u9664\u4E00\u4E2AToken\uFF0C\u8BF7\u9009\u62E9\u76F8\u5E94\u7684Token\uFF0C\u70B9\u51FB\u53F3\u4FA7\u7684\u5220\u9664\u56FE\u6807
WARNING
Token\u662FAPI\u63A5\u53E3\u7684\u9274\u6743\u5DE5\u5177\uFF0C\u5B83\u5BF9\u4F60\u7684\u9762\u677F\u7684\u4FE1\u606F\u5B89\u5168\u975E\u5E38\u91CD\u8981\uFF0C\u8BF7\u4E0D\u8981\u6CC4\u6F0F\u4F60\u7684Token\u7ED9\u4ED6\u4EBA
Token\u8BA4\u8BC1\u65B9\u5F0F\uFF1A
Request Headers:
+import{_ as t,c as o,o as u,d as q}from"./app.9c3473cb.js";const T='{"title":"\u521B\u5EFAToken","description":"","frontmatter":{},"headers":[{"level":2,"title":"\u521B\u5EFAToken","slug":"\u521B\u5EFAtoken"},{"level":2,"title":"\u8BA4\u8BC1\u65B9\u5F0F","slug":"\u8BA4\u8BC1\u65B9\u5F0F"},{"level":2,"title":"\u4F7F\u7528\u8BF4\u660E","slug":"\u4F7F\u7528\u8BF4\u660E"},{"level":2,"title":"\u4F7F\u7528\u6848\u4F8B - \u81EA\u5EFA\u4E00\u4E2ATG\u673A\u5668\u4EBA\u6765\u67E5\u8BE2\u670D\u52A1\u5668\u4FE1\u606F","slug":"\u4F7F\u7528\u6848\u4F8B-\u81EA\u5EFA\u4E00\u4E2Atg\u673A\u5668\u4EBA\u6765\u67E5\u8BE2\u670D\u52A1\u5668\u4FE1\u606F"}],"relativePath":"guide/api.md"}',n={},e=q(`\u54EA\u5412\u9762\u677F\u73B0\u5728\u5DF2\u7ECF\u652F\u6301\u4F7F\u7528API\u63A5\u53E3\u67E5\u8BE2\u9762\u677F\u4E2DAgent\u7684\u72B6\u6001\u4FE1\u606F
\u521B\u5EFAToken
\u54EA\u5412\u9762\u677F\u7684API\u63A5\u53E3\u5141\u8BB8\u4F7F\u7528Token\u8BA4\u8BC1\u4E0ECookies\u8BA4\u8BC1
\u8981\u65B0\u5EFA\u4E00\u4E2AToken\uFF0C\u5728\u8FDB\u5165\u7BA1\u7406\u9762\u677F\u540E\uFF0C\u70B9\u51FB\u53F3\u4E0A\u89D2\u7684\u5934\u50CF\uFF0C\u9009\u62E9 \u201CAPI Token\u201D\uFF0C\u8FDB\u5165Token\u7BA1\u7406\u9875\u9762
\u70B9\u51FB \u201C\u6DFB\u52A0Token\u201D\uFF0C\u81EA\u5B9A\u4E49\u5907\u6CE8\u540E\uFF0C\u70B9\u51FB \u201C\u6DFB\u52A0\u201D
\u5982\u9700\u5220\u9664\u4E00\u4E2AToken\uFF0C\u8BF7\u9009\u62E9\u76F8\u5E94\u7684Token\uFF0C\u70B9\u51FB\u53F3\u4FA7\u7684\u5220\u9664\u56FE\u6807
WARNING
Token\u662FAPI\u63A5\u53E3\u7684\u9274\u6743\u5DE5\u5177\uFF0C\u5B83\u5BF9\u4F60\u7684\u9762\u677F\u7684\u4FE1\u606F\u5B89\u5168\u975E\u5E38\u91CD\u8981\uFF0C\u8BF7\u4E0D\u8981\u6CC4\u6F0F\u4F60\u7684Token\u7ED9\u4ED6\u4EBA
\u8BA4\u8BC1\u65B9\u5F0F
Token\u8BA4\u8BC1\u65B9\u5F0F\uFF1A
Request Headers:
Authorization: Token
\u4F7F\u7528\u8BF4\u660E
WARNING
\u4E0B\u9762\u793A\u4F8B\u4E2D\u7684\u8D1F\u6570\u65F6\u95F4\u6233\u4E3A\uFF080000-00-00\uFF09
\u76EE\u524D\u8868\u793ADashboard\u4E0A\u7EBF\u540E\u8BE5Agent\u4ECE\u672A\u6C47\u62A5\u8FC7
\u4F46\u4E0D\u5EFA\u8BAE\u7528\u6B63\u8D1F\u6027\u5224\u65AD\u72B6\u6001
TIP
\u8BF7\u6C42\u65B9\u5F0F\u4E3A Get
\uFF0C\u8FD4\u56DE\u683C\u5F0F\u4E3A JSON
- \u83B7\u53D6\u670D\u52A1\u5668\u5217\u8868\uFF1A
GET /api/v1/server/list?tag=
query: tag (ServerTag\u662F\u670D\u52A1\u5668\u7684\u5206\u7EC4\uFF0C\u63D0\u4F9B\u6B64\u53C2\u6570\u5219\u4EC5\u67E5\u8BE2\u8BE5\u5206\u7EC4\u4E2D\u7684\u670D\u52A1\u5668)
JSON\u8FD4\u56DE\u793A\u4F8B\uFF1A
{
"code": 0,
@@ -110,4 +110,4 @@ Authorization: Token
}
]
}
-
`,16),a=[e];function s(r,i,d,l,c,p){return u(),o("div",null,a)}var g=t(n,[["render",s]]);export{T as __pageData,g as default};
+
\u53C2\u8003\u793E\u533A\u9879\u76EE
\u673A\u5668\u4EBA\u53EF\u4EE5\u901A\u8FC7API\u5411\u9762\u677F\u8BF7\u6C42\u670D\u52A1\u5668\u72B6\u6001\u4FE1\u606F\uFF0C\u5F97\u5230\u4FE1\u606F\u540E\u53D1\u9001\u7ED9\u7528\u6237
\u4F60\u53EF\u4EE5\u642D\u5EFA\u6B64\u673A\u5668\u4EBA\u6765\u65B9\u4FBF\u5730\u67E5\u770B\u6307\u5B9A\u670D\u52A1\u5668\u7684\u5F53\u524D\u72B6\u6001\u4E14\u4E0D\u9700\u8981\u6253\u5F00\u9762\u677F
哪吒监控的Dashboard已经添加本地化,支持多个语言,你可以在开发新功能时遵循以下步骤来支持本地化
WARNING
哪吒监控使用 Crowdin 平台翻译文本,请不要直接修改除 zh-CN.toml
以外的toml文件
/resource/l10n/zh-CN.toml
中的配置来替换新功能中的文本zh-CN.toml
中哪吒面板提供了主题开发环境,你可以使用它来创建新的哪吒监控主题
WARNING
请注意: 此开发环境仅支持 dashboard v0.13.16
及更新版本。
data/config.yaml
中的 Oauth2 配置(回调连接可以填 http://localhost
)docker-compose up
theme-custom
放置到服务器上的 /opt/nezha/dashboard/theme-custom
位置80
端口,在 docker-compose.yaml
中修改配置。Nezha Monitoring's Dashboard has added localization to support multiple languages, and you can follow these steps to support localization when developing new features
WARNING
Nezha uses the Crowdin platform to translate text, please do not directly modify the toml files other than zh-CN.toml
.
/resource/l10n/zh-CN.toml
zh-CN.toml
TIP
If you don't understand Chinese at all, you can translate the text using Google or DeepL Translate, and specify in the Pull Request, we will revise the Chinese translation after you add the English translation
Nezha Monitoring provides a theme development environment that you can use to create new Nezha Monitoring themes
WARNING
Please note: This development environment only supports dashboard v0.13.16
and newer versions.
data/config.yaml
(The callback connection can be filled with http://localhost
)docker-compose up
theme-custom
in /opt/nezha/dashboard/theme-custom
on the server80
, change the configuration in docker-compose.yaml
.chmod +x /etc/init.d/nezha-service
/etc/init.d/nezha-service enable && /etc/init.d/nezha-service start
/opt/nezha/agent/nezha-agent --edit-agent-config
to select a custom NIC and partition, and then restart AgentRun ./nezha-agent --help
to view supported flags,if you are already using the one-click script, you can edit /etc/systemd/system/nezha-agent.service
,at the end of this line ExecStart=
add:
--report-delay
System information reporting interval, default is 1 second, can be set to 3 to reduce the system resource usage on the agent side (configuration range 1-4)--skip-conn
Not monitoring the number of connections, if it is a server with a large number of connections, the CPU usage will be high. It is recommended to set this to reduce CPU usage--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 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)There is currently no Docker image for Agent.
The Agent is designed to be the opposite of the Dashboard, in that the Dashboard is designed to work without affecting the server as much as possible, while the Agent needs to execute monitoring services and run commands in the server.
Putting the Agent in a container does continue to execute monitoring services, but features such as WebShell do not work, so we do not provide Docker image of the Agent.
Please check Dashboard - Why the IP displayed in the admin panel and the actual IP of the Agent are not the same?
Please check if your server can connect to Github, try again, or check Other ways to install Agent
Please install sudo first
Nezha Monitoring now supports querying the status information of the Agent in the Dashboard using the API
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
Token authentication method:
Request Headers:
+ Nezha Monitoring 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,
@@ -125,8 +125,8 @@ Authorization: Token
}
]
}
-
-
+
Refer to Community Project (Chinese)
The bot can request server status information from the Dashboard through the API, and then send the information to the user.
You can build this bot to easily view the current status of a given server without opening the Dashboard.
TIP
What is a protocol?
In the browser, your domain name ending with ://
is the protocol, usually http
and https
. Since the Dashboard may be accessible by multiple protocols + domain + port combinations under normal deployment, please make sure to choose the most appropriate one as the callback.
Please make sure the protocol+domain+port displayed by your browser before login and the protocol+domain+port you jump to after login are the same.
Please make sure your path is /oauth2/callback
, all lowercase.
Clear your browser cookies and log in again, or change your browser.
DNS resolution failure, in most cases, is due to iptables-related configuration changes.
It is recommended to restart docker first, sudo systemctl restart docker
, and then use the script to restart the Dashboard.
If the lookup error still occurs, it is recommended to check whether there are other tools to control iptables, such as Aapanel Firewall.
This problem may also be related to the kernel, please try to change the official kernel.
Suggest changing the authentication method to Github/Gitlab.
It may be caused by a number of factors, the most likely is a network problem, we suggest to check the network and retry.
If you can't solve it, we suggest changing the authentication method to Github/Gitlab.
You have logged into the wrong account or configured the wrong username, note that username is not email, you can use a script to modify it.
If the server has network problems, you can restart docker first, sudo systemctl restart docker
, and then use the script to restart the Dashboard.
You can also change to another OAuth method if necessary.
Same as above.
Nezha Monitoring supports monitoring of server load, CPU, memory, hard disk, data transfer, monthly data transfer, number of processes, number of connections, and sends alarm notifications when one of these items reaches a user-set limit.
#NEZHA#
is the panel message placeholder, the panel will automatically replace the placeholder with the actual message when it triggers the notification
The content of Body is in JSON
format:When the request type is FORM,the value is in the form of key:value
,value
can contain placeholders that will be automatically replaced when notified. When the request type is JSON It will only do string substitution and submit to the URL
directly.
Placeholders can also be placed inside the URL, and it will perform a simple string substitution when requested.
Refer to the example below, it is very flexible.
Telegram Example, contributed by @haitau
cpu
、memory
、swap
、disk
net_in_speed
Inbound speed, net_out_speed
Outbound speed, net_all_speed
Inbound + Outbound speed, transfer_in
Inbound Transfer, transfer_out
Outbound Transfer, transfer_all
Total Transferoffline
Offline monitoringload1
、load5
、load15
Loadprocess_count
Number of processes Currently, counting the number of processes takes up too many resources and is not supported at the momenttcp_conn_count
、udp_conn_count
Number of connections[{"type":"offline","duration":10, "cover":0, "ignore":{"5": true}}]
0
Cover all, use ignore
to ignore specific servers1
Ignore all, use ignore
to monitoring specific servers[{"type":"offline","duration":10, "cover":0, "ignore":{"5": true}}]
cover
with server id and boolean, e.g.: {"1": true, "2":false}
Complete examples:
TIP
Add an offline notification
[{"Type":"offline","Duration":10}]
TIP
Add an notification when the CPU exceeds 50% for 10s but the memory usage is below 20% for 20s
[{"Type":"cpu","Min":0,"Max":50,"Duration":10},{"Type":"memory","Min":20,"Max":0,"Duration":20}]
Can be used as monthly transfer notificatin
type
transfer_in_cycle
Inbound transfer during the cycletransfer_out_cycle
Outbound transfer during the cycletransfer_all_cycle
The sum of inbound and outbound transfer during the cyclecycle_start
Start date of the statistical cycle (can be the start date of your server's billing cycle), the time format is RFC3339, for example, the format in Beijing time zone is 2022-01-11T08:00:00.00+08:00
cycle_interval
Interval time cycle (For example, if the cycle is in days and the value is 7, it means that the statistics are counted every 7 days)
cycle_unit
Statistics cycle unit, default hour
, optional (hour
, day
, week
, month
, year
)
min/max
, cover
, ignore
Please refer to the basic rules to configure
Example: The servers with ID 3 and 4 (defined in the ignore
) are counted on the 1st of each month, and a notification is triggered when the monthly outbound transfer reaches 1TB during the cycle. [{"type":"transfer_out_cycle","max":1099511627776,"cycle_start":"2022-01-01T00:00:00+08:00","cycle_interval":1,"cycle_unit":"month","cover":1,"ignore":{"3":true,"4":true}}]
//opt/nezha/agent/nezha-agent -s IP/Domin(Panel IP or Domain not connected to CDN):port(Panel RPC port) -p secret(Agent Secret) -d
Check the logs to see if the timeout is due to a DNS problem or poor networknc -v domain/IP port(Panel RPC port)
or telnet domain/IP port(Panel RPC port)
to check if it' s a network problem, check the inbound and outbound firewall between the local machine and the panel server, if you can' t determine the problem you can check it with the port checking tool provided by https://port.ping.pe//ws
and /terminal
paths, you can click here to see the reverse proxy configurationStop Panel
/opt/nezha
folder to the same path as the new serverLaunch Panel
In the home page, the traffic statistics will be reset when the server is restarted.
If you want to set the traffic statistics to be reset once a month, you can do it like this:
Notification
page of the admin panelService
page, where the statistics will not be reset when the server is restartedTIP
This method can be set to any period, including and not limited to hourly/daily/weekly/monthly/yearly reset transfer statistics, very flexible!
The Servers area is responsible for managing the Agent, the most basic area in Nezha Monitoring, and the basis for other functions.
The first step is to add a servers, which can be customized with names, groups, display index and notes.
Servers in the same group will be displayed in groups in supported themes, and notes will only be displayed in the admin panel, no need to worry about leaking information.
Please refer to the previous article: Install Agent
We recommend using one-click installation, that is, after configuring the communication domain name, click the button on the column one-click installation and copy it to the monitored servers for installation.
The flags related to the update of the Agent are: --disable-auto-update
and --disable-force-update
. Please refer to Customize Agent
By default, the Agent is updated automatically, but when the user turns off automatic updates, the specified servers can also be selected for forced updates.
This feature does not take effect when -disable-force-update
is turned on.
This feature does not take effect when disable-command-execute
is turned on.
Both Linux and Windows are available and can be pasted using Ctrl+Shift+V.
For connection failure, please refer to Real-time channel disconnection/online terminal connection failure.
Note that in theWebShell function, the Agent also connects to the Domain names for public access via WebSocket, not via grpc.
Service area is a function setting area for setting up Agents to monitor external websites or servers
The monitoring results can be viewed on the "Services" page in the home page
To add a new monitor, you can go to the "Services" page in the administration panel and click "Add Service Monitor".
To add a service monitor, you need to complete the following settings:
Name
- Customize a name
Type
- Select a monitoring type. Nezha currently supports three monitoring types: "HTTP-GET", "ICMP-Ping" and "TCP-Ping".
Target
- Depending on the type you choose, the target is set in different ways
HTTP-GET
: Selecting this type, you should enter a URL as the target, the URL should be added withhttp://
orhttps://
If your target URL ishttps://
, it will also monitor the SSL certificate of that URL and trigger a notification when the SSL certificate expires or changes.
For example: https://example.com
ICMP-Ping
: When selecting this type, you should enter a domain name or IP without a port number
For example: 1.1.1.1 or example.com
TCP-Ping
: When selecting this type, you should enter a domain name or IP and include the port number
For example: 1.1.1.1:80 or example.com:22
Interval
: Sets the time interval in seconds between each time Agent sends requests to the target
Coverage
: Select a rule to determine which Agents to use to send requests to the target
Specific Servers
: Use with coverage to select the Agent to be excluded from the rule
Notification Group
: Select the notification method you have set up on the "Notification" page. Click here for more information
Enable Failure Notification
: Select whether to receive target failure notifications as needed, default is inactive
After setting, click "Add" and you are done.
Wait for a moment to go to the "Services" page on the home page to view the monitoring results
To manage existing service monitoring, you can go to the "Services" page in the administration panel
Select a monitoring configuration and click the icon on the right to edit or delete it
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.
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
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 for more information
Send Success Notification
- When this item is activated, a message notification will be triggered when the task is successfully executed
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 immediatelyEdit
- Click to modify the task configurationDelete
- Delete this scheduled tasksource ~/.bashrc
at beginning of your command or execute by absolute path.请查看 Dashboard相关-为什么管理面板中显示的IP和Agent实际IP不一致?
在此不再赘述。
多出现在国内主机中,目前一键脚本只从github直接获取安装脚本,您可以多尝试几次,或者手动安装Agent,别忘了使用镜像。
请先手动安装sudo。
哪吒面板现在已经支持使用API接口查询面板中Agent的状态信息
哪吒面板的API接口允许使用Token认证与Cookies认证
要新建一个Token,在进入管理面板后,点击右上角的头像,选择 “API Token”,进入Token管理页面
点击 “添加Token”,自定义备注后,点击 “添加”
如需删除一个Token,请选择相应的Token,点击右侧的删除图标
WARNING
Token是API接口的鉴权工具,它对你的面板的信息安全非常重要,请不要泄漏你的Token给他人
Token认证方式:
Request Headers:
+ 哪吒监控 哪吒面板现在已经支持使用API接口查询面板中Agent的状态信息
创建Token
哪吒面板的API接口允许使用Token认证与Cookies认证
要新建一个Token,在进入管理面板后,点击右上角的头像,选择 “API Token”,进入Token管理页面
点击 “添加Token”,自定义备注后,点击 “添加”
如需删除一个Token,请选择相应的Token,点击右侧的删除图标
WARNING
Token是API接口的鉴权工具,它对你的面板的信息安全非常重要,请不要泄漏你的Token给他人
认证方式
Token认证方式:
Request Headers:
Authorization: Token
使用说明
WARNING
下面示例中的负数时间戳为(0000-00-00)
目前表示Dashboard上线后该Agent从未汇报过
但不建议用正负性判断状态
TIP
请求方式为 Get
,返回格式为 JSON
- 获取服务器列表:
GET /api/v1/server/list?tag=
query: tag (ServerTag是服务器的分组,提供此参数则仅查询该分组中的服务器)
JSON返回示例:
{
"code": 0,
@@ -125,8 +125,8 @@ Authorization: Token
}
]
}
-
-
+
参考社区项目
机器人可以通过API向面板请求服务器状态信息,得到信息后发送给用户
你可以搭建此机器人来方便地查看指定服务器的当前状态且不需要打开面板
还有其他一些表现形式,总之登录后浏览器无法正常显示。
TIP
什么是协议?
在浏览器中,您的域名以://
结尾的字符串即为协议,通常为 http
和 https
两种。由于正常部署情况下面板可能有多种协议+域名+端口组合均可访问,请务必选一个最合适的作为回调。
请确保登录前浏览器显示的协议+域名+端口和登录后跳转到的协议+域名+端口一致。
请确保您的路径为/oauth2/callback
,全部小写
清理cookies后重新登录,或换个浏览器
容器DNS解析失败,多数情况下为修改了iptables相关配置。
建议先重启docker,sudo systemctl restart docker
,再使用脚本重启面板。
仍然出现lookup错误建议查看是否有其他控制iptables的工具,如宝塔防火墙等。
这个问题也可能与内核有关系,请尝试更换官方内核。
只出现在Gitee登录方式中,原因不明,建议更换到Jihulab。
可能由多种因素引起,最大可能性是网络问题,建议检查网络后重试。
无法解决的话建议更换Github/Jihulab等。
您登陆错了账号或者配置错了用户名,注意用户名不是邮箱,可使用脚本修改。
网络问题,可先重启docker,sudo systemctl restart docker
,再使用脚本重启面板。
如为国内服务器配置Github登陆方式,则建议切换到Jihulab以避免网络干扰。
同上。
哪吒监控支持对服务器的负载、CPU、内存、硬盘、流量、月流量、进程数、连接数进行监控,并在其中某项达到用户设定值时发送报警通知
#NEZHA#
是面板消息占位符,面板触发通知时会自动用实际消息替换占位符
Body 内容是JSON
格式的:当请求类型为 FORM 时,值为 key:value
的形式,value
里面可放置占位符,通知时会自动替换。当请求类型为 JSON 时 只会简单进行字符串替换后直接提交到URL
。
URL 里面也可放置占位符,请求时会进行简单的字符串替换。
你可以参考以下的通知方式示例,也可以根据自己的需求灵活设置推送方式
server酱示例
wxpusher 示例,需要关注你的应用
{"appToken":"你的appToken","topicIds":[],"content":"#NEZHA#","contentType":"1","uids":["你的uid"]}
Telegram 示例 @haitau 贡献
cpu
、memory
、swap
、disk
net_in_speed
入站网速、net_out_speed
出站网速、net_all_speed
双向网速、transfer_in
入站流量、transfer_out
出站流量、transfer_all
双向流量offline
离线监控load1
、load5
、load15
负载process_count
进程数 目前取线程数占用资源太多,暂时不支持tcp_conn_count
、udp_conn_count
连接数0
监控所有,通过 ignore
忽略特定服务器1
忽略所有,通过 ignore
监控特定服务器[{"type":"offline","duration":10, "cover":0, "ignore":{"5": true}}]
cover
使用,内容为服务器id和布尔值,例如:{"1": true, "2":false}
完整示例:
TIP
添加一个离线报警
[{"Type":"offline","Duration":10}]
TIP
添加一个监控 CPU 持续 10s 超过 50% 且 内存持续 20s 占用低于 20% 的报警
[{"Type":"cpu","Min":0,"Max":50,"Duration":10},{"Type":"memory","Min":20,"Max":0,"Duration":20}]
可以用作月流量报警
transfer_in_cycle
周期内的入站流量transfer_out_cycle
周期内的出站流量transfer_all_cycle
周期内双向流量和2022-01-11T08:00:00.00+08:00
hour
,可选(hour
, day
, week
, month
, year
)示例: ID 为 3 和 4 的服务器(ignore 里面定义),以每月 1 号为统计周期,周期内统计的出站月流量达到 1TB 时报警 [{"type":"transfer_out_cycle","max":1099511627776,"cycle_start":"2022-01-01T00:00:00+08:00","cycle_interval":1,"cycle_unit":"month","cover":1,"ignore":{"3":true,"4":true}}]
/opt/nezha/agent/nezha-agent -s 面板IP或非CDN域名:面板RPC端口 -p Agent密钥 -d
查看日志是否是因为 DNS、网络不佳导致超时(timeout)nc -v 域名/IP 面板RPC端口
或者 telnet 域名/IP 面板RPC端口
来检验是否是网络问题,检查本机与面板服务器的出入站防火墙,如果无法判断问题可借助 https://port.ping.pe/ 提供的端口检查工具进行检测。停止面板
/opt/nezha
文件夹,复制到新环境相同位置解压启动面板
主机区域负责管理Agent,是哪吒探针中最基础的区域,也是其他功能的基础。
第一步是添加主机,可以自定义名称、分组、排序和备注。
拥有相同分组的主机会在受支持的主题中划分到一起进行显示,备注仅会在后台显示,无需担心泄露信息。
请参考前文安装Agent
推荐使用一键安装,即配置好参数后,点击主机一键安装列上的按钮,复制到相应主机进行安装。
Agent更新相关的参数是 自定义agent监控项目 中的 --disable-auto-update
和 --disable-force-update
。
默认情况下,Agent会自动更新,无需干预。但当用户关闭自动更新后,也可以选中指定主机进行强制更新。
disable-force-update开启时此功能不生效。
即WebShell,disable-command-execute
开启时此功能不生效。
Linux和Windows均可用,可使用Ctrl+Shift+V粘贴。
连接失败请参考实时通道断开/在线终端连接失败。
注意在线终端功能中,Agent也是通过WebSocket连接到公开访问域名,而非通过grpc交互。
服务区域是设置 Agent 监控外部网站或服务器的功能设置区
设置好的服务监控可以在主页中的 “服务” 页查看监控结果
如需新增一个监控,可以进入管理面板中的 “服务” 页,点击“添加监控”
新增一个服务监控,你需要设置以下参数:
名称
- 自定义一个名称
类型
- 选择一个监控类型,目前哪吒监控支持三种监控类型,分别是 “HTTP-GET”、“ICMP-Ping” 和 “TCP-Ping”
目标
- 根据你选择的类型不同,目标的设置方法也不同
HTTP-GET
: 选择此类型,你应该输入一个URL作为目标,URL需添加http://
或https://
如果你的目标URL是https://
,将会同时监控该URL的SSL证书,当SSL证书到期或发生变更,会触发提醒
例如: https://example.com
ICMP-Ping
: 选择此类型时,你应该输入一个域名或IP,不含端口号
例如:1.1.1.1 或 example.com
TCP-Ping
: 选择此类型时,你应该输入一个域名或IP并包含端口号
例如:1.1.1.1:80 或 example.com:22
请求间隔
: 设定 Agent 每次请求目标的时间间隔,以秒为单位
覆盖范围
: 选择一条规则来确定要使用哪些 Agent 来请求目标
特定服务器
: 配合覆盖范围使用,选择规则内需要排除的 Agent
通知方式组
: 选择你已经在 “报警” 页设置好的通知方式,点击这里了解详情
启用故障通知
: 根据需要选择是否接收目标故障通知,默认为不勾选
设置完成后,点击 “添加” 即可
稍等片刻前往主页的 “服务” 页,查看监控结果
如需对已有的服务监控进行管理,可以前往管理面板中的 “服务” 页
选择一条监控配置,点击右侧的图标进行编辑或删除
在任务区域中,可以设置计划任务,定期任务,多服务器批量执行任务
哪吒监控支持推送命令到 Agent 执行,因此此功能非常灵活,使用此功能可以定期结合 restic、rclone 给服务器备份,或者定期重启某项服务来重置网络连接
进入管理面板的 “任务” 页,点击 “添加计划任务”
添加计划任务你需要填入以下参数:
名称
- 自定义一个任务名称
计划
- 设置计划时间,时间的格式为: * * * * * *
分别对应 秒 分 时 天 月 星期
,详情见计划表达式格式
如:0 0 3 * * *
对应为 每天3点
命令
- 你可以在这里设置需要执行的命令,就像写 Shell/Bat 脚本一样,但是不推荐换行,多个命令使用 &&/&
连接
例如执行定期重启命令,可以在这里输入 reboot
覆盖范围
和 特定服务器
- 跟“服务”页中的设置类似,选择规则来确定哪些 Agent 执行计划任务
通知方式组
- 选择你已经在 “报警” 页设置好的通知方式,点击这里了解详情
推送成功的消息
- 勾选此项,任务执行成功后会触发消息通知
如需对已有的计划任务进行管理,可以前往管理面板中的 “任务” 页
选择一条任务配置,右侧的三个图标,分别是:
立即执行
- 点击后将忽略计划时间,立刻执行任务编辑
- 点击可以修改任务配置删除
- 删除这条计划任务source ~/.bashrc
或者使用绝对路径执行