Compare commits

...

No commits in common. "main" and "gh-pages" have entirely different histories.

107 changed files with 1 additions and 10145 deletions

View File

@ -1,39 +0,0 @@
name: Pages
on:
push:
branches:
- main # default branch
jobs:
pages:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16.x
uses: actions/setup-node@v2
with:
node-version: "16"
- name: Cache NPM dependencies
uses: actions/cache@v2
with:
path: node_modules
key: ${{ runner.OS }}-npm-cache
restore-keys: |
${{ runner.OS }}-npm-cache
- name: Install Dependencies
run: npm install
- name: Build
run: npm run build
- name: maintaince
run: |
rm -rf ./docs/.vitepress/dist/*
cp index.html ./docs/.vitepress/dist/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./docs/.vitepress/dist
cname: nezha.wiki

13
.gitignore vendored
View File

@ -1,13 +0,0 @@
/coverage
/src/client/shared.ts
/src/node/shared.ts
*.log
.DS_Store
.vite_opt_cache
dist
node_modules
TODOs.md
.vscode
.idea
pnpm-global
docs/.vitepress/cache

0
.nojekyll Normal file
View File

1
CNAME Normal file
View File

@ -0,0 +1 @@
nezha.wiki

View File

@ -1,173 +0,0 @@
# Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International
Creative Commons Corporation (“Creative Commons”) is not a law firm and does not provide legal services or legal advice. Distribution of Creative Commons public licenses does not create a lawyer-client or other relationship. Creative Commons makes its licenses and related information available on an “as-is” basis. Creative Commons gives no warranties regarding its licenses, any material licensed under their terms and conditions, or any related information. Creative Commons disclaims all liability for damages resulting from their use to the fullest extent possible.
### Using Creative Commons Public Licenses
Creative Commons public licenses provide a standard set of terms and conditions that creators and other rights holders may use to share original works of authorship and other material subject to copyright and certain other rights specified in the public license below. The following considerations are for informational purposes only, are not exhaustive, and do not form part of our licenses.
* __Considerations for licensors:__ Our public licenses are intended for use by those authorized to give the public permission to use material in ways otherwise restricted by copyright and certain other rights. Our licenses are irrevocable. Licensors should read and understand the terms and conditions of the license they choose before applying it. Licensors should also secure all rights necessary before applying our licenses so that the public can reuse the material as expected. Licensors should clearly mark any material not subject to the license. This includes other CC-licensed material, or material used under an exception or limitation to copyright. [More considerations for licensors](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensors).
* __Considerations for the public:__ By using one of our public licenses, a licensor grants the public permission to use the licensed material under specified terms and conditions. If the licensors permission is not necessary for any reasonfor example, because of any applicable exception or limitation to copyrightthen that use is not regulated by the license. Our licenses grant only permissions under copyright and certain other rights that a licensor has authority to grant. Use of the licensed material may still be restricted for other reasons, including because others have copyright or other rights in the material. A licensor may make special requests, such as asking that all changes be marked or described. Although not required by our licenses, you are encouraged to respect those requests where reasonable. [More considerations for the public](http://wiki.creativecommons.org/Considerations_for_licensors_and_licensees#Considerations_for_licensees).
## Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
### Section 1 Definitions.
a. __Adapted Material__ means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licensor. For purposes of this Public License, where the Licensed Material is a musical work, performance, or sound recording, Adapted Material is always produced where the Licensed Material is synched in timed relation with a moving image.
b. __Adapter's License__ means the license You apply to Your Copyright and Similar Rights in Your contributions to Adapted Material in accordance with the terms and conditions of this Public License.
c. __BY-NC-SA Compatible License__ means a license listed at [creativecommons.org/compatiblelicenses](http://creativecommons.org/compatiblelicenses), approved by Creative Commons as essentially the equivalent of this Public License.
d. __Copyright and Similar Rights__ means copyright and/or similar rights closely related to copyright including, without limitation, performance, broadcast, sound recording, and Sui Generis Database Rights, without regard to how the rights are labeled or categorized. For purposes of this Public License, the rights specified in Section 2(b)(1)-(2) are not Copyright and Similar Rights.
e. __Effective Technological Measures__ means those measures that, in the absence of proper authority, may not be circumvented under laws fulfilling obligations under Article 11 of the WIPO Copyright Treaty adopted on December 20, 1996, and/or similar international agreements.
f. __Exceptions and Limitations__ means fair use, fair dealing, and/or any other exception or limitation to Copyright and Similar Rights that applies to Your use of the Licensed Material.
g. __License Elements__ means the license attributes listed in the name of a Creative Commons Public License. The License Elements of this Public License are Attribution, NonCommercial, and ShareAlike.
h. __Licensed Material__ means the artistic or literary work, database, or other material to which the Licensor applied this Public License.
i. __Licensed Rights__ means the rights granted to You subject to the terms and conditions of this Public License, which are limited to all Copyright and Similar Rights that apply to Your use of the Licensed Material and that the Licensor has authority to license.
j. __Licensor__ means the individual(s) or entity(ies) granting rights under this Public License.
k. __NonCommercial__ means not primarily intended for or directed towards commercial advantage or monetary compensation. For purposes of this Public License, the exchange of the Licensed Material for other material subject to Copyright and Similar Rights by digital file-sharing or similar means is NonCommercial provided there is no payment of monetary compensation in connection with the exchange.
l. __Share__ means to provide material to the public by any means or process that requires permission under the Licensed Rights, such as reproduction, public display, public performance, distribution, dissemination, communication, or importation, and to make material available to the public including in ways that members of the public may access the material from a place and at a time individually chosen by them.
m. __Sui Generis Database Rights__ means rights other than copyright resulting from Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, as amended and/or succeeded, as well as other essentially equivalent rights anywhere in the world.
n. __You__ means the individual or entity exercising the Licensed Rights under this Public License. __Your__ has a corresponding meaning.
### Section 2 Scope.
a. ___License grant.___
1. Subject to the terms and conditions of this Public License, the Licensor hereby grants You a worldwide, royalty-free, non-sublicensable, non-exclusive, irrevocable license to exercise the Licensed Rights in the Licensed Material to:
A. reproduce and Share the Licensed Material, in whole or in part, for NonCommercial purposes only; and
B. produce, reproduce, and Share Adapted Material for NonCommercial purposes only.
2. __Exceptions and Limitations.__ For the avoidance of doubt, where Exceptions and Limitations apply to Your use, this Public License does not apply, and You do not need to comply with its terms and conditions.
3. __Term.__ The term of this Public License is specified in Section 6(a).
4. __Media and formats; technical modifications allowed.__ The Licensor authorizes You to exercise the Licensed Rights in all media and formats whether now known or hereafter created, and to make technical modifications necessary to do so. The Licensor waives and/or agrees not to assert any right or authority to forbid You from making technical modifications necessary to exercise the Licensed Rights, including technical modifications necessary to circumvent Effective Technological Measures. For purposes of this Public License, simply making modifications authorized by this Section 2(a)(4) never produces Adapted Material.
5. __Downstream recipients.__
A. __Offer from the Licensor Licensed Material.__ Every recipient of the Licensed Material automatically receives an offer from the Licensor to exercise the Licensed Rights under the terms and conditions of this Public License.
B. __Additional offer from the Licensor Adapted Material.__ Every recipient of Adapted Material from You automatically receives an offer from the Licensor to exercise the Licensed Rights in the Adapted Material under the conditions of the Adapters License You apply.
C. __No downstream restrictions.__ You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, the Licensed Material if doing so restricts exercise of the Licensed Rights by any recipient of the Licensed Material.
6. __No endorsement.__ Nothing in this Public License constitutes or may be construed as permission to assert or imply that You are, or that Your use of the Licensed Material is, connected with, or sponsored, endorsed, or granted official status by, the Licensor or others designated to receive attribution as provided in Section 3(a)(1)(A)(i).
b. ___Other rights.___
1. Moral rights, such as the right of integrity, are not licensed under this Public License, nor are publicity, privacy, and/or other similar personality rights; however, to the extent possible, the Licensor waives and/or agrees not to assert any such rights held by the Licensor to the limited extent necessary to allow You to exercise the Licensed Rights, but not otherwise.
2. Patent and trademark rights are not licensed under this Public License.
3. To the extent possible, the Licensor waives any right to collect royalties from You for the exercise of the Licensed Rights, whether directly or through a collecting society under any voluntary or waivable statutory or compulsory licensing scheme. In all other cases the Licensor expressly reserves any right to collect such royalties, including when the Licensed Material is used other than for NonCommercial purposes.
### Section 3 License Conditions.
Your exercise of the Licensed Rights is expressly made subject to the following conditions.
a. ___Attribution.___
1. If You Share the Licensed Material (including in modified form), You must:
A. retain the following if it is supplied by the Licensor with the Licensed Material:
i. identification of the creator(s) of the Licensed Material and any others designated to receive attribution, in any reasonable manner requested by the Licensor (including by pseudonym if designated);
ii. a copyright notice;
iii. a notice that refers to this Public License;
iv. a notice that refers to the disclaimer of warranties;
v. a URI or hyperlink to the Licensed Material to the extent reasonably practicable;
B. indicate if You modified the Licensed Material and retain an indication of any previous modifications; and
C. indicate the Licensed Material is licensed under this Public License, and include the text of, or the URI or hyperlink to, this Public License.
2. You may satisfy the conditions in Section 3(a)(1) in any reasonable manner based on the medium, means, and context in which You Share the Licensed Material. For example, it may be reasonable to satisfy the conditions by providing a URI or hyperlink to a resource that includes the required information.
3. If requested by the Licensor, You must remove any of the information required by Section 3(a)(1)(A) to the extent reasonably practicable.
b. ___ShareAlike.___
In addition to the conditions in Section 3(a), if You Share Adapted Material You produce, the following conditions also apply.
1. The Adapters License You apply must be a Creative Commons license with the same License Elements, this version or later, or a BY-NC-SA Compatible License.
2. You must include the text of, or the URI or hyperlink to, the Adapter's License You apply. You may satisfy this condition in any reasonable manner based on the medium, means, and context in which You Share Adapted Material.
3. You may not offer or impose any additional or different terms or conditions on, or apply any Effective Technological Measures to, Adapted Material that restrict exercise of the rights granted under the Adapter's License You apply.
### Section 4 Sui Generis Database Rights.
Where the Licensed Rights include Sui Generis Database Rights that apply to Your use of the Licensed Material:
a. for the avoidance of doubt, Section 2(a)(1) grants You the right to extract, reuse, reproduce, and Share all or a substantial portion of the contents of the database for NonCommercial purposes only;
b. if You include all or a substantial portion of the database contents in a database in which You have Sui Generis Database Rights, then the database in which You have Sui Generis Database Rights (but not its individual contents) is Adapted Material, including for purposes of Section 3(b); and
c. You must comply with the conditions in Section 3(a) if You Share all or a substantial portion of the contents of the database.
For the avoidance of doubt, this Section 4 supplements and does not replace Your obligations under this Public License where the Licensed Rights include other Copyright and Similar Rights.
### Section 5 Disclaimer of Warranties and Limitation of Liability.
a. __Unless otherwise separately undertaken by the Licensor, to the extent possible, the Licensor offers the Licensed Material as-is and as-available, and makes no representations or warranties of any kind concerning the Licensed Material, whether express, implied, statutory, or other. This includes, without limitation, warranties of title, merchantability, fitness for a particular purpose, non-infringement, absence of latent or other defects, accuracy, or the presence or absence of errors, whether or not known or discoverable. Where disclaimers of warranties are not allowed in full or in part, this disclaimer may not apply to You.__
b. __To the extent possible, in no event will the Licensor be liable to You on any legal theory (including, without limitation, negligence) or otherwise for any direct, special, indirect, incidental, consequential, punitive, exemplary, or other losses, costs, expenses, or damages arising out of this Public License or use of the Licensed Material, even if the Licensor has been advised of the possibility of such losses, costs, expenses, or damages. Where a limitation of liability is not allowed in full or in part, this limitation may not apply to You.__
c. The disclaimer of warranties and limitation of liability provided above shall be interpreted in a manner that, to the extent possible, most closely approximates an absolute disclaimer and waiver of all liability.
### Section 6 Term and Termination.
a. This Public License applies for the term of the Copyright and Similar Rights licensed here. However, if You fail to comply with this Public License, then Your rights under this Public License terminate automatically.
b. Where Your right to use the Licensed Material has terminated under Section 6(a), it reinstates:
1. automatically as of the date the violation is cured, provided it is cured within 30 days of Your discovery of the violation; or
2. upon express reinstatement by the Licensor.
For the avoidance of doubt, this Section 6(b) does not affect any right the Licensor may have to seek remedies for Your violations of this Public License.
c. For the avoidance of doubt, the Licensor may also offer the Licensed Material under separate terms or conditions or stop distributing the Licensed Material at any time; however, doing so will not terminate this Public License.
d. Sections 1, 5, 6, 7, and 8 survive termination of this Public License.
### Section 7 Other Terms and Conditions.
a. The Licensor shall not be bound by any additional or different terms or conditions communicated by You unless expressly agreed.
b. Any arrangements, understandings, or agreements regarding the Licensed Material not stated herein are separate from and independent of the terms and conditions of this Public License.
### Section 8 Interpretation.
a. For the avoidance of doubt, this Public License does not, and shall not be interpreted to, reduce, limit, restrict, or impose conditions on any use of the Licensed Material that could lawfully be made without permission under this Public License.
b. To the extent possible, if any provision of this Public License is deemed unenforceable, it shall be automatically reformed to the minimum extent necessary to make it enforceable. If the provision cannot be reformed, it shall be severed from this Public License without affecting the enforceability of the remaining terms and conditions.
c. No term or condition of this Public License will be waived and no failure to comply consented to unless expressly agreed to by the Licensor.
d. Nothing in this Public License constitutes or may be interpreted as a limitation upon, or waiver of, any privileges and immunities that apply to the Licensor or You, including from the legal processes of any jurisdiction or authority.
> Creative Commons is not a party to its public licenses. Notwithstanding, Creative Commons may elect to apply one of its public licenses to material it publishes and in those instances will be considered the “Licensor.” Except for the limited purpose of indicating that material is shared under a Creative Commons public license or as otherwise permitted by the Creative Commons policies published at [creativecommons.org/policies](http://creativecommons.org/policies), Creative Commons does not authorize the use of the trademark “Creative Commons” or any other trademark or logo of Creative Commons without its prior written consent including, without limitation, in connection with any unauthorized modifications to any of its public licenses or any other arrangements, understandings, or agreements concerning use of licensed material. For the avoidance of doubt, this paragraph does not form part of the public licenses.
>
> Creative Commons may be contacted at creativecommons.org

View File

@ -1,9 +0,0 @@
# nezhahq.github.io
```shell
npm i
npm run dev
```
当你增加文档时,请同步添加其他语言的文档
When you add a new document, please add document in other languages at the same time

View File

@ -1,313 +0,0 @@
import { defineConfig } from 'vitepress'
export default defineConfig({
lastUpdated: true,
lang: 'zh-CN',
head: [
['script', { src: 'https://cdn.wwads.cn/js/makemoney.js', async: 'true' }],
[
'script',
{
async: '',
src: 'https://www.googletagmanager.com/gtag/js?id=G-FDME8GJGTW'
}
],
[
'script',
{},
"window.dataLayer = window.dataLayer || [];\nfunction gtag(){dataLayer.push(arguments);}\ngtag('js', new Date());\ngtag('config', 'G-FDME8GJGTW');"
],
[
'script',
{
async: '',
crossorigin: 'anonymous',
src: 'https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-3632738952115558'
},
],
['link', { rel: 'icon', type: 'image/png', sizes: '193x193', href: '/logo.png' }],
],
locales: {
root: {
lang: 'zh-CN',
label: '简体中文',
title: '哪吒服务器监控',
description: '哪吒监控是一款轻量化的服务器监控和运维工具,提供实时性能监控与告警通知。作为开源项目,它支持企业自托管,保护数据隐私,并支持多语言。哪吒服务器监控安装简便,支持自定义监控项目,可满足不同服务器运维需求。',
link: '/',
themeConfig: {
lastUpdatedText: '上次更新',
editLink: {
pattern: 'https://github.com/nezhahq/nezhahq.github.io/edit/main/docs/:path',
text: '在GitHub中编辑',
},
nav: [
{
text: '使用指南',
link: '/',
activeMatch: '^/$|^/guide/'
},
{
text: '社区项目',
link: '/case/index.html',
activeMatch: '^/case/'
},
{
text: '开发手册',
link: '/developer/index.html',
activeMatch: '^/developer/'
}
],
sidebar: {
'/': getGuideSidebarZhCN(),
'/guide/': getGuideSidebarZhCN(),
'/case/': getCaseSidebarZhCN(),
'/developer/': getDeveloperSidebarZhCN(),
}
}
},
en_US: {
lang: 'en-US',
label: 'English',
title: 'Nezha Server Monitoring',
description: 'Nezha Monitoring is a lightweight server monitoring and maintenance tool that offers real-time performance monitoring and alert notifications. As an open-source project, it supports enterprise self-hosting to protect data privacy and supports multiple languages. Nezha server monitoring is easy to deploy, supports customizable monitoring projects, and meets various server maintenance needs.',
link: '/en_US/',
themeConfig: {
lastUpdatedText: 'Last Updated',
editLink: {
text: 'Edit this page on GitHub',
pattern: 'https://github.com/nezhahq/nezhahq.github.io/edit/main/docs/:path',
},
nav: [
{ text: 'User Guide', link: '/en_US/', activeMatch: '^/en_US/guide/' },
{ text: 'Community Projects', link: '/en_US/case/index.html', activeMatch: '^/en_US/case/' },
{ text: 'Development Manual', link: '/en_US/developer/index.html', activeMatch: '^/en_US/developer/' }
],
sidebar: {
'/en_US/': getGuideSidebarEnUS(),
'/en_US/guide/': getGuideSidebarEnUS(),
'/en_US/case/': getCaseSidebarEnUS(),
'/en_US/developer/': getDeveloperSidebarEnUS(),
},
},
},
},
themeConfig: {
logo: { src: '/logo.png', width: 24, height: 24, alt: 'NezhaLogo'},
socialLinks: [
{ icon: 'github', link: 'https://github.com/nezhahq/nezhahq.github.io' },
{ icon: {svg:'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512"><!--!Font Awesome Free 6.5.2 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2024 Fonticons, Inc.--><path d="M248 8C111 8 0 119 0 256S111 504 248 504 496 393 496 256 385 8 248 8zM363 176.7c-3.7 39.2-19.9 134.4-28.1 178.3-3.5 18.6-10.3 24.8-16.9 25.4-14.4 1.3-25.3-9.5-39.3-18.7-21.8-14.3-34.2-23.2-55.3-37.2-24.5-16.1-8.6-25 5.3-39.5 3.7-3.8 67.1-61.5 68.3-66.7 .2-.7 .3-3.1-1.2-4.4s-3.6-.8-5.1-.5q-3.3 .7-104.6 69.1-14.8 10.2-26.9 9.9c-8.9-.2-25.9-5-38.6-9.1-15.5-5-27.9-7.7-26.8-16.3q.8-6.7 18.5-13.7 108.4-47.2 144.6-62.3c68.9-28.6 83.2-33.6 92.5-33.8 2.1 0 6.6 .5 9.6 2.9a10.5 10.5 0 0 1 3.5 6.7A43.8 43.8 0 0 1 363 176.7z"/></svg>'}, link: 'https://t.me/nezhanews' },
],
search: {
provider: 'algolia',
options:
{
appId: 'HP6QF6KMZD',
apiKey: 'fb8bae9ed373d1057e0c07fcf32b3f1a',
indexName: 'nezhahq',
locales: {
root: {
placeholder: '搜索文档',
translations: {
button: {
buttonText: '搜索文档',
buttonAriaLabel: '搜索文档'
},
modal: {
searchBox: {
resetButtonTitle: '清除查询条件',
resetButtonAriaLabel: '清除查询条件',
cancelButtonText: '取消',
cancelButtonAriaLabel: '取消'
},
startScreen: {
recentSearchesTitle: '搜索历史',
noRecentSearchesText: '没有搜索历史',
saveRecentSearchButtonTitle: '保存至搜索历史',
removeRecentSearchButtonTitle: '从搜索历史中移除',
favoriteSearchesTitle: '收藏',
removeFavoriteSearchButtonTitle: '从收藏中移除'
},
errorScreen: {
titleText: '无法获取结果',
helpText: '你可能需要检查你的网络连接'
},
footer: {
selectText: '选择',
navigateText: '切换',
closeText: '关闭',
searchByText: '搜索提供者'
},
noResultsScreen: {
noResultsText: '无法找到相关结果',
suggestedQueryText: '你可以尝试查询',
reportMissingResultsText: '你认为该查询应该有结果?',
reportMissingResultsLinkText: '点击反馈'
}
}
}
}
}
},
},
footer: {
message: 'This work is licensed under a <a rel="license" href="http://creativecommons.org/licenses/by-nc-sa/4.0/">Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0) License',
copyright: 'Copyright © 2022-present NezhaHQ'
}
}
})
function getGuideSidebarZhCN() {
return [
{
text: '安装手册',
items: [
{ text: '安装 Dashboard', link: '/guide/dashboard.html' },
{ text: '安装 Agent', link: '/guide/agent.html' }
]
},
{
text: '管理面板配置',
items: [
{ text: '服务器', link: '/guide/servers.html' },
{ text: '服务', link: '/guide/services.html' },
{ text: '任务', link: '/guide/tasks.html' },
{ text: '告警', link: '/guide/notifications.html' },
{ text: 'DDNS', link: '/guide/ddns.html' },
{ text: '内网穿透', link: '/guide/nat.html' },
{ text: '设置', link: '/guide/settings.html' },
{ text: 'API', link: '/guide/api.html' }
],
},
{
text: '常见问题',
items: [
{ text: '反向代理 Telegram API', link: '/guide/q1.html' },
{ text: 'Agent 启动/上线 问题自检流程', link: '/guide/q2.html' },
{ text: '反向代理 gRPC 端口', link: '/guide/q3.html' },
{ text: '实时通道断开', link: '/guide/q4.html' },
{ text: '面板数据迁移、备份和恢复', link: '/guide/q5.html' },
{ text: '设置每月重置流量统计', link: '/guide/q6.html' },
{ text: '自定义 Agent 监控项目', link: '/guide/q7.html' },
{ text: '使用 Cloudflare Access 作为 OAuth2 提供方', link: '/guide/q8.html' },
{ text: '启用 GPU 监控', link: '/guide/q9.html' },
{ text: '启用 OIDC 认证', link: '/guide/q10.html' },
{ text: '自定义 IP 地理位置数据库', link: '/guide/q11.html' },
]
},
{
text: '排障指南',
items: [
{ text: 'Dashboard 相关', link: '/guide/dashboardq.html' },
{ text: 'Agent 相关', link: '/guide/agentq.html' },
{ text: '登录相关', link: '/guide/loginq.html' }
]
}
]
}
function getCaseSidebarZhCN() {
return [
{
text: '社区项目',
items: [
{ text: '1. 搭建哪吒 Telegram 机器人', link: '/case/case1.html' },
{ text: '2. 使用 Siri 语音运行快捷指令查询服务器状态', link: '/case/case2.html' },
{ text: '3. 自建多用户多语言 Telegram 服务器状态查询机器人', link: '/case/case3.html' },
{ text: '4. Fake-agent监控数据作弊器', link: '/case/case4.html' },
{ text: '5. 使用 Argo 隧道的哪吒服务端', link: '/case/case5.html' },
{ text: '6. Nezha Mobile - Nezha Dashboard 的 iOS 客户端', link: '/case/case6.html' },
{ text: '7. Broker for Nezha', link: '/case/case7.html' }
]
}
]
}
function getDeveloperSidebarZhCN() {
return [
{
text: '开发手册',
items: [
{ text: '创建新主题', link: '/developer/theme.html' },
{ text: 'l10n', link: '/developer/l10n.html' }
]
}
]
}
function getGuideSidebarEnUS() {
return [
{
text: 'Installation Manual',
items: [
{ text: 'Install Dashboard', link: '/en_US/guide/dashboard.html' },
{ text: 'Install Agent', link: '/en_US/guide/agent.html' }
]
},
{
text: 'Admin Panel',
items: [
{ text: 'Servers', link: '/en_US/guide/servers.html' },
{ text: 'Services', link: '/en_US/guide/services.html' },
{ text: 'Tasks', link: '/en_US/guide/tasks.html' },
{ text: 'Notifications', link: '/en_US/guide/notifications.html' },
{ text: 'DDNS', link: '/en_US/guide/ddns.html' },
{ text: 'NAT traversal', link: '/en_US/guide/nat.html' },
{ text: 'Settings', link: '/en_US/guide/settings.html' },
{ text: 'API', link: '/en_US/guide/api.html' }
]
},
{
text: 'FAQ',
items: [
{ text: 'Agent Startup/Online Troubleshooting Process', link: '/en_US/guide/q2.html' },
{ text: 'Reverse Proxy gRPC Port (Support Cloudflare CDN)', link: '/en_US/guide/q3.html' },
{ text: 'Real-Time Channel Disconnection', link: '/en_US/guide/q4.html' },
{ text: 'Perform Data Migration and Backup Recovery', link: '/en_US/guide/q5.html' },
{ text: 'Reset Traffic Statistics Monthly', link: '/en_US/guide/q6.html' },
{ text: 'Customizing Agent Monitoring Items', link: '/en_US/guide/q7.html' },
{ text: 'Use Cloudflare Access As OAuth2 Provider', link: '/en_US/guide/q8.html' },
{ text: 'Enable GPU monitoring', link: '/en_US/guide/q9.html' },
{ text: 'Enable OIDC authorization', link: '/en_US/guide/q10.html' },
{ text: 'Customize GeoIP database', link: '/en_US/guide/q11.html' },
]
},
{
text: 'Troubleshooting Guide',
items: [
{ text: 'Dashboard', link: '/en_US/guide/dashboardq.html' },
{ text: 'Agent', link: '/en_US/guide/agentq.html' },
{ text: 'Login', link: '/en_US/guide/loginq.html' }
]
}
]
}
function getCaseSidebarEnUS() {
return [
{
text: 'Community Projects',
items: [
{ text: '1. Build your own Telegram bot to query server information', link: '/en_US/case/case1.html' },
{ text: '2. Use Siri to run shortcut to check server status', link: '/en_US/case/case2.html' },
{ text: '3. Self-hosted, multi-user, multi-lingual server status query Telegram bot', link: '/en_US/case/case3.html' },
{ text: '4. Fake-agent, monitoring data cheater', link: '/en_US/case/case4.html' },
{ text: '5. Nezha server over Argo tunnel', link: '/en_US/case/case5.html' },
{ text: '6. Nezha Mobile - An iOS Client For Nezha Dashboard', link: '/en_US/case/case6.html' },
{ text: '7. Broker for Nezha', link: '/en_US/case/case7.html' }
]
}
]
}
function getDeveloperSidebarEnUS() {
return [
{
text: 'Development Manual',
items: [
{ text: 'Create a new theme', link: '/en_US/developer/theme.html' },
{ text: 'l10n', link: '/en_US/developer/l10n.html' }
]
}
]
}

View File

@ -1,159 +0,0 @@
<script lang="ts">
import { defineComponent, ref, onMounted } from 'vue';
import { useData } from 'vitepress';
export default defineComponent({
name: 'BannerComponent',
setup() {
const { site } = useData();
const banner = ref({
link: 'https://t.me/nezhanews',
icon: 'https://nezha.wiki/logo.png',
dashboardVersionApi: 'https://api.github.com/repos/naiba/nezha/releases/latest',
agentVersionApi: 'https://api.github.com/repos/nezhahq/agent/releases/latest',
dashboardVersion: '',
agentVersion: '',
});
onMounted(async () => {
await fetchLatestVersions();
});
const fetchLatestVersions = async () => {
try {
const dashboardResponse = await fetch(banner.value.dashboardVersionApi);
const dashboardData = await dashboardResponse.json();
banner.value.dashboardVersion = dashboardData.tag_name;
} catch (error) {
console.error('Error fetching dashboard latest version:', error);
banner.value.dashboardVersion = 'Error fetching';
}
try {
const agentResponse = await fetch(banner.value.agentVersionApi);
const agentData = await agentResponse.json();
banner.value.agentVersion = agentData.tag_name;
} catch (error) {
console.error('Error fetching agent latest version:', error);
banner.value.agentVersion = 'Error fetching';
}
};
const translations = {
name: {
'en-US': 'Announcement',
'zh-CN': '公告栏',
},
version: {
'en-US': 'Latest Version',
'zh-CN': '最新版本',
},
change: {
'en-US': 'View changelog',
'zh-CN': '查看变更日志',
},
};
return {
banner,
translations,
site,
fetchLatestVersions,
};
},
});
</script>
<template>
<div>
<a :href="banner.link" class="banner" target="_blank">
<img v-if="banner.icon" :src="banner.icon" width="22" height="22" />
<!-- <span class="name">{{ translations.name[site.lang] }}</span> -->
<div class="info">
<p v-if="banner.dashboardVersion !== ''" class="version">Dashboard {{ banner.dashboardVersion }}</p>
<p v-if="banner.agentVersion !== ''" class="version">Agent {{ banner.agentVersion }}</p>
<p class="change">{{ translations.change[site.lang] }}</p>
</div>
</a>
</div>
</template>
<style lang="scss" scoped>
.VPDocAsideSponsors {
margin-top: 8px !important;
}
.banner {
margin: 0.25rem 0;
padding: 0.4rem 0;
border-radius: 0.8rem;
position: relative;
display: flex;
align-items: center;
// height: 5rem;
align-items: center;
justify-content: center;
width: 100%;
gap: 1rem;
background-color: var(--vp-c-bg-soft);
border: 2px solid var(--vp-c-bg-soft);
transition: border-color 0.5s;
&:last-of-type {
margin-bottom: 1rem;
}
&:hover {
border: 2px solid var(--vp-c-brand-1);
}
img {
transition: transform 0.5s;
transform: scale(1.25);
}
&:hover img {
transform: scale(1.75);
}
.name {
background-image: linear-gradient(120deg, var(--vp-c-brand-3) 32%, var(--vp-c-brand-2), var(--vp-c-brand-1));
background-clip: text;
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
font-size: 0.9rem;
font-weight: 600;
margin-left: 1rem;
writing-mode: vertical-rl;
text-orientation: upright;
}
.info {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
flex-grow: 0.5;
height: 100%;
position: relative;
}
.version {
color: var(--vp-c-text-2);
font-size: 0.8rem;
font-weight: 700;
white-space: nowrap;
margin-top: auto;
margin-bottom: auto;
}
.change {
color: var(--vp-c-text-1);
font-size: 0.8rem;
font-weight: 700;
margin-top: auto;
text-align: center;
}
}
</style>

View File

@ -1,15 +0,0 @@
<template>
<div v-if="show" class="wwads-cn wwads-horizontal" data-id="296"></div>
</template>
<script>
export default {
data() {
return {
show: false
}
},
mounted() {
this.show = navigator.userAgent.match(/(iPhone|iPod|Android|ios|iPad)/i) && navigator.language.indexOf('zh') > -1
}
}
</script>

View File

@ -1,15 +0,0 @@
<template>
<div v-if="show" class="wwads-cn wwads-vertical" data-id="296" style="margin-bottom: 20px;"></div>
</template>
<script>
export default {
data() {
return {
show: false
}
},
mounted() {
this.show = navigator.language.indexOf('zh') > -1
}
}
</script>

View File

@ -1,16 +0,0 @@
import { h } from 'vue'
import DefaultTheme from 'vitepress/theme'
import HorizontalAd from './components/HorizontalAd.vue'
import VerticalAd from './components/VerticalAd.vue'
import DocAsideannouncement from './components/DocAsideannouncement.vue'
export default {
...DefaultTheme,
Layout() {
return h(DefaultTheme.Layout, null, {
'doc-top': () => h(HorizontalAd),
'aside-top': () => h(VerticalAd),
'aside-ads-before': () => h(DocAsideannouncement)
})
}
}

View File

@ -1,9 +0,0 @@
# 自建一个TG机器人来查询服务器信息
贡献者:
+ [spiritLHLS](https://github.com/spiritLHLS)
+ [Erope](https://github.com/Erope/)
项目地址:[nezha_api_tgbot](https://github.com/spiritLHLS/nezha_api_tgbot)
机器人可以通过API向面板请求服务器状态信息得到信息后发送给用户
你可以搭建此机器人来方便地查看指定服务器的当前状态且不需要打开面板

View File

@ -1,21 +0,0 @@
# 在iOS/MacOS中使用Siri运行快捷指令查询服务器状态
当前版本V1.0
贡献者:
+ 白歌 [hhhkkk520](https://github.com/hhhkkk520)
## 获取快捷指令
使用iPhone或iPad扫描以下二维码获取快捷指令
<br/>
![coode](/images/case2/qrcode.png)
<br/>
MacOS用户请访问[这里](https://www.icloud.com/shortcuts/312005bf5ffd4387ac92a84056db9f09),获取快捷指令
## 使用说明
+ 获取快捷指令后,打开并编辑快捷指令
+ 分别在三个文本框中填入 `面板URL``API Token``服务器ID`
+ 保存编辑并测试运行,能获取结果则表示设置正确
+ 修改快捷指令的名称如修改为“一号服务器状态”保存后便可使用Siri指令“嘿Siri一号服务器状态”来获取服务器状态
::: warning
每个快捷指令只能监控一台服务器,如需要监控多个服务器,请多次复制此快捷指令并分别配置,然后分别修改快捷指令名称,如;一号服务器状态、二号服务器状态等
:::

View File

@ -1,35 +0,0 @@
# 自建使用 API 来进行查询,且支持多语言的 Telegram 查询机器人
贡献者:
+ [tech-fever](https://github.com/tech-fever)
项目地址:[nezha_telegram_bot](https://github.com/tech-fever/nezha_telegram_bot)
## 项目特色
开源Telegram机器人项目可以基于API实时查询哪吒面板的服务器信息。
- [x] 支持中/英多语言切换
- [x] 支持分组统计(CPU、磁盘、内存、上下行速度、流量统计等)
- [x] 支持实时刷新单个服务器数据
- [x] 支持键盘互动查询
- [x] 支持命令直接查询
- [x] 增加群聊判断,限制群聊可发送命令
- [x] 增加群聊内5秒自动删除信息
- [x] 支持docker部署
## 命令列表
| 命令 | 功能 | 仅私聊 |
| --- | --- | --- |
| start | 开始使用键盘主菜单 | ✔️ |
| help | 帮助列表 | ❌ |
| add | 添加面板链接和token | ✔️ |
| url | 添加面板链接 | ✔️ |
| token | 添加面板token | ✔️ |
| info | 获取保存的面板链接和token | ✔️ |
| delete | 删除保存的面板链接和token | ✔️ |
| id | 命令后面添加整数id来进行单个服务器信息查询私聊带刷新按钮群聊不带 | ❌ |
| all | 查询所有服务器的统计信息 | ❌ |
| search | 在服务器名字中搜索关键字(支持多个,用空格分开) | ❌ |
## 效果展示
![image](https://user-images.githubusercontent.com/105153585/175813727-bef77a8e-ff46-4fd4-b41b-43902abf6159.png#pic_left)
![image](https://user-images.githubusercontent.com/105153585/175813645-4df4f4c7-2591-4133-9645-21c7db2f62ab.png#pic_right)

View File

@ -1,32 +0,0 @@
# 重磅推荐!一秒拥有宇宙级算力!让你在人前,不!再!自!卑
<br/>
---
![2](/images/case4/2.png)
<br/>
<span style="font-size: 5">还在因为自己的小鸡配置太差被朋友嘲笑吗? </span>
<span style="font-size: 5">还在想参加以针会友活动却因为小鸡不够排面而觉得羞耻吗? </span>
<span style="font-size: 5">还在因为在哪吒TG群里机器人排名太低而觉得自己低人一等吗 </span>
<br/>
<span style="font-size: 6">**今天开始!找回自信!**</span>
<br/>
来自南京的名老中医 [dysf888](https://github.com/dysf888) 独家秘方!让你**找回男人本色,激情畅享!**
安装 [Fake Agent](https://github.com/dysf888/fake-nezha-agent),可随意修改服务器监测数据的倍数上传到 Dashboard让你的小鸡 **脱!胎!换!骨!** 让你在 MJJ 面前<span style="font-size: 5"></span>起来!
<br/>
<span style="font-size: 4">**哪吒监控创始人奶爸也在用:**</span>
![5](/images/case4/5.png)
<br/>
<span style="font-size: 4">**男人用了都说好:**</span>
![6](/images/case4/6.png)
![4](/images/case4/4.jpg)
<br/>
---
![1](/images/case4/1.jpeg)

View File

@ -1,262 +0,0 @@
# 使用 Argo 隧道的哪吒服务端
贡献者:
+ [fscarmen](https://github.com/fscarmen2)
项目地址:[Argo-Nezha-Service-Container](https://github.com/fscarmen2/Argo-Nezha-Service-Container)
* * *
## 目录
- [项目特点](case5.md#项目特点)
- [准备需要用的变量](case5.md#准备需要用的变量)
- [Argo 认证的获取方式: json 或 token](case5.md#argo-认证的获取方式-json-或-token)
- [PaaS 部署实例](case5.md#PaaS-部署实例)
- [VPS 部署方式 1 --- docker](case5.md#vps-部署方式-1-----docker)
- [VPS 部署方式 2 --- 宿主机](case5.md#vps-部署方式-2-----宿主机)
- [客户端接入](case5.md#客户端接入)
- [SSH 接入](case5.md#ssh-接入)
- [手动备份数据](case5.md#手动备份数据)
- [自动还原备份](case5.md#自动还原备份)
- [手动还原备份](case5.md#手动还原备份)
- [完美搬家](case5.md#完美搬家)
- [主体目录文件及说明](case5.md#主体目录文件及说明)
- [鸣谢下列作者的文章和项目](case5.md#鸣谢下列作者的文章和项目)
- [免责声明](case5.md#免责声明)
* * *
## 项目特点:
* 适用范围更广 --- 只要能连通网络,就能安装哪吒服务端,如 LXC, OpenVZ VPSNas 虚拟机 , Container PaaS 等
* Argo 隧道突破需要公网入口的限制 --- 传统的哪吒需要有两个公网端口,一个用于面板的访问,另一个用于客户端上报数据,本项目借用 Cloudflare Argo 隧道,使用内网穿透的办法
* IPv4 / v6 具备更高的灵活性 --- 传统哪吒需要处理服务端和客户端的 IPv4/v6 兼容性问题,还需要通过 warp 等工具来解决不对应的情况。然而,本项目可以完全不需要考虑这些问题,可以任意对接,更加方便和简便
* 一条 Argo 隧道分流多个域名和协议 --- 建立一条内网穿透的 Argo 隧道,即可分流三个域名(hostname)和协议(protocal),分别用于面板的访问(http),客户端上报数据(tcp)和 ssh可选
* GrpcWebProxy 反向代理的 gRPC 数据端口 --- 配上证书做 tls 终结,然后 Argo 的隧道配置用 https 服务指向这个反向代理启用http2回源grpc(nezha)->GrpcWebProxy->h2(argo)->cf cdn edge->agent
* 每天自动备份 --- 北京时间每天 4 时 0 分自动备份整个哪吒面板文件夹到指定的 github 私库,包括面板主题,面板设置,探针数据和隧道信息,备份保留近 5 天数据;鉴于内容十分重要,必须要放在私库
* 每天自动更新面板 -- 北京时间每天 4 时 0 分自动检测最新的官方面板版本,有升级时自动更新
* 手/自一体还原备份 --- 每分钟检测一次在线还原文件的内容,遇到有更新立刻还原
* 默认内置本机探针 --- 能很方便的监控自身服务器信息
* 数据更安全 --- Argo 隧道使用TLS加密通信可以将应用程序流量安全地传输到 Cloudflare 网络提高了应用程序的安全性和可靠性。此外Argo Tunnel也可以防止IP泄露和DDoS攻击等网络威胁
<img width="1609" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/4893c3cd-5055-468f-8138-6c5460bdd1e4">
## 准备需要用的变量
* 到 Cloudflare 官网,选择使用的域名,打开 `网络` 选项将 `gRPC` 开关打开
<img width="1590" alt="image" src="https://user-images.githubusercontent.com/92626977/233138703-faab8596-a64a-40bb-afe6-52711489fbcf.png">
* 获取 github 认证授权: https://github.com/settings/applications/new
面板域名加上 `https://` 开头,回调地址再加上 `/oauth2/callback` 结尾
<img width="916" alt="image" src="https://user-images.githubusercontent.com/92626977/231099071-b6676f2f-6c7b-4e2f-8411-c134143cab24.png">
<img width="1122" alt="image" src="https://user-images.githubusercontent.com/92626977/231086319-1b625dc6-713b-4a62-80b1-cc5b2b7ef3ca.png">
* 获取 github 的 PAT (Personal Access Token): https://github.com/settings/tokens/new
<img width="1226" alt="image" src="https://user-images.githubusercontent.com/92626977/233346036-60819f98-c89a-4cef-b134-0d47c5cc333d.png">
<img width="1148" alt="image" src="https://user-images.githubusercontent.com/92626977/233346508-273c422e-05c3-4c91-9fae-438202364787.png">
* 创建 github 用于备份的私库: https://github.com/new
<img width="814" alt="image" src="https://user-images.githubusercontent.com/92626977/233345537-c5b9dc27-35c4-407b-8809-b0ef68d9ad55.png">
## Argo 认证的获取方式: json 或 token
Argo 隧道认证方式有 json 和 token使用两个方式其中之一。推荐前者理由脚本会处理好所有的 Argo 隧道参数和路径,后者需要到 Cloudflare 官网手动设置,容易出错。
### (方式 1 - Json):
#### 通过 Cloudflare Json 生成网轻松获取 Argo 隧道 json 信息: https://fscarmen.cloudflare.now.cc
<img width="893" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/5b734a9d-b4fd-40ca-b7e6-5a1732a53175">
### (方式 2 - Token): 通过 Cloudflare 官网,手动生成 Argo 隧道 token 信息
#### 到 cf 官网https://dash.cloudflare.com/
* 进入 zero trust 里生成 token 隧道和信息。
* 其中数据路径 443/https 为 `proto.NezhaService`
* ssh 路径 22/ssh 为 < client id >
<img width="1672" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/0c467d8b-5fbc-4bde-ac8a-db70ed8798f0">
<img width="1659" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/5aa4df19-f277-4582-8a4d-eef34a00085c">
<img width="1470" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/ec06ec20-a68d-405c-b6de-cd4c52cbd8c0">
<img width="1342" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/538707e1-a17b-4a0f-a8c0-63d0c7bc96aa">
<img width="1020" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/9f5778fd-aa94-4fda-9d85-552b68f6d530">
<img width="1652" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/d0fba15c-f41b-4ee4-bea3-f0506d9b2d23">
<img width="1410" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/228b8e86-32a8-479a-8a86-89ed9b8b5b5e">
## PaaS 部署实例
镜像 `fscarmen/argo-nezha:latest` 支持 amd64 和 arm64 架构
用到的变量
| 变量名 | 是否必须 | 备注 |
| ------------ | ------ | ---- |
| GH_USER | 是 | github 的用户名,用于面板管理授权 |
| GH_CLIENTID | 是 | 在 github 上申请 |
| GH_CLIENTSECRET| 是 | 在 github 上申请 |
| GH_BACKUP_USER | 否 | 在 github 上备份哪吒服务端数据库的 github 用户名,不填则与面板管理授权的账户 GH_USER 一致 |
| GH_REPO | 否 | 在 github 上备份哪吒服务端数据库文件的 github 库 |
| GH_EMAIL | 否 | github 的邮箱,用于备份的 git 推送到远程库 |
| GH_PAT | 否 | github 的 PAT |
| ARGO_AUTH | 是 | Json: 从 https://fscarmen.cloudflare.now.cc 获取的 Argo Json<br> Token: 从 Cloudflare 官网获取 |
| ARGO_DOMAIN | 是 | Argo 域名 |
Koyeb
[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=docker&name=nezha&ports=80;http;/&env[GH_USER]=&env[GH_CLIENTID]=&env[GH_CLIENTSECRET]=&env[GH_REPO]=&env[GH_EMAIL]=&env[GH_PAT]=&env[ARGO_AUTH]=&env[ARGO_DOMAIN]=&image=docker.io/fscarmen/argo-nezha)
<img width="927" alt="image" src="https://user-images.githubusercontent.com/92626977/231088411-fbac3e6e-a8a6-4661-bcf8-7c777aa8ffeb.png">
<img width="750" alt="image" src="https://user-images.githubusercontent.com/92626977/231088973-7134aefd-4c80-4559-8e40-17c3be11d27d.png">
<img width="877" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/8cfdb9ab-5fb6-483f-a382-47aef0d64bea">
<img width="1187" alt="image" src="https://user-images.githubusercontent.com/92626977/231092893-c8f017a2-ee0e-4e28-bee3-7343158f0fa7.png">
<img width="500" alt="image" src="https://user-images.githubusercontent.com/92626977/231094144-df6715bc-c611-47ce-a529-03c43f38102e.png">
## VPS 部署方式 1 --- docker
* 注意: ARGO_DOMAIN= 后面需要有单引号,不能去掉
* 如果 VPS 是 IPv6 only 的,请先安装 WARP IPv4 或者双栈: https://gitlab.com/fscarmen/warp
* 备份目录为当前路径的 dashboard 文件夹
### docker 部署
```
docker run -dit \
--name nezha_dashboard \
--pull always \
--restart always \
-e GH_USER=< github 用户名> \
-e GH_EMAIL=< github 邮箱> \
-e GH_PAT=<填获取的> \
-e GH_REPO=<填自定义的> \
-e GH_CLIENTID=<填获取的> \
-e GH_CLIENTSECRET=<填获取的> \
-e ARGO_AUTH='<填获取的 Argo json 或者 token>' \
-e ARGO_DOMAIN=<填自定义的> \
-e GH_BACKUP_USER=<如与 GH_USER 一致可以不要该环境变量> \
fscarmen/argo-nezha
```
### docker-compose 部署
```
version: '3.8'
services:
argo-nezha:
image: fscarmen/argo-nezha
pull: always
container_name: nezha_dashboard
restart: always
environment:
- GH_USER=< github 用户名>
- GH_EMAIL=<< github 邮箱>
- GH_PAT=<填获取的>
- GH_REPO=<填自定义的>
- GH_CLIENTID=<填获取的>
- GH_CLIENTSECRET=<填获取的>
- ARGO_AUTH='<填获取的 Argo json 或者 token>'
- ARGO_DOMAIN=<填自定义的>
- GH_BACKUP_USER=<如与 GH_USER 一致可以不要该环境变量>
```
## VPS 部署方式 2 --- 宿主机
```
bash <(wget -qO- https://raw.githubusercontent.com/fscarmen2/Argo-Nezha-Service-Container/main/dashboard.sh)
```
## 客户端接入
通过gRPC传输无需额外配置。使用面板给到的安装方式举例
```
curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh install_agent nezha.seales.nom.za 443 eAxO9IF519fKFODlW0 --tls
```
## SSH 接入
* 以 macOS + WindTerm 为例,其他根据使用的 SSH 工具,结合官方官方说明文档: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/use_cases/ssh/#2-connect-as-a-user
* 官方 cloudflared 下载: https://github.com/cloudflare/cloudflared/releases
* 以下输入命令举例:
SSH 用户名: root 密码:<GH_CLIENTSECRET>
```
<file path>/cloudflared access ssh --hostname nezha.seales.nom.za/<GH_CLIENTID>
```
<img width="1180" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/507b037a-25c6-457f-b2b5-d54f4b70a2b6">
<img width="828" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/80284f0b-e2d7-4adb-982a-969aca0cb5f6">
<img width="955" alt="image" src="https://user-images.githubusercontent.com/92626977/233350802-754624e0-8456-4353-8577-1f5385fb8723.png">
## 手动备份数据
方法一: 把 Github 备份库里的 `README.md` 文件内容改为 `backup`
<img width="970" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c5b6bc4b-e69c-48ce-97d4-3f9be88515f3">
方法二: ssh 进去后,容器版本运行 `/dashboard/backup.sh`; 非容器版本运行 `/opt/nezha/dashboard/backup.sh`
## 自动还原备份
* 把需要还原的文件名改到 github 备份库里的 `README.md`,定时服务会每分钟检测更新,并把上次同步的文件名记录在本地 `/dbfile` 处以与在线的文件内容作比对
下图为以还原文件名为 `dashboard-2023-04-23-13:08:37.tar.gz` 作示例
![image](https://user-images.githubusercontent.com/92626977/233822466-c24e94f6-ba8a-47c9-b77d-aa62a56cc929.png)
## 手动还原备份
* ssh 进入容器后运行github 备份库里的 tar.gz 文件名,格式: dashboard-2023-04-22-21:42:10.tar.gz
```
bash /dashboard/restore.sh <文件名>
```
<img width="1209" alt="image" src="https://user-images.githubusercontent.com/92626977/233792709-fb37b79c-c755-4db1-96ec-1039309ff932.png">
## 完美搬家
* 备份原哪吒的 `/dashboard` 文件夹,压缩备份为 `dashboard.tar.gz` 文件
```
tar czvf dashboard.tar.gz /dashboard
```
* 下载文件并放入私库,这个私库名要与新哪吒 <GH_REPO> 完全一致,并把该库的 README.md 的内容编辑为 `dashboard.tar.gz`
* 部署本项目新哪吒,完整填入变量即可。部署完成后,自动还原脚本会每分钟作检测,发现有新的内容即会自动还原,全程约 3 分钟
## 主体目录文件及说明
```
/dashboard/
|-- app # 哪吒面板主程序
|-- argo.json # Argo 隧道 json 文件,记录着使用隧道的信息
|-- argo.yml # Argo 隧道 yml 文件,用于在一同隧道下,根据不同域名来分流 web, gRPC 和 ssh 协议的作用
|-- backup.sh # 备份数据脚本
|-- restore.sh # 还原备份脚本
|-- dbfile # 记录最新的还原或备份文件名
|-- resource # 面板主题、语言和旗帜等资料的文件夹
|-- data
| |-- config.yaml # 哪吒面板的配置,如 Github OAuth2 / gRPC 域名 / 端口 / 是否启用 TLS 等信息
| `-- sqlite.db # SQLite 数据库文件,记录着面板设置的所有 severs 和 cron 等信息
|-- entrypoint.sh # 主脚本,容器运行后执行
|-- nezha.csr # SSL/TLS 证书签名请求
|-- nezha.key # SSL/TLS 证书的私钥信息
|-- nezha.pem # SSL/TLS 证书文件
|-- cloudflared # Cloudflare Argo 隧道主程序
|-- grpcwebproxy # gRPC 反代主程序
`-- nezha-agent # 哪吒客户端,用于监控本地 localhost
```
## 鸣谢下列作者的文章和项目:
* 热心的朝阳群众 Robin讨论哪吒服务端与客户端的关系从而诞生了此项目
* 哪吒官网: https://nezha.wiki/ , TG 群: https://t.me/nezhamonitoring
* 共穷国际老中医: http://solitud.es/
* Akkia's Blog: https://blog.akkia.moe/
* 胡桃's Blog: https://blog.萝莉.org/
* HiFeng's Blog: https://www.hicairo.com/
* 用 Cloudflare Tunnel 进行内网穿透: https://blog.outv.im/2021/cloudflared-tunnel/
* 如何给 GitHub Actions 添加自己的 Runner 主机: https://cloud.tencent.com/developer/article/1756690
* github self-hosted runner 添加与启动: https://blog.csdn.net/sinat_32188225/article/details/125978331
* 如何从Docker镜像中导出文件: https://www.pkslow.com/archives/extract-files-from-docker-image
* grpcwebproxy: https://github.com/improbable-eng/grpc-web/tree/master/go/grpcwebproxy
* Applexad 的哪吒官方改版的面板二进制文件: https://github.com/applexad/nezha-binary-build
## 免责声明:
* 本程序仅供学习了解, 非盈利目的,请于下载后 24 小时内删除, 不得用作任何商业用途, 文字、数据及图片均有所属版权, 如转载须注明来源。
* 使用本程序必循遵守部署免责声明。使用本程序必循遵守部署服务器所在地、所在国家和用户所在国家的法律法规, 程序作者不对使用者任何不当行为负责。

View File

@ -1,29 +0,0 @@
# Nezha Mobile - Nezha Dashboard 的 iOS 客户端
贡献者:
+ [hiDandelion](https://github.com/hiDandelion)
## 为项目作出贡献
[项目地址](https://github.com/hiDandelion/Nezha-Mobile)
::: info
我们欢迎对项目的任何贡献并将积极合并你的修改至下一次的Release但我们可能会对不符合App Review Guidelines的内容或潜在内容进行一些修改。
:::
## 从 App Store 下载
[![Download_on_the_App_Store_Badge_US-UK_RGB_blk_092917](/images/case6/Download_on_the_App_Store_Badge_CNSC_RGB_blk_092917.svg)](https://apps.apple.com/us/app/nezha-mobile/id6596729064)
::: warning
App Store版本的Nezha Mobile由于**ICP备案**原因不在**中国大陆**提供服务。
:::
## TestFlight 测试计划
[加入 TestFlight 测试](https://testflight.apple.com/join/C6vTc2dN)
## 使用说明
+ 首次使用时你需要输入**Dashboard链接**和**API Token**。**Dashboard链接**形如`server.hidandelion.com`,不要添加协议头和末尾斜杠。**API Token**可通过Dashboard管理后台获取。
<img src="/images/case6/1.png" alt="step1" width="200"/>
## 配置小组件(可选)
+ 在Springboard添加小组件长按后点击**编辑小组件**。
<img src="/images/case6/2.png" alt="step2" width="200"/>
+ 在随后的页面中选择一台你需要监控的服务器。你可以为多个小组件配置不同的服务器。
<img src="/images/case6/3.png" alt="step3" width="200"/>

View File

@ -1,40 +0,0 @@
# Broker for Nezha - 拓展 Nezha 接入平台
贡献者:
+ [uubulb](https://codeberg.org/uubulb)
Broker for Nezha 是一个 Nezha Agent 的修改版本,其通过分离 Agent 的数据收集和 gRPC 上报功能,可使小型设备接入 Nezha Dashboard。
项目地址:<https://codeberg.org/uubulb/broker>
文档:[Broker for Nezha](https://broker.kuzu.uk/)
## 与原项目的不同
- 使用外置数据源,而不是从本地获取。
- 多数据源与多面板支持
- 仅支持部分任务类型,可参考项目 README 获取详细信息。
Broker for Nezha 需要与特定的数据收集软件一同使用。目前提供两种数据获取方式:
1. HTTP 主动获取HTTP/1.1
2. TCP 被动获取(推荐)
如需获取现有的数据收集软件,可以参考项目 README。
因数据获取方式缺乏安全性,建议仅在信任的网络环境使用。
## 编写数据收集端
如需自行编写数据收集端,除实现基本 HTTP 服务器或 TCP 客户端外,还需要使用特定的数据格式才可被 Broker 正常接收。具体请参考:[数据类型](https://broker.kuzu.uk/configuration/type/)
## 效果参考
<figure>
<img src="/images/case7/dashboard.jpg" alt="Dashboard">
<figcaption style="font-size: 0.9em; color: gray; text-align: center;">
Dashboard
</figcaption>
</figure>
<br />
<figure>
<img src="/images/case7/webssh.jpg" alt="WebSSH">
<figcaption style="font-size: 0.9em; color: gray; text-align: center;">
WebSSH
</figcaption>
</figure>

View File

@ -1,22 +0,0 @@
---
layout: home
title: 哪吒监控 - 服务器监控与运维工具
titleTemplate: 社区项目
hero:
name: 哪吒监控社区项目
text: 社区贡献的相关项目
tagline: 为哪吒监控提供了更多扩展
image: https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.svg
actions:
- theme: brand
text: 查看项目 →
link: /case/case1
features:
- title: 提交项目
details: 我们欢迎您提交自己的项目请加入TG群联系管理员了解相关事宜
- title: 注意事项
details: 所有项目均由社区成员贡献,请您知悉哪吒监控团队无法为社区项目承担包括且不限于:保修、可用性、安全性等责任
---

View File

@ -1,16 +0,0 @@
---
layout: home
title: 哪吒监控 - 服务器监控与运维工具
titleTemplate: 开发手册
hero:
name: 开发手册
text: 哪吒监控开发手册
tagline: 我们欢迎你提出高质量的Pull Request帮助哪吒监控变得更好
image: https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.svg
actions:
- theme: brand
text: 开始使用 →
link: /developer/theme
---

View File

@ -1,11 +0,0 @@
# l10n 本地化开发指南
**哪吒监控的 Dashboard 已经添加本地化,支持多个语言,你可以在开发新功能时遵循以下步骤来支持本地化**
## 介绍
1. 你可以直接使用 `/resource/l10n/zh-CN.toml` 中已有的文本配置来替换新功能中的文本
2. 如果新功能中有新增文本,请参考 `zh-CN.toml` 的配置文本,将新文本拉取到 `zh-CN.toml` 等其他语言的配置文件中,并添加翻译
## 新本地化文本的添加
1. 在 `/resource/l10n/` 中添加新的语言文本配置
2. 在新的语言文本配置中拉取其他语言已有的文本配置
3. 为新的语言文本配置添加翻译

View File

@ -1,18 +0,0 @@
# 哪吒主题开发环境
哪吒面板提供了主题开发环境,你可以使用它来创建新的哪吒监控主题
::: warning
请注意: 此开发环境仅支持 `dashboard v0.19.20` 及更新版本。
:::
## 使用说明
1. 克隆[此仓库](https://github.com/nezhahq/skeleton-custom-theme)到本地
2. 修改 `data/config.yaml` 中的 Oauth2 配置(回调连接可以填 `http://localhost`
3. 运行 `docker-compose up`
4. 开始开发
5. 主题制作完成之后可以将 `theme-custom`(前台主题)、`static-custom`(前台主题静态文件) 和 `dashboard-custom`(后台主题) 放置到服务器上的 `/opt/nezha/dashboard/` 中(如使用 Docker 安装)
## FAQ
- 如果不能使用 `80` 端口,在 `docker-compose.yaml` 中修改配置。

View File

@ -1,9 +0,0 @@
# Build your own Telegram bot to query server information
Contributors:
+ [spiritLHLS](https://github.com/spiritLHLS)
+ [Erope](https://github.com/Erope/)
**Project**: [nezha_api_tgbot](https://github.com/spiritLHLS/nezha_api_tgbot) (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.

View File

@ -1,21 +0,0 @@
# Use Siri to run shortcut to check server status in iOS/MacOS
Current VersionV1.0 (Chinese)
Contributor:
+ 白歌 [hhhkkk520](https://github.com/hhhkkk520)
## Get shortcut command
Scan the following QR code with your iPhone or iPad to get the shortcut
<br/>
![coode](/images/case2/qrcode.png)
<br/>
MacOS users please visit [here](https://www.icloud.com/shortcuts/312005bf5ffd4387ac92a84056db9f09) to get the shortcut
## How to use
+ After getting the shortcut, open and edit the shortcut
+ Fill in `Dashboard URL`, `API Token`, `Server ID` in the three text boxes
+ Save the edit and test run, if you can get the result, the setting is correct.
+ Modify the name of the shortcut, such as: Server Status, then you can use Siri command: "Hey Siri, Server Status" to get the server status.
::: warning
Each shortcut can only monitor one server, if you need to monitor more than one server, please copy this shortcut several times and configure them separately, then modify the shortcut name separately, such as; Server 1 Status, Server 2 Status, etc.
:::

View File

@ -1,32 +0,0 @@
# Build your own server status query Telegram bot
Contributor:
+ [tech-fever](https://github.com/tech-fever)
GitHub project: [nezha_telegram_bot](https://github.com/tech-fever/nezha_telegram_bot)English is already supported
## Features
- [x] Support Chinese/English multi-language switch
- [x] Support tag statistics (CPU, disk, memory, upstream and downstream speed, traffic statistics, etc.)
- [x] Support real-time refresh of single server data
- [x] Support keyboard interactive query
- [x] Support query by command
- [x] Support adding bot to group, privacy protection of bot replies in group chat
- [x] Support bot messages automatic deletion in group chat within 20 seconds
- [x] Support docker deployment
## Commands list
Command | Description | Private chat only
--- | --- | ---
start | Getting started with the keyboard main menu | ✔️
help | help message | ❌
add | Add Nezha monitoring url link and token | ✔️
url | Add Nezha monitoring url link | ✔️
token | Add Nezha monitoring token | ✔️
info | Get saved Nezha monitoring url link and token | ✔️
delete | Delete saved Nezha monitoring url link and token | ✔️
id | Add an integer id after the command to query the information of a single server (refresh button only available in private chat) | ❌
all | Query statistics for all servers | ❌
search | Search for keywords in server names (multiple keywords supported, split by spaces) | ❌

View File

@ -1,8 +0,0 @@
# Fake-agent, monitoring data cheater
Contributor:
+ [dysf888](https://github.com/dysf888)
GitHub project: [fake-nezha-agent](https://github.com/dysf888/fake-nezha-agent)Chinese
You can modify the monitoring data uploaded to Dashboard by the Agent
Use it for cheating 😈

View File

@ -1,263 +0,0 @@
# Nezha server over Argo tunnel
Contributors:
+ [fscarmen](https://github.com/fscarmen2)
GitHub project: [Argo-Nezha-Service-Container](https://github.com/fscarmen2/Argo-Nezha-Service-Container)
* * * *
## Catalog
- [Project Features](case5.md#project-features)
- [How to get Argo authentication: json or token](case5.md#How-to-get-Argo-authentication-json-or-token)
- [Variables to be used](case5.md#prepare-variables-to-be-used)
- [PaaS Deployment Example](case5.md#paas-deployment-example)
- [VPS Deployment Method 1 --- docker](case5.md#vps-deployment-method-1-----docker)
- [VPS Deployment Method 2 --- hosts](case5.md#vps-deployment-method-2-----hosts)
- [Client Access](case5.md#client-access)
- [SSH Access](case5.md#ssh-access)
- [Manual Backup data](case5.md#manual-backup-data)
- [Auto Restore Backup](case5.md#automatically-restore-backups)
- [Manual Restore Backup](case5.md#manually-restore-the-backup)
- [Migrating data](case5.md#migrating-data)
- [Main Directory Files and Descriptions](case5.md#main-catalog-files-and-descriptions)
- [Acknowledgment of articles and projects by the following authors](case5.md#acknowledgements-for-articles-and-projects-by)
- [Disclaimer](case5.md#disclaimer)
* * *
## Project Features.
* Wider scope of application --- As long as there is a network connection, Nezha server can be installed, such as LXC, OpenVZ VPS, Nas Virtual Machine, Container PaaS, etc.
* Argo tunnel breaks through the restriction of requiring a public network portal --- The traditional Nezha requires two public network ports, one for panel visiting and the other for client reporting, this project uses Cloudflare Argo tunnels and uses intranet tunneling.
* IPv4 / v6 with higher flexibility --- The traditional Nezha needs to deal with IPv4/v6 compatibility between server and client, and also needs to resolve mismatches through tools such as warp. However, this project does not need to consider these issues at all, and can be docked arbitrarily, which is much more convenient and easy!
* One Argo tunnel for multiple domains and protocols --- Create an intranet-penetrating Argo tunnel for three domains (hostname) and protocols, which can be used for panel access (http), client reporting (tcp) and ssh (optional).
* GrpcWebProxy reverse proxy gRPC data port --- with a certificate for tls termination, then Argo's tunnel configuration with https service pointing to this reverse proxy, enable http2 back to the source, grpc(nezha)->GrpcWebProxy->h2(argo)->cf cdn edge->agent
* Daily automatic backup --- every day at 04:00 BST, the entire Nezha panel folder is automatically backed up to a designated private github repository, including panel themes, panel settings, probe data and tunnel information, the backup retains nearly 5 days of data; the content is so important that it must be placed in the private repository.
* Automatic daily panel update -- the latest official panel version is automatically detected every day at 4:00 BST, and updated when there is an upgrade.
* Manual/automatic restore backup --- check the content of online restore file once a minute, and restore immediately when there is any update.
* Default built-in local probes --- can easily monitor their own server information
* More secure data --- Argo Tunnel uses TLS encrypted communication to securely transmit application traffic to the Cloudflare network, improving application security and reliability. In addition, Argo Tunnel protects against network threats such as IP leaks and DDoS attacks.
<img width="1609" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/4893c3cd-5055-468f-8138-6c5460bdd1e4">
## Prepare variables to be used
* Visit the Cloudflare website, select the domain name you want to use, and turn on the `network` option to turn the `gRPC` switch on.
<img width="1605" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/533133dc-ab46-43ff-8eec-0b57d776e4a9">
* Get github authentication license: https://github.com/settings/applications/new
Add `https://` to the beginning of the panel's domain name and `/oauth2/callback` to the end of the callback address.
<img width="1031" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/b3218cca-171d-4869-8ff9-7a569d01234a">
<img width="1023" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c8e6370d-4307-4b88-b490-ce960b694541">
* Get a PAT (Personal Access Token) for github: https://github.com/settings/tokens/new
<img width="1368" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/96b09a43-910c-41c8-b407-1090d81ce728">
<img width="1542" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/b2bf7d3e-2370-4e12-b01d-7cfb9f2d3115">
* Create a private github repository for backups: https://github.com/new
<img width="716" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/499fb58d-9dc7-4b3f-84d7-d709d679ec80">
## How to get Argo authentication: json or token
Argo tunnel authentication methods include json and token, use one of the two methods. The former is recommended because the script will handle all the Argo tunnel parameters and paths, while the latter needs to be set manually on the Cloudflare website and is prone to errors.
### (Methods 1 - Json):
#### Easily get Argo tunnel json information through Cloudflare Json Generation Network: https://fscarmen.cloudflare.now.cc
<img width="862" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/7bf8fefd-328f-43a1-ada6-4472904e8adb">
### (Methods 2 - Token): Manually generate Argo tunnel token information via Cloudflare website.
#### Go to the cf website: https://dash.cloudflare.com/
* Go to zero trust and generate token tunnel and message.
* The data path 443/https is proto.
* ssh path 22/ssh for < client id >.
<img width="1672" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c2952ef2-7a3d-4242-84bc-3cbada1d337c">
<img width="1652" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/89b2b758-e550-413d-aa3e-216d226da7f4">
<img width="1463" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/9f77e26b-a25d-4ff0-8425-1085708e19c3">
<img width="1342" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/538707e1-a17b-4a0f-a8c0-63d0c7bc96aa">
<img width="1020" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/9f5778fd-aa94-4fda-9d85-552b68f6d530">
<img width="1652" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/d0fba15c-f41b-4ee4-bea3-f0506d9b2d23">
<img width="1401" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/ed3d0849-da78-4fd5-9510-d410afc5e6af">
## PaaS Deployment Example
Image `fscarmen/argo-nezha:latest`, supports amd64 and arm64 architectures.
Variables used
| Variable Name | Required | Remarks |
| ------------ | ------ | ---- |
| GH_USER | Yes | github username for panel admin authorization |
| GH_CLIENTID | yes | apply on github |
| GH_CLIENTSECRET | yes | apply on github |
| GH_BACKUP_USER | No | The github username for backing up Nezha's server-side database on github, if not filled in, it is the same as the account GH_USER for panel management authorization |
| GH_REPO | No | The github repository for backing up Nezha's server-side database files on github |
| GH_EMAIL | No | github's mailbox for git push backups to remote repositories |
| GH_PAT | No | github's PAT |
| ARGO_AUTH | Yes | Argo Json from https://fscarmen.cloudflare.now.cc<br>Argo token from Cloudflare official website |
| ARGO_DOMAIN | Yes | Argo domain |
Koyeb
[![Deploy to Koyeb](https://www.koyeb.com/static/images/deploy/button.svg)](https://app.koyeb.com/deploy?type=docker&name=nezha&ports=80;http;/&env[GH_USER]=&env[GH_CLIENTID]=&env[GH_CLIENTSECRET]=&env[GH_REPO]=&env[GH_EMAIL]=&env[GH_PAT]=&env[ARGO_AUTH]=&env[ARGO_DOMAIN]=&image=docker.io/fscarmen/argo-nezha)
<img width="927" alt="image" src="https://user-images.githubusercontent.com/92626977/231088411-fbac3e6e-a8a6-4661-bcf8-7c777aa8ffeb.png">
<img width="1011" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/61fad972-1be9-4e8d-829a-8faea0c8ed64">
<img width="854" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/655c889e-3037-46d7-ab00-3e6085e86f66">
<img width="1214" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/ddabdf3a-ca63-4523-b839-62c4d4c0caf2">
<img width="881" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/e623f92d-878f-4eb8-9dfe-55b59770ba2f">
## VPS Deployment Method 1 --- docker
* Note: ARGO_DOMAIN= must be followed by single quotes, which cannot be removed.
* If the VPS is IPv6 only, please install WARP IPv4 or dual-stack first: https://github.com/fscarmen/warp
* The backup directory is the dashboard folder in the current path.
### docker deployment
```
docker run -dit \
--name nezha_dashboard \
--pull always \
--restart always \
-e GH_USER=<fill in github username> \
-e GH_EMAIL=<fill in github email> \
-e GH_PAT=<fill in the obtained> \
-e GH_REPO=<fill in customized> \
-e GH_CLIENTID=<fill in acquired> \
-e GH_CLIENTSECRET=<fill in acquired> \
-e ARGO_AUTH='<Fill in the fetched Argo json or token>' \
-e ARGO_DOMAIN=<fill in customized> \
-e GH_BACKUP_USER=<If it is consistent with GH_USER, you can leave it blank> \
fscarmen/argo-nezha
```
### docker-compose deployment
```
version: '3.8'
services.
argo-nezha.
image: fscarmen/argo-nezha
--pull always
container_name: nezha_dashboard
restart: always
environment:
- GH_USER=<fill in github username>
- GH_EMAIL=<fill in your github email>
- GH_PAT=<<fill in obtained>
- GH_REPO=<fill in customized>
- GH_CLIENTID=<fill in obtained>
- GH_CLIENTSECRET=<fill in fetched>
- ARGO_AUTH='<Fill in the fetched Argo json or token>'
- ARGO_DOMAIN=<fill in customized>
- GH_BACKUP_USER=<If it is consistent with GH_USER, you can leave it blank>
```
## VPS Deployment Method 2 --- hosts
```
bash <(wget -qO- https://raw.githubusercontent.com/fscarmen2/Argo-Nezha-Service-Container/main/dashboard.sh)
```
## Client Access
Transfer via gRPC, no additional configuration required. Use the installation method given in the panel, for example
```
curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/install_en.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh install_agent data.seales.nom.za 443 eAxO9IF519fKFODlW0 --tls
```
## SSH access
* Take macOS + WindTerm as an example, and other SSH tools depending on the one used, combined with the official documentation: https://developers.cloudflare.com/cloudflare-one/connections/connect-apps/use_cases/ssh /#2-connect-as-a-user
* Official cloudflared download: https://github.com/cloudflare/cloudflared/releases
* The following are examples of input commands.
SSH user: root SSH password<GH_CLIENTSECRET>
```
<filepath>/cloudflared access ssh --hostname ssh.seals.nom.za/<GH_CLIENTID>
```
<img width="1189" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/0aeb3939-51c7-47ac-a7fd-25a8a01d3df5">
<img width="840" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/16961ade-aafc-4132-92a1-aa218e0fead9">
<img width="1201" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/3146b2e2-f988-487f-ab63-00218eb4d570">
## Manually backing up your data
Method 1: Change the contents of the `README.md` file in the Github backup repository to `backup`
<img width="970" alt="image" src="https://github.com/fscarmen2/Argo-Nezha-Service-Container/assets/92626977/c5b6bc4b-e69c-48ce-97d4- 3f9be88515f3">
Method 2: After ssh, run `/dashboard/backup.sh` for container version; `/opt/nezha/dashboard/backup.sh` for VPS host version.
## Automatically restore backups
* Change the name of the file to be restored to `README.md` in the github backup repository, the timer service will check for updates every minute and record the last synchronized filename in the local `/dbfile` to compare with the online file content.
The following is an example of restoring a file with the name `dashboard-2023-04-23-13:08:37.tar.gz`.
! [image](https://user-images.githubusercontent.com/92626977/233822466-c24e94f6-ba8a-47c9-b77d-aa62a56cc929.png)
## Manually restore the backup
* ssh into the container and run, tar.gz filename from the github backup repository, format: dashboard-2023-04-22-21:42:10.tar.gz
```
bash /dashboard/restore.sh <filename>
```
<img width="1209" alt="image" src="https://user-images.githubusercontent.com/92626977/233792709-fb37b79c-c755-4db1-96ec-1039309ff932.png">
## Migrating data
* Backup the `/dashboard` folder of the original Nezha and zip it up to `dashboard.tar.gz` file.
```
tar czvf dashboard.tar.gz /dashboard
```
* Download the file and put it into a private repository, the name of the repository should be exactly the same as <GH_REPO>, and edit the contents of README.md of the repository to `dashboard.tar.gz`.
* Deploy the new Nezha in this project, and fill in the variables completely. After the deployment is done, the auto-restore script will check every minute, and will restore automatically if it finds any new content, the whole process will take about 3 minutes.
## Main catalog files and descriptions
```
/dashboard/
|-- app # Nezha panel main program
|-- argo.json # Argo tunnel json file, which records information about using the tunnel.
|-- argo.yml # Argo tunnel yml file, used for streaming web, gRPC and ssh protocols under a single tunnel with different domains.
|-- backup.sh # Backup data scripts
|-- restore.sh # Restore backup scripts
|-- dbfile # Record the name of the latest restore or backup file
|-- resource # Folders of information on panel themes, languages, flags, etc.
|-- data
| |-- config.yaml # Configuration for the Nezha panel, e.g. Github OAuth2 / gRPC domain / port / TLS enabled or not.
| `-- sqlite.db # SQLite database file that records all severs and cron settings for the panel.
|-- entrypoint.sh # The main script, which is executed after the container is run.
|-- nezha.csr # SSL/TLS certificate signing request
|-- nezha.key # Private key information for SSL/TLS certificate.
|-- nezha.pem # SSL/TLS certificate file.
|-- cloudflared # Cloudflare Argo tunnel main program.
|-- grpcwebproxy # gRPC reverse proxy main program.
`-- nezha-agent # Nezha client, used to monitor the localhost.
```
## Acknowledgements for articles and projects by
* Robin, an enthusiastic sunrise crowd, for discussing the relationship between Nezha's server and client, which led to the birth of this project.
* Nezha website: https://nezha.wiki/ , TG Group: https://t.me/nezhamonitoring
* Common Poverty International Old Chinese Medicine: http://solitud.es/
* Akkia's Blog: https://blog.akkia.moe/
* Ayaka's Blog: https://blog.xn--pn1aul.org/
* HiFeng's Blog: https://www.hicairo.com/
* Intranet Penetration with Cloudflare Tunnel: https://blog.outv.im/2021/cloudflared-tunnel/
* How to add your own Runner host to GitHub Actions: https://cloud.tencent.com/developer/article/1756690
* github self-hosted runner addition and startup: https://blog.csdn.net/sinat_32188225/article/details/125978331
* How to export a file from a Docker image: https://www.pkslow.com/archives/extract-files-from-docker-image
* grpcwebproxy: https://github.com/improbable-eng/grpc-web/tree/master/go/grpcwebproxy
* Applexad's binary of Nezha's officially dashboard: https://github.com/applexad/nezha-binary-build
## Disclaimer
* This program is only for learning and understanding, non-profit purposes, please delete within 24 hours after downloading, not for any commercial purposes, text, data and images are copyrighted, if reproduced must indicate the source.
* Use of this program is subject to the deployment disclaimer. Use of this program must follow the deployment of the server location, the country and the user's country laws and regulations, the author of the program is not responsible for any misconduct of the user.

View File

@ -1,29 +0,0 @@
# Nezha Mobile - An iOS Client For Nezha Dashboard
Contributor:
+ [hiDandelion](https://github.com/hiDandelion)
## Contribute to the project
[Project Link](https://github.com/hiDandelion/Nezha-Mobile)
::: info
We appreciate any contribution to the project, and we will actively merge your commits into next Release. However, we may modify your work in order to comply with App Review Guidelines.
:::
## Download on the App Store
[![Download_on_the_App_Store_Badge_US-UK_RGB_blk_092917](/images/case6/Download_on_the_App_Store_Badge_US-UK_RGB_blk_092917.svg)](https://apps.apple.com/us/app/nezha-mobile/id6596729064)
::: warning
Due to **ICP Filing Policy**, Nezha Mobile is not available in **China mainland**.
:::
## TestFlight Testing Program
[Join TestFlight Testing](https://testflight.apple.com/join/C6vTc2dN)
## Instructions
+ Enter your Dashboard link like `server.hidandelion.com` and API token on your first use. Do not add a protocol prefix or a trailing slash to the link. API Token can be retrieved from Admin Center of Dashboard.
<img src="/images/case6/1_en_US.png" alt="step1" width="200"/>
## Configure Widget(Optional)
+ Add a widget on your Springboard. Long-tap the widget and then tap **Edit Widget**.
<img src="/images/case6/2_en_US.png" alt="step2" width="200"/>
+ Choose a server you want to monitor on the next view. You can choose different servers for each widget.
<img src="/images/case6/3_en_US.png" alt="step3" width="200"/>

View File

@ -1,38 +0,0 @@
# Broker for Nezha - Advancing on more platforms
Contributor:
+ [uubulb](https://codeberg.org/uubulb)
Broker for Nezha is a modified version of the Nezha Agent that separates data collection from gRPC reporting, enabling small devices to connect to the Nezha Dashboard.
Project link: <https://codeberg.org/uubulb/broker>
Online Documentation: [Broker for Nezha](https://broker.kuzu.uk/)
## Difference from Nezha Agent
- Utilizes external data sources to report to **Nezha Dashboard**.
- Supports configuring multiple sources and connecting to multiple Dashboards.
- Only has limited task support. For details, view the project README.
Broker for Nezha needs to be used with specific data collection software. Currently, it provides two data collection methods:
1. HTTP (HTTP/1.1) - Active polling
2. TCP - Passive collection (recommended to avoid creating redundant connections)
For existing data collection software, refer to the project README. Due to security concerns, it's recommended to use this only in a trusted network.
## Writing a Data Collector
If you need to write your own data collector, you'll need to implement a basic HTTP server or TCP client and use a specific data format that Broker can recognize. For details, see: [Data types](https://broker.kuzu.uk/en/configuration/type/)
## Examples
<figure>
<img src="/images/case7/dashboard.jpg" alt="Dashboard">
<figcaption style="font-size: 0.9em; color: gray; text-align: center;">
Dashboard
</figcaption>
</figure>
<br />
<figure>
<img src="/images/case7/webssh.jpg" alt="WebSSH">
<figcaption style="font-size: 0.9em; color: gray; text-align: center;">
WebSSH
</figcaption>
</figure>

View File

@ -1,22 +0,0 @@
---
layout: home
title: Nezha Monitoring - Server monitoring tool
titleTemplate: Community Project
hero:
name: Nezha Monitoring
text: Community Project
tagline: Nezha Monitoring has benefited from various projects contributed by the community, which have provided it with additional extensions.
image: https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.svg
actions:
- theme: brand
text: Learn More →
link: /en_US/case/case1
features:
- title: Submit a project
details: We welcome you to submit your own project. Please join the Telegram group to contact the administrator for further information.
- title: Important Notes
details: All projects are contributed by community members. Please be aware that the Nezha Monitoring Team cannot assume responsibility for community projects, including but not limited to warranty, availability, security, etc.
---

View File

@ -1,15 +0,0 @@
---
layout: home
title: Nezha Monitoring - Server monitoring tool
titleTemplate: Development Manual
hero:
name: Development Manual
text: Nezha Monitoring Development Manual.
image: https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.svg
actions:
- theme: brand
text: Start Now →
link: /en_US/developer/theme
---

View File

@ -1,11 +0,0 @@
# Localization
**Nezha Monitoring's Dashboard has added localization to support multiple languages, and you can follow these steps to support localization when developing new features**
## Introduction
1. You can directly use the text configuration already available in `/resource/l10n/en-US.toml` to replace the text in the new feature.
2. If there is new text in the new feature, please refer to the configuration text in `en-US.toml`, pull the new text into the configuration files of other languages such as `en-US.toml`, and add translations.
## Adding a new localized text file
1. Add a new language text configuration in `/resource/l10n/`.
2. Pull existing text configurations from other languages in the new language text configuration.
3. Add translations for the new language text configuration.

View File

@ -1,18 +0,0 @@
# Nezha Theme Development Environment
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.19.20` and newer versions.
:::
## How to use
1. Clone [this repository](https://github.com/nezhahq/skeleton-custom-theme) to local
2. Modify the Oauth2 configuration in `data/config.yaml`The callback connection can be filled with `http://localhost`
3. Run `docker-compose up`
4. Start development
5. After completing the theme creation, you can place `theme-custom` (frontend theme), `static-custom` (frontend theme static files), and `dashboard-custom` (backend theme) into the `/opt/nezha/dashboard/` directory on the server (if installed using Docker).
## FAQ
- If you can't use port `80`, change the configuration in `docker-compose.yaml`.

View File

@ -1,347 +0,0 @@
---
outline: deep
---
# Install Agent
**This document will introduce how to install the Agent on the monitored server and connect it to the Dashboard.**
::: tip
The repository for Agent binaries can be found at: <https://github.com/nezhahq/agent/releases>
:::
## One-Click Installation of the Agent
Nezha Monitoring supports one-click installation of the Agent on both Windows and Linux. By following the steps in this document, you can easily deploy it on your server.
### Preparation
You need to set up a communication domain in the admin panel in advance, and this domain should not be connected to a CDN. This document uses the example communication domain “data.example.com”.
Go to the settings page in the admin panel, fill in the communication domain in the “Non-CDN Dashboard Server Domain/IP” field, and click "Save".
### One-Click Installation on Linux
1. First, add a server in the admin panel.
2. Click the green Linux icon button next to the newly added server and copy the one-click installation command.
3. Run the copied installation command on the monitored server, and wait for the installation to complete. Then, check if the server is online in the Dashboard home page.
### One-Click Installation on macOS
1. First, add a server in the admin panel.
2. Click the green Apple icon button next to the newly added server and copy the one-click installation command.
3. Run the copied installation command on the monitored server, and wait for the installation to complete. Then, check if the server is online in the Dashboard home page.
### One-Click Installation on Windows
1. First, add a server in the admin panel.
2. Click the green Windows icon button next to the newly added server and copy the one-click installation command.
3. Go to the Windows server, run PowerShell, and execute the copied installation command in PowerShell.
4. If you encounter a prompt to "change execution policy," choose Y.
5. Wait for the installation to complete, then check if the server is online in the Dashboard home page.
::: warning
If you encounter errors when running the one-click installation command in PowerShell, try the **Manual Installation of the Agent on Windows** below.
:::
## Other Ways to Install the Agent
### Installing the Agent on Linux (Support most distros)
<details>
<summary>Click to expand/collapse</summary>
1. First, add a server in the admin panel.
2. Run the script on the monitored server:
```bash
curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/install_en.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
```
1. Select “Install monitoring Agent.”
2. Enter the communication domain, such as "data.example.com".
3. Enter the dashboard communication port (gRPC port), default is 5555.
4. Enter the Agent secret, which is generated when you add a server in the admin panel and can be found on the “Servers” page in the admin panel.
5. Wait for the installation to complete, then check if the server is online in the Dashboard home page.
</details>
### Installing the Agent using the built-in service command (Support most systems)
<details>
<summary>Click to expand/collapse</summary>
First, get a copy of Nezha Agent: https://github.com/nezhahq/agent/releases
After extracting the archive, run the following command to install the service (may require root permission):
```bash
./nezha-agent service install -s server_name:port -p password
```
You can also add other arguments except the server address and password. For more details, refer to the documentation: [Customizing Agent Monitoring Items](/en_US/guide/q7.html).
Uninstall the service:
```bash
./nezha-agent service uninstall
```
Start the service:
```bash
./nezha-agent service start
```
Stop the service:
```bash
./nezha-agent service stop
```
Restart the service:
```bash
./nezha-agent service restart
```
</details>
### Installing the Agent with runit
<details>
<summary>Click to expand/collapse</summary>
The built-in service command of Agent supports most init systems, including FreeBSD rc.d and openrc, but still missing some of them.
Here we take Void Linux's runit as an example:
1. Create directory `/etc/sv/nezha-agent`:
```bash
mkdir /etc/sv/nezha-agent
```
2. Create service file `/etc/sv/nezha-agent/run`, with following content:
```bash
#!/bin/sh
exec 2>&1
exec /opt/nezha/agent/nezha-agent -s server_name:port -p password 2>&1
```
You can add other arguments here as well.
3. Create logging service file `/etc/sv/nezha-agent/log/run`:
```bash
#!/bin/sh
exec vlogger -t nezha-agent -p daemon
```
4. Enable the service:
```bash
sudo ln -s /etc/sv/nezha-agent/ /var/service
```
Use the `sv` command to manage the service.
How to view logs:
1. Install `socklog` and enable it:
```bash
sudo xbps-install -S socklog-void
sudo ln -s /etc/sv/socklog-unix /var/service
```
2. Run `svlogtail`:
```bash
sudo svlogtail | grep nezha-agent
```
</details>
### Manual Installation of the Agent on Windows
* Refer to the community article:
[Nezha - Windows Client Installation](https://nyko.me/2020/12/13/nezha-windows-client.html) (Chinese)
### Installing the Agent on Synology DSM
<details>
<summary>Click to expand/collapse</summary>
* Refer to community articles:
[Installing Nezha Monitoring Agent on Synology DSM 7.x](https://blog.mitsea.com/3929551d08bd4bb0a8baa453e2d92b0c/) (Chinese)
[Nezha - Synology Client (Agent) Installation Tutorial](https://wl.gta5pdx.cn/archives/546/) (Chinese)
* Using Systemd *for DSM7 only*:
```sh
# Agent path
EXEC="/PATH/TO/nezha-agent"
# Log path
LOG="${EXEC}.log"
# Additional execution parameters, can be empty
ARGS=""
# Nezha server gRPC address
SERVER="HOST_OR_IP:gRPC_PORT"
# The secret key obtained in the previous step
SECRET="APP_SECRET"
# User running the service, *strongly recommended to use non-root user*
RUN_USER="nezha"
# Write to systemd service file
cat << EOF > /usr/lib/systemd/system/nezha.service
[Unit]
Description=Nezha Agent Service
After=network.target
[Service]
Type=simple
ExecStart=/bin/nohup ${EXEC} ${ARGS} -s ${SERVER} -p ${SECRET} &>> ${LOG} &
ExecStop=ps -fe |grep nezha-agent|awk '{print \$2}'|xargs kill
User=${RUN_USER}
Restart=on-abort
[Install]
WantedBy=multi-user.target
EOF
# Reload service
systemctl daemon-reload
# Start service
systemctl start nezha
# Enable service startup
systemctl enable nezha
```
‼️ Modify the corresponding information before running the above commands with the `root` account to complete the installation.
</details>
### Installing the Agent on macOS Using Homebrew
<details>
<summary>Click to expand/collapse</summary>
***This section is adapted from [🐿️松鼠收集🌰](https://blog.mre.red/archives/install_nezha_monitoring_agent_service_with_homebrew) with the author's permission***
::: warning
Please be sure to add environment variables before installing nezha-agent through Homebrew!
Homebrew creates the service-required plist file during software installation, and if you add the environment variables after installation, it will fail to start due to missing parameters.
:::
1. Add environment variables:
```shell
echo 'export HOMEBREW_NEZHA_AGENT_PASSWORD="Communication key, obtained from the service page"' >> ~/.zshrc
echo 'export HOMEBREW_NEZHA_AGENT_SERVER="Your server and port, format your.domain:5555 "' >> ~/.zshrc
source ~/.zshrc
```
2. Install Nezha Agent:
::: danger
Note that this Homebrew repository is maintained by a third party and is unrelated to Nezha Monitoring.
The Nezha project team does not endorse this repository's usability, security, etc. Please evaluate the risks yourself before using!
:::
Since it has not yet been submitted to the Homebrew Core official library, it is temporarily placed in the [third-party Homebrew repository](https://github.com/Brewforge/homebrew-chinese) maintained by the author of the blog:
```shell
brew install brewforge/chinese/nezha-agent
```
3. Start Nezha Agent service through Homebrew:
```shell
brew services start nezha-agent
```
4. Check the service status:
```shell
brew services info nezha-agent
```
5. Stop the service:
```shell
brew services stop nezha-agent
```
6. Uninstall Nezha Agent:
```shell
brew rm nezha-agent
```
7. If there is an error, first check the environment variables:
```shell
echo $HOMEBREW_NEZHA_AGENT_PASSWORD
echo $HOMEBREW_NEZHA_AGENT_SERVER
```
8. If the environment variables are configured correctly, try reinstalling:
```shell
brew services stop nezha-agent
brew reinstall nezha-agent
brew services start nezha-agent
```
9. If the issue persists, submit a issue to the [third-party Homebrew repository](https://github.com/Brewforge/homebrew-chinese).
</details>
### Installing the Agent on OpenWRT
<details>
<summary>Click to expand/collapse</summary>
**How to solve installation difficulties and issues in one step?**
* Refer to the project:
[NZ-OpenWrt](https://github.com/dysf888/NZ-OpenWrt)
**How to enable autostart on older OpenWRT/LEDE?**
* Refer to the project:
[Nezha Monitoring for OpenWRT](https://github.com/Erope/openwrt_nezha)
**How to enable autostart on newer OpenWRT? Contributor: @艾斯德斯**
* First, download the corresponding binary from the release, unzip the zip package, and place it in `/root`.
* Run `chmod +x /root/nezha-agent` to grant execution permission, then create `/etc/init.d/nezha-service`:
```shell
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command /root/nezha-agent -s Dashboard communication domain:port -p Key -d
procd_set_param respawn
procd_close_instance
}
stop_service() {
killall nezha-agent
}
restart() {
stop
sleep 2
start
}
```
* Run `chmod +x /etc/init.d/nezha-service` to grant execution permission.
* Start the service: `/etc/init.d/nezha-service enable && /etc/init.d/nezha-service start`
</details>
## Does the Agent Have a Docker Image?
**The Agent does not currently have a Docker image.**
The design philosophy of the Agent is opposite to that of the Dashboard. While the Dashboard should minimally impact the server, the Agent needs to execute monitoring services and run commands within the server.
Running the Agent inside a container can still perform monitoring tasks, but features like WebShell will not function properly, so no Docker image is provided.

View File

@ -1,23 +0,0 @@
---
outline: deep
---
# Frequently Asked Questions about the Agent
## The IP Displayed in the Admin Panel is Different from the Actual Agent IP?
Please refer to [Dashboard Related - Why is the IP Displayed in the Admin Panel Different from the Actual Agent IP?](/en_US/guide/dashboardq.html#why-is-the-ip-displayed-in-the-admin-panel-different-from-the-actual-agent-ip). This will not be repeated here.
## Errors During One-Click Script Installation
### curl: Failed to connect to raw.githubusercontent.com......
This mostly occurs on servers in mainland China. Currently, the one-click script fetches the installation script directly from Github. You may try several times, or [manually install the Agent](/en_US/guide/agent.html#other-ways-to-install-agent). Additionally, you can find third-party Github acceleration services or mirrors and set them in the one-click installation script.
### sudo: command not found
Please manually install sudo first, for example, in Ubuntu:
```shell
apt install sudo
```

View File

@ -1,389 +0,0 @@
---
outline: deep
---
# API Interface
**Nezha Monitoring supports querying the status information of Agents using the API interface**
## Creating a Token
Nezha Monitoring's API interface allows for Token authentication and Cookies authentication. To create a new Token, go to the admin panel, click on the avatar in the top right corner, select "API Token," and enter the Token management page. Click "Add Token", add a custom note, and click "Add".
To delete a Token, select the corresponding Token and click the delete icon on the right.
::: warning
Tokens are the authentication credentials for the API interface. They are critical to the security of your Dashboard's information, so do not share your Token with others.
:::
## Authentication Method
Ensure the request header contains `Authorization: Token` for authentication.
Token authentication method:
```
Request Headers:
Authorization: Token
```
## Usage Instructions
::: warning
Negative timestamps in the following examples represent `0000-00-00`. This currently indicates that the Agent has never reported since the Dashboard went online, but it is not recommended to use the positive or negative value to determine the status.
:::
::: tip
**The request method is `GET`, and the response format is `JSON`.**
:::
### Get Server List
Request:
```
GET /api/v1/server/list?tag=
```
Parameters:
- `tag` (optional): ServerTag is the server group. Provide this parameter to query only servers in that group.
Example response:
```json
{
"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
Request:
```
GET /api/v1/server/details?id=&tag=
```
Parameters:
- `id` (optional): ServerID, multiple IDs separated by commas. Provide this parameter to query the server corresponding to that ID and ignore the `tag` parameter.
- `tag` (optional): ServerTag, provide this parameter to query only servers in that group.
Example response:
```json
{
"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.33,
"MemUsed": 14013841408,
"SwapUsed": 0,
"DiskUsed": 2335048912896,
"NetInTransfer": 2710273234,
"NetOutTransfer": 695454765,
"NetInSpeed": 10806,
"NetOutSpeed": 5303,
"Uptime": 331080,
"Load1": 5.23,
"Load5": 4.87,
"Load15": 3.99,
"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
}
}
]
}
```
### Get ICMP Ping / TCPing monitor value
This API does not require authentication, except for servers with `HideForGuest` option enabled.
Request:
```
GET /api/v1/monitor/{id}
```
Parameters:
- `id` (required): ServerID, must be an positive integer.
Example response:
```json
{
"code": 0,
"message": "success",
"result": [
{
"monitor_id": 1,
"server_id": 1,
"monitor_name": "Monitor1",
"server_name": "Server1",
"created_at": [
1722142860000,
1722142920000
],
"avg_delay": [
68.2275,
70.1129
]
},
{
"monitor_id": 2,
"server_id": 1,
"monitor_name": "Monitor2",
"server_name": "Server1",
"created_at": [
1722142860000,
1722142920000
],
"avg_delay": [
66.656,
68.2153
]
},
{
"monitor_id": 3,
"server_id": 1,
"monitor_name": "Monitor3",
"server_name": "Server1",
"created_at": [
1722142860000,
1722142920000
],
"avg_delay": [
61.4525,
62.342
]
}
]
}
```
Note: `created_at` corresponds with `avg_delay`.
### Automatic Node Registration
Description: Script for automating node registration. Example code is provided below.
Reference: [https://github.com/naiba/nezha/pull/472](https://github.com/naiba/nezha/pull/472)
```http
POST /api/v1/server/register?simple=1
```
Parameters:
- `simple`: (optional): Specifies the format of the response data.
- When set to `simple=1` or `simple=true`, the response will only include a Token string (e.g., `8GYwaxYuLfU7zl7ndC`).
- Otherwise the response will return a complete JSON object:`{"code": 200, "message": "Server created successfully","secret": "8GYwaxYuLfU7zl7ndC"}`
Request Payload:
The payload can be completely empty (`{}`), and the system will apply the following default values:
- `Name`: Defaults to the nodes IP address ($IP).
- `Tag`: Defaults to "AutoRegister".
- `Note`: Defaults to an empty string ("").
- `HideForGuest`: Defaults to "on".
You can also customize your data:
```json
"Name": "abcd", // Node name
"Tag": "", // Tag (optional)
"Note": "", // Note or description (optional)
"HideForGuest": "on" // Whether to hide from guests
```
## Usage Examples
### Get All Server Information
```python
import requests
url = "http://your-dashboard/api/v1/server/list"
headers = {
"Authorization": "your_token"
}
response = requests.get(url, headers=headers)
data = response.json()
for server in data['result']:
print(f"Server Name: {server['name']}, Last Active: {server['last_active']}, IP: {server['valid_ip']}")
```
### Get Specific Server Details
```python
import requests
server_id = 1 # Replace with your server ID
url = f"http://your-dashboard/api/v1/server/details?id={server_id}"
headers = {
"Authorization": "your_token"
}
response = requests.get(url, headers=headers)
data = response.json()
server = data['result'][0]
print(f"Server Name: {server['name']}")
print(f"CPU Usage: {server['status']['CPU']}%")
print(f"Memory Used: {server['status']['MemUsed']} bytes")
print(f"Disk Used: {server['status']['DiskUsed']} bytes")
print(f"Network In Speed: {server['status']['NetInSpeed']} bytes/s")
print(f"Network Out Speed: {server['status']['NetOutSpeed']} bytes/s")
```
With the above example code, you can easily obtain and process server status information, enabling automated monitoring and management.
### Automatic Node Registration
1. Create a file named `nezha_register.sh`, and copy the following content into it:
```bash
#!/bin/bash
# Exit if NEZHA_TOKEN is not set
if [ -z "${NEZHA_TOKEN}" ]; then
echo "NEZHA_TOKEN is not set. Exiting."
exit 0
fi
# Set default values if variables are not set
NEZHA_PROBE_ADDRESS="${NEZHA_PROBE_ADDRESS:-probe.example.com}"
NEZHA_PROBE_PORT="${NEZHA_PROBE_PORT:-5555}"
NEZHA_DASHBOARD_URL="${NEZHA_DASHBOARD_URL:-https://nezha.example.com}"
NODE_NAME=${NODE_NAME:-$(hostname)}
# Send POST request and capture response and HTTP status code
response=$(curl -s -o response_body.json -w "%{http_code}" -X POST "${NEZHA_DASHBOARD_URL}/api/v1/server/register?simple=true" \
-H "Content-Type: application/json" \
-H "Authorization: ${NEZHA_TOKEN}" \
-d "{\"Name\": \"${NODE_NAME}\"}")
# Extract HTTP status code and Nezha secret
HTTP_CODE="$response"
NEZHA_SECRET=$(cat response_body.json)
rm -f response_body.json
if [ "$HTTP_CODE" != "200" ]; then
echo "Failed to get Nezha Secret. HTTP status code: $HTTP_CODE"
exit 1
fi
# Additional check for NEZHA_SECRET to ensure it's not JSON-formatted (indicating failure)
if [[ "${NEZHA_SECRET:0:1}" == "{" ]]; then
echo "Failed to get Nezha Secret. Received response: ${NEZHA_SECRET}"
exit 1
fi
# Download and execute the install script with cleanup
curl -fsSL https://raw.githubusercontent.com/nezhahq/scripts/main/install_en.sh -o nezha.sh && \
chmod +x nezha.sh || { echo "Failed to download or make the script executable"; exit 1; }
# Clean up nezha.sh on exit
trap 'rm -f nezha.sh' EXIT
# Run the Nezha agent installation script
CMD="./nezha.sh install_agent "${NEZHA_PROBE_ADDRESS}" "${NEZHA_PROBE_PORT}" "${NEZHA_SECRET}" --tls"
echo "Run commnad : ${CMD}"
eval $CMD
```
2. Grant execution permission to the script: `chmod +x nezha_register.sh`
3. Get `Token` from Nezha dashboard, e.g. `POXbxorKJBM8wPMKX8r2PdMblyXvpggB`
4. Set Environment Variables
```bash
export NEZHA_TOKEN="POXbxorKJBM8wPMKX8r2PdMblyXvpggB" # Obtain this token from the dashboard
export NEZHA_PROBE_ADDRESS="your_probe_address" # Set your probe address
export NEZHA_DASHBOARD_URL="https://nezha.example.com" # Replace with your dashboard URL
export NEZHA_PROBE_PORT="5555" # Modify this port if needed
```
5. Run the script to complete node registration and probe installation:
```bash
./nezha_register.sh
```
6. If the script runs successfully, you will see output like the following:
```bash
Run command: ./nezha.sh install_agent probe.example.com 5555 YOUR_SECRET --tls
```

View File

@ -1,137 +0,0 @@
---
outline: deep
---
# Install Dashboard
## Preparation
To set up Nezha Monitoring, you need:
1. A server with public internet access, with firewall and security policies allowing traffic on ports 8008 and 5555. These ports are necessary for accessing and receiving data. A server with a single core and 512MB of RAM is sufficient for most use cases.
2. A domain with an A record set to point to your Dashboard server IP.
::: tip
If you want to use a CDN, prepare two domains: one configured with CDN for public access (CDN must support WebSocket protocol), and another domain not using CDN for communication between the Agent and Dashboard.
This document uses "dashboard.example.com" and "data.example.com" as example domains.
:::
3. A Github account (or Gitlab, Gitee).
**This document uses the aaPanel for reverse proxying the Dashboard as an example. As future versions change, some features may change their entry points. This document is for reference only.**
::: warning
This project does not depend on the aaPanel; you can choose any server panel you prefer or manually install Nginx or Caddy to configure SSL and reverse proxy.
If you do not need to use ports 80 and 443 to access the Dashboard, you can directly use the installation script to install and run Nezha Monitoring without installing Nginx.
:::
## Obtaining Github Client ID and Secret
Nezha Monitoring uses Github, Gitlab, or Gitee as admin accounts.
1. First, create an OAuth application. For Github, log in to Github, open [Github OAuth Apps](https://github.com/settings/developers), and select "OAuth Apps" -> "New OAuth App".
`Application name` - Fill in as you like.
`Homepage URL` - Fill in with the domain for accessing the dashboard, such as "http://dashboard.example.com" (your domain).
`Authorization callback URL` - Fill in with the callback address, such as "http://dashboard.example.com/oauth2/callback" (don't forget `/oauth2/callback`).
1. Click “Register application”.
2. Save the Client ID on the page, then click “Generate a new client secret” to create a new Client Secret, which will be displayed only once, **please keep it safe**.
## Using Cloudflare Access as an OAuth2 Provider
If you encounter issues using GitHub, GitLab, or Gitee for admin account logins, consider switching to [Cloudflare Access as your OAuth2 provider](/en_US/guide/q8.html) for authentication.
### Setting Up a New SaaS-OIDC Application
:::warning
The following steps are for users who have already started using Zero Trust. If you have not previously used Cloudflare Zero Trust, we strongly recommend that you first read the [Guide on Using Cloudflare Access as an OAuth2 Provider](/en_US/guide/q8.html) to understand the configuration examples and setup process.
:::
1. Go to [Zero Trust Dashboard](https://one.dash.cloudflare.com) and log in with your Cloudflare account.
2. `My Team` -> `Users` -> `<specific user>` -> Get `User ID` and save it.
3. `Access` -> `Application` -> `Add an Application`.
4. Choose `SaaS`, enter a custom application name in `Application` (e.g., nezha), select `OIDC`, and click `Add application`.
5. Select `Scopes`: `openid`, `email`, `profile`, `groups`.
6. Fill in your callback address in `Redirect URLs`, such as `https://dashboard.example.com/oauth2/callback`.
7. Save the `Client ID`, `Client Secret`, and `Issuer` address (protocol and domain part), e.g., `https://xxxxx.cloudflareaccess.com`.
**If using this method, after installing the Dashboard, modify the configuration file `/opt/nezha/dashboard/data/config.yaml`, and change the `Endpoint` configuration to the `Issuer` address saved earlier, e.g., `https://xxxxx.cloudflareaccess.com`, and restart the Dashboard.**
## OIDC Authentication Configuration (Optional)
Nazha supports custom OIDC authentication login. For configuration details, please refer to the documentation: [Enable OIDC authorization](/en_US/guide/q10.html).
## Installing the Dashboard on the Server
Run the installation script on the dashboard server:
```bash
curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/install_en.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
```
After Docker installation completes, enter the following values:
- `OAuth provider` - choose one from github, cloudflare, gitlab, gitee.
- `Client ID` - the previously saved Client ID.
- `Client Secret` - the previously saved Client Secret.
- `Username` - the username/User ID from the OAuth provider.
- `Site title` - custom site title.
- `Access port` - public access port, customizable, default is 8008.
- `Agent communication port` - port for Agent and Dashboard communication, default is 5555.
After inputting the values, wait for the image to be pulled.
When the installation completes, you can access the dashboard by visiting your domain and port number, such as “http://dashboard.example.com:8008”.
In the future, if you need to run the script again, run:
```bash
./nezha.sh
```
to open the management script.
## Configuring Reverse Proxy
Create a new site in the aaPanel, with the domain filled in as the public access domain, such as “http://dashboard.example.com”. Then click “Settings” to enter the site settings options, select “Reverse Proxy” - “New Reverse Proxy”.
Customize a proxy name and fill in `http://127.0.0.1` in the "Target URL" below, then click “Save”.
Open the “Configuration File” on the right side of the newly created reverse proxy and replace the configuration file with the following content:
```nginx
#PROXY-START/
location / {
proxy_pass http://127.0.0.1:8008;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
}
location ~ ^/(ws|terminal/.+|file/.+)$ {
proxy_pass http://127.0.0.1:8008;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
}
#PROXY-END/
```
Click “Save”.
Now you should be able to access the dashboard directly using the domain, such as “http://dashboard.example.com”.
### Additional Content:
CaddyServer v1 (v2 does not require special configuration):
```caddy
proxy /ws http://ip:8008 {
websocket
header_upstream -Origin
}
proxy /terminal/* http://ip:8008 {
websocket
header_upstream -Origin
}
proxy /file/* http://ip:8008 {
websocket
header_upstream -Origin
}
```
## Configuring SSL in the aaPanel
First, temporarily disable the reverse proxy.
Like configuring SSL certificates for other websites, enter the “SSL” in the site settings, and you can choose to automatically apply for a Lets Encrypt certificate or manually configure an existing certificate.
After completing the SSL settings, go back to [Github OAuth Apps](https://github.com/settings/developers) and edit the previously created OAuth application. Change all the domain parts in "Homepage URL" and "Authorization callback URL" from `http` to `https`, such as "https://dashboard.example.com" and "https://dashboard.example.com/oauth2/callback". **Failing to change this may result in being unable to log in to the admin panel.**
## Updating the Dashboard
Run the script `./nezha.sh`, and select to restart and update the dashboard.

View File

@ -1,111 +0,0 @@
---
outline: deep
---
# Frequently Asked Questions about the Dashboard
## Why is the IP Displayed in the Admin Panel Different from the Actual Agent IP?
First, let's explain how the IP displayed in the Admin panel is obtained: The Agent periodically requests IP-API to get IP information and reports it to the Dashboard. The currently used IP-API can be viewed here: [myip.go](https://github.com/nezhahq/agent/blob/main/pkg/monitor/myip.go).
If you find that the IP displayed in the Admin panel is different from the IP provided by your service provider, it is most likely that the service provider has given you an **entry IP**, but the Agent is testing your **exit IP**. This issue can also occur with multi-line servers and IPLC private lines.
::: tip
For example, a common scenario is that the service provider gives you a high-defense server. To meet both high defense and low network interruption rate goals, the IP provided may be a mapped high-defense IP rather than your server's real exit IP.
:::
You can also test the exit IP on the Agent server by running the following commands:
```shell
curl https://ipapi.co/ip/
curl ip.sb
curl ip-api.com
```
## Forgot or Deleted Viewing Password
Please view or edit the `/opt/nezha/dashboard/data/config.yaml` file.
The password is located under the `site-viewpassword` item.
## Dashboard Installation/Restart/Update Failure: iptables ......
First, try restarting Docker before proceeding:
```shell
systemctl status docker
systemctl restart docker
systemctl status docker
```
After restarting, try reinstalling the Dashboard.
If iptables errors persist, consider disabling or removing iptables.
This issue might also be related to the kernel, so switching to the official kernel can be another solution.
## Dashboard Restart Failure: Invalid hostPort: nz_site_port
If this issue occurs, you can modify the configuration via the installation script or directly edit the `/opt/nezha/dashboard/docker-compose.yaml` file.
## Dashboard Layout Error, CSS Resources Not Loading
If the Dashboard page layout is incorrect, it's usually due to missing or inaccessible CSS files.
To resolve this, try `restarting and updating the Dashboard` first.
If the problem persists after updating, the issue may be due to inappropriate configurations in your vhost file. You can edit the Nginx vhost file or use the aaPanel to:
1. Find the site configured during Dashboard installation in `Websites` and click `Settings` on the right.
2. Select `Configuration File` and remove the following lines:
```nginx
location ~ .*\.(js|css)?$
{
expires 12h;
error_log /dev/null;
access_log /dev/null;
}
```
3. Save the configuration, clear the browser, Nginx, and CDN caches, and refresh the page to see if it returns to normal.
## Dashboard Cannot Start: panic: Unable to find the configured DDNS provider...
The value entered for the DDNS provider is incorrect. Currently, only `webhook`, `cloudflare`, `tencentcloud`, and `dummy` are supported.
## Dashboard DDNS Update Crash: panic: interface conversion: interface {} is nil, not []interface {}
The entered DDNS `AccessID` or `AccessSecret` is incorrect.
## Dashboard warning: NEZHA>> 错误的服务监控上报...
1. The installed versions of the Dashboard and Agent are not compatible and have a `TaskType` that is unsupported by its counterpart. Updating both to the latest version could solve this problem.
2. This could be a specific issue in Dashboard v0.17.10 - v0.18.0. Updating to the latest version could solve this.
## Unable to start the Agent service: Unix syslog delivery error
Appears in Agent v0.16.9+. Mostly caused by a malfunctioning `/dev/log` socket (or it does not exist at all). You can refer to <https://unix.stackexchange.com/questions/317064/how-do-i-restore-dev-log-in-systemdrsyslog-host> to solve this problem. Try avoiding using init systems like `systemd` in a Docker installation.
## Network Monitoring Page Shows: server monitor history not found
This error indicates that no TCP-Ping or ICMP-Ping type monitoring has been set in the services page or monitoring data has not yet been generated.
If it has been set up, wait for some time and then check again.
## What to do if /terminal or /ws can't connect properly after enabling HTTPS?
This is often due to an incomplete certificate. Add the -d parameter to the agent run command. If the log contains `x509:certificate signed by unknown authority`, replacing with a complete certificate will solve the problem.
## What if I'm not satisfied with the data modification/addition functionality provided by the dashboard and want to modify/add data myself?
Common in scenarios like batch adding Agents, you can directly modify the database.
Note that not everything in the database can be modified; incorrect modifications can lead to data corruption and inability to start the Dashboard. **Do not modify the database casually!**
::: danger
Again, **do not modify the database casually!**
:::
If you need to modify data in the database, **stop** the dashboard container first.
The database type is sqlite3, located at `/opt/nezha/dashboard/data/sqlite.db`. Backup before modifying.
## Will the Dashboard automatically update?
Agents typically update automatically, but the Dashboard does not and requires manual updates.
## `Agent Command Issuance Failed` When Connecting to Web Terminal
When the Agent is offline, or the connection between the Agent and the Dashboard is unstable, it may cause issues with connecting to the Web Terminal.
Please check if the Agent is running normally and maintaining a stable connection with the Dashboard.

View File

@ -1,77 +0,0 @@
---
outline: deep
---
# DDNS
The DDNS functionality is designed for servers with dynamic IP addresses. When the Agent server reports a new IP (every 10 minutes), Dashboard will automatically update the DNS record based on the configuration.
### Why should I use Nezha's DDNS functionality?
- Convenient centralized management of DDNS settings, instead of deploying a DDNS service on every server.
- Your confidential information is only stored on the Dashboard server, preventing leaks.
### Configuration
You can directly add DDNS configurations in the Dashboard management page.
1. Click on the "Dynamic DNS" option in the menu bar to enter the configuration page.
2. Click the "New Profile" button and fill in the required information in the pop-up window. Option details:
- **Name**: The name of the configuration.
- **DDNS Provider**: The type of provider, determining the method used to update DNS records.
- **Domains (separate with comma)**: The domain(s), if you enter multiple domains, they should be separated by commas. IDNs (Internationalized Domain Names) are supported.
- **Maximum retry attempts**: The number of attempts for updating DDNS, default is 3, and the range is between 1 and 10.
- **DDNS Credential 1** and **DDNS Credential 2** are optional. Typically, at least one needs to be provided. The [table](#provider-list) below lists the options for all providers.
3. If using the `webhook` provider, the corresponding options need to be filled out as required. For detailed instructions, see [Webhook Configuration](#webhook-configuration).
4. You need to check at least one of **IPv4 Enabled** and **IPv6 Enabled**; otherwise, no update operations will be performed.
5. After adding a new configuration, you also need to modify the server settings to activate DDNS. Server-related options include:
- **Enable DDNS**: Enable DDNS functionality for this server.
- **DDNS Profiles**: The list of DDNS configuration IDs to use, searchable by configuration name.
## Webhook Configuration
Webhook requires manually constructing HTTP requests, suitable for using other provider services when operations are simple.
Webhook option descriptions:
- **Webhook URL**: The URL for the HTTP request, where parameters can use placeholders.
- **Webhook Request Method**: The HTTP request method. Supported methods include `GET`, `POST`, `PATCH`, `DELETE`, and `PUT`.
- **Webhook Request Type**: The format of the HTTP request body, either `JSON` or `Form`.
- **Webhook Request Headers**: HTTP request headers, filled in JSON format, but nesting is not supported.
- **Webhook Request Body**: The HTTP request body. It won't be used for `GET` and `DELETE`. If you need to use a nested format, you must choose `JSON` as the request type.
Supported Webhook placeholders:
- `#ip#`: Host IP.
- `#domain#`: DDNS domain. Each request is made separately for each domain, so this value will be a single domain string.
- `#type#`: IP type, either `"ipv4"` or `"ipv6"`.
- `#record#`: Record type, either `"A"` or `"AAAA"`.
- `#access_id#`: DDNS Credential 1.
- `#access_secret#`: DDNS Credential 2.
### Oray Webhook Example
<details>
<summary>Click to expand/collapse</summary>
- URL`http://ddns.oray.com/ph/update?hostname=#domain#&myip=#ip#`
- Request Method: `GET`
- Request Header`{"Authorization": "Basic pass"}`, replace `pass` with the Base64-encoded userpass (e.g., `user:pass` becomes `dXNlcjpwYXNzCg==`).
- Oray only supports A records, so only enable IPv4. Other Webhook options are not required.
</details>
## Provider List
| Provider | Credential 1 (ID) | Credential 2 (Secret) |
| ------------ | ----------- | --------------- |
| `dummy` | ❌️ | ❌️ |
| `webhook` | Optional | Optional |
| `cloudflare` | ❌️ | ✅ |
| `tencentcloud`| ✅ | ✅ |
## Viewing Logs
In the Dashboard logs, you can see the relevant logs for the DDNS functionality. When configured correctly, there will be corresponding log entries when updating DNS records.
```shell
dashboard_1 | 2024/03/16 23:16:25 NEZHA>> 正在尝试更新域名(ddns.example.com)DDNS(1/3)
dashboard_1 | 2024/03/16 23:16:28 NEZHA>> 尝试更新域名(ddns.example.com)DDNS成功
```

View File

@ -1,65 +0,0 @@
---
outline: deep
---
# FAQ about logging into the Dashboard
## Stuck Page/Connection Refused/Long Response Time After Login Callback
These issues can manifest in various ways, but ultimately the browser cannot display correctly after login.
1. Your server cannot connect to Github/Gitee, which is most common when configuring Github on servers in mainland China. You may try several times or switch to Cloudflare Access.
2. You have configured the callback address incorrectly. Ensure that your callback address is correct and that both the **port and protocol** are accurate!
3. An unknown error occurred on the Dashboard. You can use a script to check the logs.
::: tip
What is a protocol?
In the browser, the string that ends your domain with `://` is the protocol, usually `http` or `https`. Since there may be multiple protocol+domain+port combinations available for accessing the Dashboard in a normal deployment, make sure to choose the most appropriate one as the callback.
:::
### How to Check if My Callback Address is Wrong?
Ensure that the protocol+domain+port displayed in the browser before login and after the callback are consistent.
Ensure that your path is `/oauth2/callback`, **all in lowercase**.
## Errors After Logging into the Admin Panel
### http: named cookie not present
1. Clear cookies and log in again, or try a different browser.
2. Check the callback address to ensure it is correct and that both the **port and protocol** are accurate! The address initiating the request must be in the same domain as the callback address, with the port, protocol, and domain (or IP) all matching.
### lookup xxx
The container DNS resolution failed, usually due to modified iptables configurations.
It is recommended to restart Docker first, `sudo systemctl restart docker`, then restart the Dashboard using the script.
If the lookup error persists, check if there are other tools controlling iptables, such as firewall.
This issue might also be related to the kernel, so try switching to the official kernel.
### Invalid authorization method, or the login callback address is invalid, expired, or has been revoked
This issue appears only when using Gitee login, and the reason is unclear. Switching to GitHub is recommended.
### oauth2: server response missing access_token
This could be caused by various factors, most likely a network issue. Check your network and try again.
If unresolved, switching to Github or another method is recommended.
### The user is not an admin of this site and cannot log in
You logged in with the wrong account or configured the wrong username. Note that **the username is not an email**, and you can use a script to modify it.
For Cloudflare Access users, note that your username is not an email but a User ID.
### dial tcp xxx:443 i/o timeout
This is a network issue. Try restarting Docker first, `sudo systemctl restart docker`, then restart the Dashboard using the script.
If you are configuring Github login on a server in mainland China, switching to Cloudflare Access is recommended to avoid network interference.
### net/http: TLS handshake timeout
Same as above.
### Unable to receive email verification codes using Cloudflare Access as an OAuth2 Provider
- Ensure that the email verification policy has been correctly configured in `Policies`.
- Verify that the email address you provided is correct. Note that email addresses not on the policy whitelist will not receive verification codes.

View File

@ -1,34 +0,0 @@
---
outline: deep
---
# NAT Traversal Configuration
Nezha Server Monitoring includes built-in NAT traversal capabilities, allowing users to expose internal services running on an Agent (such as home OpenWrt routers or NAS devices) to the public internet. This functionality facilitates remote access and is currently limited to supporting plain HTTP traversal.
## Preparation
Prior to configuring NAT traversal, please ensure the following preparatory steps are completed:
- Verify that the Nezha Monitoring Agent is installed and actively running on your device and maintains a stable connection with the Dashboard.
- Acquire a public domain name, ideally using a subdomain configuration, such as `service-1.example.com`. Point this domain name to the public IP address of your Dashboard server.
- It is important to note that each domain name can only map to the service of one Agent. For mapping services from multiple Agents, distinct domain names should be used, such as `service-2.example.com`.
::: warning
If your Dashboard server uses tools like the aaPanel or similar management platforms, ensure that your domain (e.g., `service-1.example.com`) is correctly linked to the Dashboard site within these tools to avoid access issues.
:::
## NAT Traversal Configuration Steps
1. Log into the Dashboard Admin Panel and navigate to the "NAT Traversal" section in the menu.
2. Click the "Add" button and provide the following required details:
- **Name**: Assign a custom name to this traversal setup, for example, `OpenWrt Login Page`.
- **Agent ID**: Input the ID of the Agent for which traversal is needed.
- **Local service**: Specify the internal service address that requires traversal, in the `IP:port` format, such as `127.0.0.1:80`.
- **Bind hostname**: Enter the previously configured public domain name, such as `service-1.example.com`. If a non-standard port is used by Dashboard (e.g. default `8008`), be sure to include it as well.
3. After filling in the details, click the "Add" button and wait for the traversal setup to activate.
4. Test the configuration by accessing `http://service-1.example.com` to ensure the internal service on the Agent is successfully accessible.
## Usage Notes
- Continuous connectivity between the Agent and the Dashboard is crucial for the NAT traversal functionality to operate correctly. If the connection to the Agent is lost, the traversal setup will temporarily cease to function.
- Given that the NAT traversal does not encrypt traffic by itself, it is recommended to secure data transmissions by employing TLS/SSL between the Agent and the Dashboard, as well as between the Dashboard and the client browser, to ensure data security during transmission.

View File

@ -1,334 +0,0 @@
---
outline: deep
---
# Notification Configuration
Nezha Monitoring supports monitoring server load, CPU, memory, disk, traffic, monthly traffic, process count, and connection count, and sending notifications when user-defined thresholds are reached.
## Flexible Notification Methods
- In Dashboard messages, the placeholder `#DATETIME#` represents the timestamp of the event. When the notification is triggered, the Dashboard automatically replaces `#DATETIME#` with the actual event time.
- `#NEZHA#` is a placeholder for Dashboard messages, and the Dashboard automatically replaces the placeholder with the actual message when the notification is triggered.
- The body content is in `JSON` format: **When the request type is FORM**, the value is in `key:value` form, and placeholders can be placed inside `value`. The placeholders will be automatically replaced during notification. **When the request type is JSON**, only simple string replacement is performed before being submitted to the `URL`.
- Placeholders can also be placed inside the URL, and simple string replacement will be performed during the request.
**Refer to the following notification method examples, and you can also flexibly set the push method according to your needs.**
### Bark Example
<details>
<summary>Click to expand/collapse</summary>
- Name: Bark
- URL structure: /:key/:body or /:key/:title/:body or /:key/:category/:title/:body
- Request Method: GET
- Request Type: Default
- Body: Empty
- Name: Bark
- URL structure: /push
- Request Method: POST
- Request Type: form
- Body: `{"title": "#SERVER.NAME#","device_key":"xxxxxxxxx","body":"#NEZHA#","icon":"https://xxxxxxxx/nz.png"}`
</details>
### Slack Example Contributor: [@白歌](https://github.com/cantoblanco)
<details>
<summary>Click to expand/collapse</summary>
#### URL Parameter Acquisition Instructions
Prepare your Slack Workspace in advance and create an App for this Workspace. If you have not created one, you can create an App at [Slack API](https://api.slack.com/apps).
After creating the App, you need to add an Incoming Webhook to the App. In the App's settings page, find Incoming Webhooks, enable Activate Incoming Webhooks, and at the bottom of the page, find and click Add New Webhook to Workspace, choose a Channel, and click Allow. After creating, you will get a Webhook URL, which you will use to replace the example URL below.
- Name: Slack
- URL: https://hooks.slack.com/services/xxxxxxxxx/xxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx
- Request Method: POST
- Request Type: JSON
- Body: `{"text":"#NEZHA#"}`
</details>
### Telegram Example Contributor: [@白歌](https://github.com/cantoblanco)
<details>
<summary>Click to expand/collapse</summary>
#### URL Parameter Acquisition Instructions
Create a bot in Telegram and get the bot's token and your Telegram user ID.
The token and user ID are alphanumeric strings. You can get your user ID by chatting with @userinfobot on Telegram. Create a bot by chatting with @BotFather, and you will get the bot's token.
Replace botXXXXXX with your bot token and YYYYYY with your user ID in the URL below. Note that you need to chat with the bot first, otherwise the bot cannot send messages to you.
- Name: Telegram
- URL: https://api.telegram.org/botXXXXXX/sendMessage?chat_id=YYYYYY&text=#NEZHA#
- Request Method: GET
- Request Type: Default
- Body: Empty
</details>
### Email Notification Example - Outlook Contributor: [@白歌](https://github.com/cantoblanco)
<details>
<summary>Click to expand/collapse</summary>
**Note: SendCloud has a daily free email sending limit. This is just an example. You can choose a paid service or other similar free services. The usage method is similar.**
#### URL Parameter Acquisition Instructions
This example uses SendCloud as the email service. You need to register an account on [SendCloud](https://www.sendcloud.net/), create a sender email, and then obtain the APIUSER and APIKEY [here](https://www.sendcloud.net/sendSetting/apiuser).
Replace `<replaceAPIUSER>` and `<replaceAPIKEY>` in the example URL below with your APIUSER and APIKEY, and replace `<customSenderEmail>` and `<customRecipientEmail>` with any sender and recipient email addresses.
- Name: MS Mail Notification
- URLhttps://graph.microsoft.com/v1.0/me/microsoft.graph.sendMail
- Request method: POST
- Request type: JSON
- Header: `{"Content-type":"application/json",
"Authorization":"Bearer {Token}"}`
- Body:
```json
{
"message": {
"subject": "Server Status Notification",
"body": {
"contentType": "Text",
"content": "#NEZHA#"
},
"toRecipients": [
{
"emailAddress": {
"address": "ADDRESS FOR RECEVING EMAILS"
}
}
]
}
}
```
</details>
### DingTalk Group Bot Configuration Example
<details>
<summary>Click to expand/collapse</summary>
#### URL Parameter Acquisition Instructions
Create a bot in DingTalk in advance and get the bot's token.
The bot URL is obtained after creating a bot in the DingTalk group - Manage Bot - Create Bot. Choose custom keywords for the security method, and the Body content value must contain these keywords.
- Name: Nezha Assistant
- URL: https://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxx
- Request Method: POST
- Request Type: JSON
- Header: `{"Content-Type": "application/json"}`
- Body: `{"msgtype": "text","text": {"content":"Nezha Probe:\n#NEZHA#"}}`
</details>
### WeChat Work Group Bot Example Contributor: [@ChowRex](https://github.com/ChowRex)
<details>
<summary>Click to expand/collapse</summary>
Supported placeholders list
```json
{
"content": "#NEZHA#",
"ServerName": "#SERVER.NAME#",
"ServerIP": "#SERVER.IP#",
"ServerIPV4": "#SERVER.IPV4#",
"ServerIPV6": "#SERVER.IPV6#",
"CPU": "#SERVER.CPU#",
"MEM": "#SERVER.MEM#",
"SWAP": "#SERVER.SWAP#",
"DISK": "#SERVER.DISK#",
"NetInSpeed": "#SERVER.NETINSPEED#",
"NetOutSpeed": "#SERVER.NETOUTSPEED#",
"TransferIn": "#SERVER.TRANSFERIN#",
"TranferOut": "#SERVER.TRANSFEROUT#",
"Load1": "#SERVER.LOAD1#",
"Load5": "#SERVER.LOAD5#",
"Load15": "#SERVER.LOAD15#",
"TCP_CONN_COUNT": "#SERVER.TCPCONNCOUNT", # invalid
"UDP_CONN_COUNT": "#SERVER.UDPCONNCOUNT", # invalid
}
```
> This document is **NOT** available in English.
>
> [Group Bot Configuration Instructions - Document - WeChat Work Developer Center](https://developer.work.weixin.qq.com/document/path/91770#markdown%E7%B1%BB%E5%9E%8B)
- Name: WeChat Work Group Bot
- URL: https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_BOT_KEY
- Request Method: POST
- Request Type: JSON
- Body:
```json
{
"msgtype": "markdown",
"markdown": {
"content": "# Nezha Notification\n\n\"#NEZHA#\"\n\n> Name: \"#SERVER.NAME#\"\n> IP: \"#SERVER.IP#\"\n> IPv4: \"#SERVER.IPV4#\"\nIPv6: \"#SERVER.IPV6#\"\n> CPU: \"#SERVER.CPU#\"\n> Memory: \"#SERVER.MEM#\"\n> Swap: \"#SERVER.SWAP#\"\n> Disk: \"#SERVER.DISK#\"\n> Upload Speed: \"#SERVER.NETINSPEED#\"\n> Download Speed: \"#SERVER.NETOUTSPEED#\"\n> Total Upload: \"#SERVER.TRANSFERIN#\"\n> Total Download: \"#SERVER.TRANSFEROUT#\"\n> Load1: \"#SERVER.LOAD1#\"\n> Load5: \"#SERVER.LOAD5#\"\n> Load15: \"#SERVER.LOAD15#\"\n> TCP Connection Count: \"#SERVER.TCPCONNCOUNT\"\n> UDP Connection Count: \"#SERVER.UDPCONNCOUNT\"\n\n"
}
}
```
You can remove or add relevant information as needed.
</details>
### Matrix Notification Example
<details>
<summary>Click to expand/collapse</summary>
#### Parameter Explanation
* All variables starting with `$` need to be replaced with your actual values.
* **`YOUR_HOME_SERVER`**: The address of your Matrix server.
* **`YOUR_NEZHA_URL`**: The URL of your Nezha dashboard.
* **`YOUR_MATRIX_USERNAME`** and **`YOUR_MATRIX_PASSWD`**: Your Matrix username and password.
* **`YOUR_MATRIX_TOKEN`** retrieval method:
```sh
curl -XPOST -d '{"type": "m.login.password", "identifier": {"user": "$YOUR_MATRIX_USERNAME", "type": "m.id.user"}, "password": "$YOUR_MATRIX_PASSWD"}' "https://$YOUR_HOME_SERVER/_matrix/client/r0/login"
```
#### Request Configuration
- **Name**: Matrix
- **URL**: `https://$YOUR_HOME_SERVER/_matrix/client/r0/rooms/$ROOM_ID/send/m.room.message`
- **Request Method**: `POST`
- **Request Type**: `JSON`
- **Header**:
```json
{
"Authorization": "Bearer $YOUR_MATRIX_TOKEN"
}
```
- **Body**:
```json
{
"msgtype": "m.text",
"format": "org.matrix.custom.html",
"formatted_body": "<html><head><title>Nezha Dashboard</title></head><body><h1><a href=\"$YOUR_NEZHA_URL\" target=\"_blank\">Nezha Dashboard</a></h1><ul><li>datetime: #DATETIME#</li><li>Message: #NEZHA#</li></ul></body></html>",
"body": "#NEZHA#"
}
```
#### Usage Steps
1. **Replace Variables**: Replace `$YOUR_HOME_SERVER`, `$YOUR_NEZHA_URL`, `$YOUR_MATRIX_USERNAME`, `$YOUR_MATRIX_PASSWD`, and `$YOUR_MATRIX_TOKEN` with your own values.
2. **Retrieve Token**: Use the `curl` command provided above to get `YOUR_MATRIX_TOKEN`, making sure to replace all relevant variables.
3. **Configure Request**: Set up your request using the configuration provided above, ensuring the correct URL, headers, and body are used.
4. **Send Notification**: Send the Matrix message using the configured request to integrate Nezha monitoring notifications into your Matrix room.
Once configured, you will receive formatted Nezha dashboard information in your Matrix room whenever a notification is triggered.
</details>
## Notification Rule Explanation
### Basic Rules
- `type`: You can choose one or more types. If multiple types are selected in one rule, **all selected types must be satisfied** to trigger a notification (refer to the examples below)
- `cpu`, `gpu`, `memory`, `swap`, `disk`
- `net_in_speed` inbound network speed, `net_out_speed` outbound network speed, `net_all_speed` total network speed, `transfer_in` inbound traffic, `transfer_out` outbound traffic, `transfer_all` total traffic
- `offline` offline monitoring
- `load1`, `load5`, `load15` load
- `process_count` process count (currently resource-intensive due to thread count, not supported temporarily)
- `tcp_conn_count`, `udp_conn_count` connection count
- `temperature_max` maximum temperature
- `duration`: Duration in seconds. An notification is triggered if 30% or more of the samples exceed the threshold within this duration (to prevent data spikes).
- `min` or `max`:
- For traffic and network speed, the unit is bytes (1KB = 1024B, 1MB = 1024 * 1024B)
- For memory, disk, and CPU, the unit is percentage
- No need to set this for offline monitoring
- `cover`:
- `0` monitors all servers, use `ignore` to exclude specific servers
- `1` ignores all servers, use `ignore` to monitor specific servers
Example: `[{"type":"offline","duration":10, "cover":0, "ignore":{"5": true}}]`
- `ignore`: Select specific servers to exclude, used with `cover`, content is server ID and boolean value, e.g., `{"1": true, "2": false}`
**Complete Examples:**
Add an offline notification:
- Name: Offline Notification
- Rule: `[{"Type":"offline","Duration":10}]`
- Enabled: √
Add an notification for CPU usage exceeding 50% for 10 seconds **and** memory usage below 20% for 20 seconds:
- Name: CPU+Memory
- Rule: `[{"Type":"cpu","Min":0,"Max":50,"Duration":10},{"Type":"memory","Min":20,"Max":0,"Duration":20}]`
- Enabled: √
Send notifications for specific servers to specific notification groups:
Scenario example:
There are 4 servers (1, 2, 3, 4) and two notification groups (A, B).
Notify group A if servers 1 and 2 are offline for 10 minutes.
Notify group B if servers 3 and 4 are offline for 10 minutes.
First, set up notification groups A and B, then add two notification rules:
**Rule 1:**
- Name: 1, 2 Offline, Send to Notification Group A
- Rule: `[{"type":"offline","duration":600,"cover":1,"ignore":{"1":true,"2":true}}]`
- Notification Group: A
- Enabled: √
**Rule 2:**
- Name: 3, 4 Offline, Send to Notification Group B
- Rule: `[{"type":"offline","duration":600,"cover":1,"ignore":{"3":true,"4":true}}]`
- Notification Group: B
- Enabled: √
**Flexibly using parameters can make your notification function fully utilized**
### Special: Any Cycle Traffic notification
Can be used for monthly traffic monitoring
- `type`:
- `transfer_in_cycle` inbound traffic during the cycle
- `transfer_out_cycle` outbound traffic during the cycle
- `transfer_all_cycle` total traffic during the cycle
- `cycle_start`: The start date of the statistical cycle (can be the start date of your server billing cycle). The time format is RFC3339, e.g., Beijing time is `2022-01-11T08:00:00.00+08:00`
- `cycle_interval`: The number of statistical cycle units (e.g., if the cycle unit is days, and this value is 7, it means statistics are collected every 7 days)
- `cycle_unit`: Statistical cycle unit, default is `hour`, optional (`hour`, `day`, `week`, `month`, `year`)
- `min/max`, `cover`, `ignore` refer to basic rule configuration
Example:
For servers with IDs 3 and 4 (defined in ignore), if the monthly outbound traffic exceeds 1TB starting from the 1st of each month, send an notification:
```json
[{"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}}]
```
::: tip
If you still have trouble editing rules, you can try the rule generators below to simplify the process. Note that Nezha Monitoring does not guarantee the functionality of these generated rules.
- [Nezha Rule Generator](https://nz.sina.us.kg/): for common cases
- [Nezha-Traffic-Alarm-Generator](https://wiziscool.github.io/Nezha-Traffic-Alarm-Generator/): for editing cycle traffic rules only and may be more convenient to use. Chinese only.
:::
## Notification Trigger Modes
- **Always Trigger**: A notification is triggered every time the Agent reports a status that matches the notification rule.
- **Single Trigger**: A notification is triggered only once when the status changes, such as from normal to abnormal or from abnormal to normal.
## Set Tasks to Execute on notifications
If you need to execute a task while sending an notification message, you can set this item.
- **Task on Notification**: The task to be executed when the notification status changes from "normal" to "event". The task should be set in the tasks page in advance.
- **Task on Recovery**: The task to be executed when the notification status changes from "event" to "normal". The task should be set in the tasks page in advance.

View File

@ -1,28 +0,0 @@
---
outline: deep
---
# Configuring OIDC Authentication
Modify the contents of `config.yaml` to configure OIDC (OpenID Connect) authentication. OIDC is an authentication layer on top of the OAuth 2.0 protocol, which allows applications to verify the identity of users based on the authentication performed by an Authorization Server. This method is widely used to implement single sign-on for modern applications.
## Configuration Details
Here is a step-by-step guide to configuring the OIDC settings in your `config.yaml`:
```yaml
oauth2:
type: oidc # (Required) Specifies the authentication type as OIDC
oidcDisplayName: OIDC # (Optional, default: OIDC) The name displayed on the login page
admin: "" # (Fill at least one of admin or adminGroups; default: empty) Admin usernames, separated by commas. Users listed here are considered administrators
adminGroups: "" # (Fill at least one of admin or adminGroups; default: empty) Admin groups, separated by commas. Users in these groups are considered administrators. Omit if group management is not used
clientid: # (Required) OIDC client ID
clientsecret: # (Required) OIDC client secret
oidcIssuer: https://auth.example.com/realms/master # (Required) The issuer URL of the OIDC provider, obtainable from your OIDC provider
# oidcLogoutUrl: https://auth.example.com/realms/master/protocol/openid-connect/logout # (Currently unusable due to a bug)
# oidcRegisterUrl: # (Optional) Registration link provided by the OIDC provider
oidcScopes: openid,profile,email # (Optional, default: openid,profile,email) OIDC scopes requested, separated by commas
oidcLoginClaim: sub # (Optional, default: sub) The username field returned by OIDC, can be preferred_username, sub, or email
oidcGroupsClaim: groups # (Required if using adminGroups, default: groups) The user group information field returned by OIDC, can be groups or roles
oidcAutoCreate: false # (Optional, default: false) Whether to automatically create a user if they do not exist
oidcAutoLogin: false # (Optional, default: false) Whether to automatically redirect to the OIDC login page when the path is /login
```

View File

@ -1,69 +0,0 @@
---
outline: deep
---
# Customize GeoIP database
Dashboard v0.18.3+ uses an embedded GeoIP database to query IP locations. An IPinfo format mmdb database is required to be placed at `pkg/geoip/geoip.db` to compile the Dashboard with working GeoIP queries.
An IPinfo format mmdb is constructed by those fields:
- An IP subnet as an entry
- `continent`Continent code
- `continent_name`Continent name
- `country`Country code
- `country_name`Country name
Dashboard only requires the `country` field, and other fields can be left empty.
## Editing database
It is recommended to use `mmdbwriter` and `maxminddb-golang` libraries for editing mmdb databases as of now.
If your goal is to correct geographic information, it is recommended to modify directly based on the original IPinfo database. For similar operations, you can refer to the [sing-geoip](https://github.com/SagerNet/sing-geoip) project.
Using the correction of IPinfo data as an example, you need to use the `ReplaceWith` inserter (which is the default value) and write the `mmdbtype.Map` information:
```go
subnet := &net.IPNet{
IP: net.ParseIP("114.5.1.4")
Mask: net.CIDRMask(32, 32)
}
countryMap := make(map[mmdbtype.String]mmdbtype.String)
countryMap[mmdbtype.String("country")] = mmdbtype.String("JP")
if err := writer.Insert(subnet, mmdbtype.Map(countryMap)); err != nil {
return err
}
```
A `writer` is an instance of `*mmdbwriter.Tree` and needs to be created using the `mmdbwriter.New` method. The specific operations and the process of inserting other fields are not mentioned here.
After writing the database information to a file, you can use the `mmdbinspect` CLI tool to test the database information. For example:
```shell
$ mmdbinspect -db ./country.mmdb 114.5.1.4
[
{
"Database": "./country.mmdb",
"Records": [
{
"Network": "114.5.1.4/32",
"Record": {
"continent": "AS",
"continent_name": "Asia",
"country": "JP",
"country_name": "Japan"
}
}
],
"Lookup": "114.5.1.4"
}
]
```
Once the format and information are confirmed to be correct, the database can be used for compiling the Dashboard. Afterwards, you can test if the query API is working correctly using `grpcurl` or similar tools:
```shell
grpcurl -proto ./nezha/proto/nezha.proto -plaintext -H 'client_secret: test' -d '{"ip": "114.5.1.4"}' 127.0.0.1:5555 proto.NezhaService/LookupGeoIP
```

View File

@ -1,4 +0,0 @@
# Agent Startup/Online Troubleshooting Process
1. Directly execute `/opt/nezha/agent/nezha-agent -s DashboardIP or non-CDN domain:RPCPort -p AgentKey -d` to check if the logs indicate timeouts due to DNS or poor network conditions.
2. Use `nc -v Domain/IP RPCPort` or `telnet Domain/IP RPCPort` to check for network issues, inspect the inbound and outbound firewalls of the local machine and the panel server. If you cannot determine the issue, you can use the port checking tool provided by <https://port.ping.pe/>.
3. If the above steps indicate no issues but the Agent still does not go online correctly, try disabling SELinux. [How to disable SELinux?](https://www.google.com/search?q=disable+SELINUX)

View File

@ -1,109 +0,0 @@
# Reverse Proxy gRPC Port (Supports Cloudflare CDN)
Using Nginx or Caddy to reverse proxy gRPC
- Nginx Configuration
```nginx
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name data.example.com; # Your domain that the Agent uses to connect to the Dashboard
ssl_certificate /data/letsencrypt/fullchain.pem; # Path to your domain certificate
ssl_certificate_key /data/letsencrypt/key.pem; # Path to your domain private key
ssl_stapling on;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m; # This might conflict with other configuration files; comment it out if there are conflicts
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
underscores_in_headers on;
keepalive_time 24h;
keepalive_requests 100000;
keepalive_timeout 120s;
location / {
grpc_read_timeout 300s;
grpc_send_timeout 300s;
grpc_socket_keepalive on;
grpc_pass grpc://grpcservers;
}
}
upstream grpcservers {
server localhost:5555;
keepalive 512;
}
```
- Caddy Configuration
```
data.example.com:443 { # Your domain that the Agent uses to connect to the Dashboard
reverse_proxy {
to localhost:5555
transport http {
versions h2c 2
}
}
}
```
Dashboard Configuration
- First, log in to the Dashboard and go to the settings page. In the `Non-CDN Dashboard server domain/IP` field, enter the domain configured in Nginx or Caddy in the previous step, for example, `data.example.com`, and save it.
- Then, on the Dashboard server, open the `/opt/nezha/dashboard/data/config.yaml` file. Modify `proxygrpcport` to the port that Nginx or Caddy is listening to, for example, `443`. Since we enabled SSL/TLS in Nginx or Caddy, set `tls` to `true`. After making these changes, restart the Dashboard.
Agent Configuration
- Log in to the Dashboard management backend, copy the one-click installation command, and execute it on the corresponding server to reinstall the agent.
Enabling Cloudflare CDN (Optional)
According to Cloudflare gRPC requirements: gRPC services must listen on port 443 and must support TLS and HTTP/2.
So, to enable CDN, you must use port 443 when configuring Nginx or Caddy to reverse proxy gRPC and configure the certificate (Caddy will automatically apply and configure the certificate).
- Log in to Cloudflare, select the domain you are using. Go to the `Network` tab and turn on the `gRPC` switch. Then, go to the `DNS` tab, find the DNS record for the domain configured in Nginx or Caddy to reverse proxy gRPC, and enable the CDN by clicking the orange cloud.
After enabling `gRPC`, it might not be available immediately, and you may need to wait for a while. You can use `curl` and `nezha-agent -d` to verify:
```bash
localhost:~/agent# curl -H "content-type: application/grpc+proto" -H "authorization: Bearer test" https://xxx.xxx.ovh -v
* processing: https://xxx.xxx.ovh
* Trying [2606:4700:3035::ac43:8bed]:443...
* Connected to xxx.xxx.ovh (2606:4700:3035::ac43:8bed) port 443
# ... SSL info
* using HTTP/2
* h2 [:method: GET]
* h2 [:scheme: https]
* h2 [:authority: xxx.xxx.ovh]
* h2 [:path: /]
* h2 [user-agent: curl/8.2.1]
* h2 [accept: */*]
* Using Stream ID: 1
> GET / HTTP/2
> Host: xxx.xxx.ovh
> User-Agent: curl/8.4.0
> Accept: */*
> content-type: application/grpc+proto
> authorization: Bearer test
>
< HTTP/2 405
< date: Wed, 20 Dec 2023 08:56:27 GMT
< content-type: application/grpc+proto
< cf-ray: 8386ac12dabd5ddc-HKG
< cf-cache-status: DYNAMIC
< grpc-message: Received a HEADERS frame with :method "GET" which should be POST
< grpc-status: 13
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=%2BTjgJvXWyRF11nUOYx9Lq7UDC1xOYBLtjvWrdjVJQIqu9YqnFJeZFran2KRs6zabQc%2BLV8AubNqYRYDb7hQAZe6bglmVz0wQjrb0tNovYf%2B59SAp%2BQfZnH%2BAFDydNT95ZCmTPnKgWetcwQiUfXU%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< vary: Accept-Encoding
< server: cloudflare
< alt-svc: h3=":443"; ma=86400
<
* Connection #0 to host xxx.xxx.ovh left intact
localhost:~/agent# /opt/nezha/agent/nezha-agent -s nezha.xxx.xxx:443 -p YOUR_KEY --tls -d
NEZHA@2023-12-20 05:14:00>> 检查更新: 0.15.14
NEZHA@2023-12-20 05:14:01>> 上报系统信息失败: rpc error: code = Unknown desc = EOF # You need to modify the GRPCHost and TLS options in the Dashboard /opt/nezha/dashboard/data/config.yaml
NEZHA@2023-12-20 05:14:01>> Error to close connection ...
```

View File

@ -1,4 +0,0 @@
# Real-Time Channel Disconnection
- If you are using a CDN, ensure that the CDN provider offers WebSocket services and that WebSocket is enabled.
- Confirm that your reverse proxy rules have special configurations for the `/ws` and `/terminal` paths. You can [click here](/en_US/guide/dashboard.html#configure-reverse-proxy) to view the reverse proxy configuration.

View File

@ -1,5 +0,0 @@
# How to Perform Data Migration and Backup Recovery?
1. Run the one-click script and choose `Stop Dashboard`.
2. On the old server, package the `/opt/nezha` folder, copy it to the same location in the new environment, and extract it.
3. In the new server, run the one-click script and choose `Start Dashboard`.

View File

@ -1,11 +0,0 @@
# How to Reset Traffic Statistics Monthly?
The traffic statistics on the homepage reset every time the server restarts. To achieve a monthly reset of the traffic counter, you can do the following:
1. Go to the `Notification` page in the management panel.
2. Refer to [this document](/en_US/guide/notifications.html#special-any-cycle-transfer-notification) to create a monthly traffic notification.
3. Return to the homepage and go to the `Services` page, where you can see the monthly traffic statistics. The statistics here will not reset when the server restarts.
::: tip
This method allows you to set any period, including but not limited to hourly, daily, weekly, monthly, or yearly traffic statistics reset, offering great flexibility!
:::

View File

@ -1,37 +0,0 @@
---
outline: deep
---
# Customizing Agent Monitoring Items
## Customize Monitoring for Network Interfaces and Disk Partitions
Execute the following command to select network interfaces and partitions, then restart the Agent for changes to take effect:
```bash
/opt/nezha/agent/nezha-agent edit
```
## Additional Runtime Parameters
### Viewing Supported Parameters
To view the supported runtime parameters, please execute the following command:
```bash
./nezha-agent --help
```
### Configuring Parameters
If you installed the Agent using a one-click script, you can add or modify parameters by editing the system service configuration. Edit the file `/etc/systemd/system/nezha-agent.service` and append your desired parameters at the end of the `ExecStart=` line:
- `--report-delay`: Sets the interval for reporting system information. The default is 1 second. To reduce system resource usage, you can set this to 3 (valid range: 1-4 seconds).
- `--skip-conn`: Disables monitoring of network connections. Recommended for servers with high numbers of connections or high CPU usage.
- `--skip-procs`: Disables monitoring of process counts, helping to reduce resource usage of the Agent.
- `--disable-auto-update`: Disables the **automatic update** feature of the Agent, enhancing security.
- `--disable-force-update`: Disables the **forced update** feature of the Agent, enhancing security.
- `--disable-command-execute`: Prevents execution of any scheduled tasks or use of the WebSSH on the Agent, enhancing security.
- `--tls`: Enables SSL/TLS encryption. This should be enabled when you are using nginx to reverse proxy the Agent's gRPC connections and nginx is configured with SSL/TLS.
- `--use-ipv6-countrycode`: Forces the use of IPv6 addresses to query country codes. By default, the Agent uses IPv4 addresses to query country codes. If server supports IPv6 and the country code of the IPv4 address is different, can use this parameter.
- `--gpu`: Enables GPU monitoring. Note: Monitoring GPU usage may require installation of additional dependencies. For more details, refer to the documentation: [Enable GPU Monitoring](/en_US/guide/q9.html).
- `--temperature`: Enables hardware temperature monitoring. Only effective on supported hardware, some VPS may not be able to retrieve temperature information.
- `-d` `--debug`: Enables debug mode.
- `-u` `--ip-report-period`: Set IP update interval. Is only effective when the set value is higher than `--report-delay`. The default is 1800 seconds.
- `-k` `--insecure`: Disable TLS certificate integrity check. Useful in situations involving a self-signed certificate.

View File

@ -1,55 +0,0 @@
---
outline: deep
---
# Cloudflare Access OAuth2 Configuration
If you encounter issues logging in as an administrator using Github, Gitlab, or Gitee, you may consider switching to Cloudflare Access as the OAuth2 provider.
## Example Configuration:
```yaml
Oauth2:
Admin: 701b9ea6-9f56-48cd-af3e-cbb4bfc1475c
ClientID: 3516291f53eca9b4901a01337e41be7dc52f565c8657d08a3fddb2178d13c5bf
ClientSecret: 0568b67c7b6d0ed51c663e2fe935683007c28f947a27b7bd47a5ad3d8b56fb67
Endpoint: "https://xxxxx.cloudflareaccess.com"
Type: cloudflare
```
## Configuration Description:
| Parameter | Retrieval Method |
|-----------------------|---------------------------------------------------------------------------------|
| Admin | `My Team` -> `Users` -> `<specific user>` -> `User ID` |
| ClientID/ClientSecret | `Access` -> `Application` -> `Add an Application` <br/> -> `SaaS` -> `OIDC` |
| Endpoint | `Access` -> `Application` -> `Application URL` -> `Only keep the protocol and domain, no path` |
### Setting Up a New SaaS-OIDC Application
Navigate to the Zero Trust Dashboard: [https://one.dash.cloudflare.com/](https://one.dash.cloudflare.com/). Choose or create a new account, then follow these steps:
1. Go to `My Team` -> `Users` -> Click `<specific user>` -> Obtain and save the `User ID`. *(If this is your first time using Zero Trust, the Users list will be empty, and you can skip this step; users will appear after completing a verification.)*
2. Navigate to `Access` -> `Applications` -> `Add an Application`.
3. Select `SaaS`. In the `Application` field, enter a custom application name (e.g., `nezha`), select `OIDC`, and then click `Add application`.
4. For `Scopes`, select `openid`, `email`, `profile`, `groups`.
5. In `Redirect URLs`, enter your Dashboard Callback URL, such as `https://dashboard.example.com/oauth2/callback`.
6. Record the `Client ID`, `Client Secret`, and the protocol and domain part of the `Issuer` address, for example, `https://xxxxx.cloudflareaccess.com`.
7. Edit the Dashboard configuration file (usually located at `/opt/nezha/dashboard/data/config.yaml`), adjust the `OAuth2` settings according to the example configuration, and restart the Dashboard service.
### Identity Verification Strategy Configuration
After setting up the Dashboard, you need to configure identity verification policies in the Zero Trust Dashboard. Navigate to: `Access` -> `Applications` -> `<application name>` -> `Policies`. You can choose from various SSO authentication methods, including email OTP and hardware key verification. For detailed configurations, refer to the [Cloudflare Zero Trust Documentation](https://developers.cloudflare.com/cloudflare-one/).
### Policy Configuration Example (One-time PIN)
Using email OTP as the default verification method:
1. Navigate to `Access` -> `Applications` -> `<application name>` -> `Policies` -> `Add a policy`.
2. Set a `Policy Name`, for example, `OTP`, and set `Action` to `Allow`.
3. Under `Configure rules`, add a new `Include` rule. Select `Emails` as the `Selector` and enter your email address in the textbox.
4. Click `Save policy` to save the configuration.
### Testing the Policy
1. If the configuration is correct, when you visit the Dashboard login interface, it will display as "Log in with Cloudflare Account." Clicking on login will redirect you to the Cloudflare Access login page.
2. Enter the email address configured previously, click `Send me a code`, and then enter the code received to log in to the Dashboard.
3. If `User ID` was not specified in `Admin` during previous steps, an error message will be displayed after login: "This user is not an administrator of this site and cannot log in." At this point, you need to go to `My Team` -> `Users`, find the corresponding user, click on the username to get the `User ID`, and enter it into the `Admin` section of the Dashboard configuration file. After restarting the Dashboard service, try logging in again.

View File

@ -1,81 +0,0 @@
---
outline: deep
---
# Enable GPU monitoring
GPU monitoring is a new feature implemented in Nezha Monitoring v0.17.x. Before using the feature, please ensure your Dashboard version is higher than v0.17.2 and Agent version is higher than v0.17.0.
## Enable
### From Command-Line Flag
Append the `--gpu` flag to the Agent argument. For example:
```bash
/opt/nezha/agent/nezha-agent -s example.com:5555 -p example --gpu
```
### From configuration file
Execute the following command to modify Agent configuration to enable GPU monitoring.
```bash
/opt/nezha/agent/nezha-agent edit
```
In the interactive menu returned, choose to enable GPU monitoring.
## Enable GPU utilization monitoring
GPU model and GPU utilization are two different monitor items, which uses different approaches to obtain their value.
Windows and macOS supports getting GPU utilization without extra dependencies, and support multiple graphics card brands.
Linux distros support only NVIDIA and AMD cards and need to install extra dependencies.
Below are the instructions on how to enable GPU utilization monitoring on Linux for NVIDIA / AMD graphics cards.
### NVIDIA
NVIDIA cards need the `nvidia-smi` utility to get GPU utilization. This utility is included in the official driver by default.
If you use unofficial drivers like `nouveau`, then it's not possible to get GPU utilization.
### AMD
AMD cards need to install the open source `amdgpu` driver and the `rocm-smi` utility.
Mainstream distros have already packaged `rocm-smi`, below are commands to install the utility on these distros:
```bash
# Arch Linux
pacman -Sy rocm-smi-lib
# Debian / Ubuntu
apt install rocm-smi
# Fedora / RHEL 8+
dnf install rocm-smi
```
If your distro doesn't have the package, then you will need to compile `rocm_smi_lib` manually.
Required dependencies`git` `cmake` `gcc`
First, clone the git repository of `rocm_smi_lib`:
```bash
git clone https://github.com/ROCm/rocm_smi_lib
```
Then compile the libraries and install them on your system.
```bash
cd rocm_smi_lib
mkdir -p build
cd build
cmake ..
make -j $(nproc)
# Install library file and header; default location is /opt/rocm
make install
```

View File

@ -1,56 +0,0 @@
---
outline: deep
---
# Server Management
## Introduction
The server section is responsible for managing Agents, forming the most fundamental part of Nezha monitoring and serving as the basis for other functionalities.
## Adding a Server
The first step is to add a server, where you can customize the name, group, sorting, and notes.
Servers in the same group will be displayed together in supported themes. Notes will only be visible in the Admin Panel, so there's no need to worry about leaking information.
## Installing the Agent
Please refer to the previous section on [installing the Agent](/en_US/guide/agent.html).
It is recommended to use the one-click installation. After configuring the parameters, click the corresponding system icon in the **one-click installation** column of the server to copy the installation command and execute it on the respective server.
## Forced Update
Agent update-related parameters include `--disable-auto-update` and `--disable-force-update` as described in [Custom Agent Monitoring Projects](/en_US/guide/q7.html).
By default, the Agent will update automatically without intervention. However, if the user disables automatic updates, you can select specific servers for a forced update.
The forced update will not work if `disable-force-update` is enabled.
## Data Columns
* Version: Records the current version of the Agent.
* Hide from Guests: When true, guests cannot see this server in the Dashboard.
* Enable DDNS: When true, if the server IP changes, the Dashboard will automatically update the DNS records.
* DDNS Domain: The DDNS domain configured for this server.
* Secret: The secret/key used for configuring the Agent, which is used to verify communication between the Agent and the Dashboard.
* Note: Server notes, visible only after verification.
* Public Note: Server public notes, visible on the frontend. You can customize frontend theme based on this field; see [Public Note Example](#public-note-example) for details.
* Installation commands: Click the corresponding system button to copy the command and execute it on the server for an instant installation.
* Management: Connects to WebShell, modifies server configuration, or deletes the server.
## WebSSH Terminal
This is WebShell; the feature will not work if `disable-command-execute` is enabled.
It is available for both Linux and Windows and supports Ctrl+Shift+V for pasting.
If the connection fails, refer to [Real-Time Channel Disconnection/Online Terminal Connection Failure](/en_US/guide/q4.html).
## FM
Added in Dashboard v0.19.1 / Agent v0.19.0. A pseudo file manager embedded in WebShell, supports file download/upload, directory navigation and copying current path. Access it by clicking the blue button in the bottom-right corner of the WebShell.
## Public Note Example
### ServerStatus Theme Agent Billing Information Display
<details>
<summary>Click to expand/collapse</summary>
See https://github.com/naiba/nezha/pull/425.
</details>

View File

@ -1,53 +0,0 @@
---
outline: deep
---
# Service Monitoring
**The Services section is where you set up monitoring for external websites or servers using Agents.**
**Configured service monitors can be viewed on the "Services" page of the homepage, displaying the availability monitoring results for the past 30 days.**
## How to Use
To add a new monitor, go to the "Services" page in the Admin dashboard and click "Add Monitor."
When adding a new service monitor, you need to set the following parameters:
- **Name**: Customize a name.
- **Type**: Select a monitor type. Nezha Monitoring currently supports three types: "HTTP-GET," "ICMP-Ping," and "TCP-Ping."
- **Target**: Depending on the type you choose, the method for setting the target differs:
- `HTTP-GET`: For this type, you should enter a URL as the target, including `http://` or `https://`. **If your target URL is `https://`, the SSL certificate of that URL will also be monitored. Notifications will be triggered when the SSL certificate expires or changes.** Example: https://example.com.
- `ICMP-Ping`: For this type, you should enter a domain name or IP without a port number. Example: 1.1.1.1 or example.com.
- `TCP-Ping`: For this type, you should enter a domain name or IP with a port number. Example: 1.1.1.1:80 or example.com:22.
- **Request Interval**: Set the interval in seconds at which the Agent requests the target.
- **Coverage**: Select a rule to determine which Agents will request the target.
- **Specific Servers**: Used in conjunction with the coverage scope, select Agents within the rule to exclude.
- **Notification Group**: Choose the notification methods you have already set up on the "Notification" page. [Click here](/en_US/guide/notifications.html#flexible-notification-methods) for more details.
- **Enable Fault Notification**: Choose whether to receive fault notifications for the target as needed. The default is unchecked.
After setting it up, click "Add." Wait a moment and go to the "Services" page on the homepage to view the monitoring results.
## Latency Change Notification
Nezha Monitoring can monitor and record the latency between the Agent and the target server, sending notifications when there are significant changes. This feature helps you monitor if the server's network route has changed.
- **Enable Latency Notifications**: When enabled, Notification will be sent if the latency from the Agent to the target server is greater than the `Maximum Latency` or less than the `Minimum Latency`.
## Trigger Tasks on Notification
If you need to execute tasks when service monitoring Notification are triggered, you can check "Enable Trigger Tasks" and select the pre-configured trigger tasks in "Task on Notification" and "Task on Recovery."
## Network Latency Chart
The TCP-Ping and ICMP-Ping monitoring types set in the Services page will automatically enable the monitoring chart feature. On the "Network" page of the homepage, you can view historical network latency charts. The data in the charts is based on the latency from the Agent to the target server. You can click the Agent's name to toggle the chart display. In the chart, you can uncheck the target server's name to hide or show the corresponding data.
## Managing Monitors
To manage existing service monitors, go to the "Services" page in the Admin Panel. Select a monitor configuration and click the icons on the right to edit or delete it.

View File

@ -1,427 +0,0 @@
---
outline: deep
---
# Settings
## Site Title
You can customize the site title in this section.
## Administrator List
- If you have changed your Github, Gitlab, or Gitee username, you need to update it here to avoid login issues. Separate multiple usernames with commas: `user1,user2`.
- To change the administrator account, go to `/opt/nezha/dashboard/data/config.yaml` and reset the new administrator `Client ID` and `Client Secret`.
## Theme
Select the theme for the frontend and dashboard here. If a theme that already exists is not in the options, update the Dashboard.
To use a custom frontend theme, you need to create a theme description file. For more information on custom themes, please refer to [Nezha Theme Development Environment](/en_US/developer/theme.html).
Before enabling the dashboard Custom theme, ensure you have installed the custom theme; otherwise, the Dashboard will not display correctly after enabling this option.
## Language
Nezha Monitoring currently supports the following languages:
- Simplified Chinese (简体中文)
- Traditional Chinese (繁體中文)
- English
- Spanish (Español)
We welcome corrections to translations or contributions of more languages.
## Custom Code (style, script)
You can modify the LOGO, adjust colors, add beautification code, and add statistical code here.
:::warning
Custom code only affects the visitor homepage, not the admin panel. Due to differences in code between themes, if you need to modify the content in the admin panel, please modify the theme files in Docker.
:::
#### Example of Changing Progress Bar Color, Background Image, Navigation Bar, etc., in the Default Theme
<details>
<summary>Click to expand/collapse</summary>
```html
<style>
/* Screen adaptation */
@media only screen and (min-width: 1200px) {
.ui.container {
width: 80% !important;
}
}
@media only screen and (max-width: 767px) {
.ui.card>.content>.header:not(.ui), .ui.cards>.card>.content>.header:not(.ui) {
margin-top: 0.4em !important;
}
}
/* Overall icons */
i.icon {
color: #000;
width: 1.2em !important;
}
/* Background image */
body {
content: " " !important;
background: fixed !important;
z-index: -1 !important;
top: 0 !important;
right: 0 !important;
bottom: 0 !important;
left: 0 !important;
background-position: top !important;
background-repeat: no-repeat !important;
background-size: cover !important;
background-image: url(https://backgroud.img) !important;
font-family: Arial,Helvetica,sans-serif !important;
}
/* Navigation bar */
.ui.large.menu {
border: 0 !important;
border-radius: 0px !important;
background-color: rgba(255, 255, 255, 55%) !important;
}
/* Homepage buttons */
.ui.menu .active.item {
background-color: transparent !important;
}
/* Navigation bar dropdown */
.ui.dropdown .menu {
border: 0 !important;
border-radius: 0 !important;
background-color: rgba(255, 255, 255, 80%) !important;
}
/* Login button */
.nezha-primary-btn {
background-color: transparent !important;
color: #000 !important;
}
/* Large card */
#app .ui.fluid.accordion {
background-color: #fbfbfb26 !important;
border-radius: 0.4rem !important;
}
/* Small card */
.ui.four.cards>.card {
border-radius: 0.6rem !important;
background-color: #fafafaa3 !important;
}
.status.cards .wide.column {
padding-top: 0 !important;
padding-bottom: 0 !important;
height: 3.3rem !important;
}
.status.cards .three.wide.column {
padding-right: 0rem !important;
}
.status.cards .wide.column:nth-child(1) {
margin-top: 2rem !important;
}
.status.cards .wide.column:nth-child(2) {
margin-top: 2rem !important;
}
.status.cards .description {
padding-bottom: 0 !important;
}
/* Server name */
.status.cards .flag {
margin-right: 0.5rem !important;
}
/* Popup card icon */
.status.cards .header > .info.icon {
margin-right: 0 !important;
}
.nezha-secondary-font {
color: #2175ba !important;
}
/* Upload/download */
.status.cards .outline.icon {
margin-right: 1px !important;
}
i.arrow.alternate.circle.down.outline.icon {
color: #2175ba !important;
}
i.arrow.alternate.circle.up.outline.icon {
color: red !important;
}
/* Popup card small arrow */
.ui.right.center.popup {
margin: -3px 0 0 0.914286em !important;
-webkit-transform-origin: left 50% !important;
transform-origin: left 50% !important;
}
.ui.bottom.left.popup {
margin-left: 1px !important;
margin-top: 3px !important;
}
.ui.top.left.popup {
margin-left: 0 !important;
margin-bottom: 10px !important;
}
.ui.top.right.popup {
margin-right: 0 !important;
margin-bottom: 8px !important;
}
.ui.left.center.popup {
margin: -3px .91428571em 0 0 !important;
-webkit-transform-origin: right 50% !important;
transform-origin: right 50% !important;
}
.ui.right.center.popup:before,
.ui.left.center.popup:before {
border: 0px solid #fafafaeb !important;
background: #fafafaeb !important;
}
.ui.top.popup:before {
border-color: #fafafaeb transparent transparent !important;
}
.ui.popup:before {
border-color: #fafafaeb transparent transparent !important;
}
.ui.bottom.left.popup:before {
border-radius: 0 !important;
border: 1px solid transparent !important;
border-color: #fafafaeb transparent transparent !important;
background: #fafafaeb !important;
-webkit-box-shadow: 0px 0px 0 0 #fafafaeb !important;
box-shadow: 0px 0px 0 0 #fafafaeb !important;
-webkit-tap-highlight-color: rgba(0,0,0,0) !important;
}
.ui.bottom.right.popup:before {
border-radius: 0 !important;
border: 1px solid transparent !important;
border-color: #fafafaeb transparent transparent !重要;
background: #fafafaeb !重要
-webkit-box-shadow: 0px 0px 0 0 #fafafaeb !重要;
box-shadow: 0px 0px 0 0 #fafafaeb !重要;
-webkit-tap-highlight-color: rgba(0,0,0,0) !重要;
}
.ui.top.left.popup:before {
border-radius: 0 !重要;
border: 1px solid transparent !重要;
border-color: #fafafaeb transparent transparent !重要;
background: #fafafaeb !重要;
-webkit-box-shadow: 0px 0px 0 0 #fafafaeb !重要;
box-shadow: 0px 0px 0 0 #fafafaeb !重要;
-webkit-tap-highlight-color: rgba(0,0,0,0) !重要;
}
.ui.top.right.popup:before {
border-radius: 0 !重要;
border: 1px solid transparent !重要;
border-color: #fafafaeb transparent transparent !重要;
background: #fafafaeb !重要;
-webkit-box-shadow: 0px 0px 0 0 #fafafaeb !重要;
box-shadow: 0px 0px 0 0 #fafafaeb !重要;
-webkit-tap-highlight-color: rgba(0,0,0,0) !重要;
}
.ui.left.center.popup:before {
border-radius: 0 !重要;
border: 1px solid transparent !重要;
border-color: #fafafaeb transparent transparent !重要;
background: #fafafaeb !重要;
-webkit-box-shadow: 0px 0px 0 0 #fafafaeb !重要;
box-shadow: 0px 0px 0 0 #fafafaeb !重要;
-webkit-tap-highlight-color: rgba(0,0,0,0) !重要;
}
/* Popup card */
.status.cards .ui.content.popup {
min-width: 20rem !重要;
line-height: 2rem !重要;
border-radius: 5px !重要;
border: 1px solid transparent !重要;
background-color: #fafafaeb !重要;
font-family: Arial,Helvetica,sans-serif !重要;
}
.ui.content {
margin: 0 !重要;
padding: 1em !重要;
}
/* Service page */
.ui
.table {
background: RGB(225,225,225,0.6) !重要;
}
.ui.table thead th {
background: transparent !重要;
}
/* Service page progress bar */
.service-status .good {
background-color: #2175ba !重要;
}
.service-status .danger {
background-color: red !重要;
}
.service-status .warning {
background-color: orange !重要;
}
/* Copyright */
.ui.inverted.segment, .ui.primary.inverted.segment {
color: #000 !重要;
font-weight: bold !重要;
background-color: #fafafaa3 !重要;
}
</style>
<!--Logo and Copyright-->
<script>
window.onload = function(){
var avatar=document.querySelector(".item img")
var footer=document.querySelector("div.is-size-7")
footer.innerHTML="Copyright info"
footer.style.visibility="visible"
avatar.src="https:/img.src"
avatar.style.visibility="visible"
}
</script>
```
</details>
#### Example of Changing Progress Bar Color and Modifying Footer in DayNight Theme (by [@hyt-allen-xu](https://github.com/hyt-allen-xu) and [@tech-fever](https://github.com/tech-fever))
<details>
<summary>Click to expand/collapse</summary>
```html
<style>
.ui.fine.progress> .progress-bar {
background-color: #00a7d0 !important;
}
</style>
<script>
window.onload = function(){
var avatar = document.querySelector("img");
var footer = document.querySelector("div.footer-container");
footer.innerHTML = "©2021 Your Name & Powered by Your Name";
footer.style.visibility = "visible";
avatar.src = "Your Image URL";
avatar.style.visibility = "visible";
}
</script>
```
</details>
#### Example of Changing LOGO and Footer in Default Theme (by [@iLay1678](https://github.com/iLay1678))
<details>
<summary>Click to expand/collapse</summary>
```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 URL";
avatar.style.visibility = "visible";
}
</script>
```
</details>
#### Example of Changing Background Image in Hotaru Theme
<details>
<summary>Click to expand/collapse</summary>
```html
<style>
.hotaru-cover {
background: url(https://s3.ax1x.com/2020/12/08/DzHv6A.jpg) center;
}
</style>
```
</details>
## View Password
If you don't want to display your Dashboard directly to visitors, you can set a view password here. After setting the password, visitors need to enter the password to access the homepage.
## Non-CDN Dashboard Server Domain/IP
This setting is a prerequisite for using the one-click script to install the Agent. For details, please see [here](/en_US/guide/agent.html#preparation).
## IP Change Notifications
If you want to receive notifications when a server's IP changes, you can set it up here.
#### Coverage
Select a rule to determine which servers to monitor. Choose according to your needs.
#### Specific Servers
Set exclusions for the selected rule in conjunction with the coverage scope.
#### Send Notifications to a Specific Notification Group
Choose a notification method, which should be set up in advance on the "Notification" page.
:::warning
**Notifications take effect after enabling this setting.**
:::
#### Show Full IP Address in Notifications
IP change notifications hide the full IP by default. If you don't want to hide it, check "Show Full IP Address in Notification."
## Disable Homepage Theme Switching
By default, the Dashboard allows visitors to change the theme. This feature only affects individual visitors and does not affect the theme set by the administrator in the admin panel. If you don't want visitors to switch themes, check this option.

View File

@ -1,44 +0,0 @@
---
outline: deep
---
# Task Management
**In the Tasks section, you can set up scheduled tasks, trigger tasks, and batch execute tasks on multiple servers.**
Nezha Monitoring supports pushing commands to Agents for execution. This feature is highly flexible and can be used for regular backups using tools like restic or rclone, periodically restarting a service to reset network connections, or executing a task when an notification is triggered, such as running a script when CPU usage is high for an extended period.
## How to Use
Go to the "Tasks" page in the admin panel and click "Add Scheduled Task." When adding a scheduled task, you need to fill in the following parameters:
- **Name**: Customize a task name.
- **Task Type**: Choose the type of task.
- **Scheduled Task**: Executes periodically according to the schedule set below.
- **Trigger Task**: Only executed when triggered by an API call or notification rule, runs once per trigger.
- **Schedule**: Set the schedule time (not enable when using trigger task type). The time format is `* * * * * *`, corresponding to `second minute hour day month weekday`. For more details, see [Cron Expression Format](https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format).
For example: `0 0 3 * * *` means "3 AM every day."
- **Command**: Set the command to execute, similar to writing Shell/Bat scripts, but it's recommended not to use new lines; connect multiple commands with `&&` or `&`.
For example, to schedule a reboot, you can enter `reboot` here.
- **Coverage** and **Specific Servers**: Select rules to determine which Agents execute the scheduled task, similar to the settings on the "Services" page. When using the trigger task type, you can choose "executed by the triggered server."
- **Notification Group**: Choose the notification methods you have set up on the "Notifications" page. [Click here](/en_US/guide/notifications.html#flexible-notification-methods) for more details.
- **Send Success Notification**: Check this option to trigger a notification upon successful task execution.
## Managing Tasks
To manage existing scheduled tasks, go to the "Tasks" page in the admin panel. For each task configuration, the three icons on the right are:
- **Execute Immediately**: Click to ignore the scheduled time and execute the task immediately.
- **Edit**: Click to modify the task configuration.
- **Delete**: Delete the scheduled task.
## Frequently Asked Questions
1. **Command not found error**
If a command fails to run with a "command not found" error, it may be a PATH environment variable issue. On Linux servers, you can add `source ~/.bashrc` at the beginning of the command or use the absolute path to execute the command.

View File

@ -1,28 +0,0 @@
---
layout: home
title: Nezha Monitoring - Server monitoring tool
titleTemplate: User Manual
hero:
name: Nezha Monitoring
text: Open-source, lightweight, and easy-to-use server monitoring and operation tool
image: https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.svg
actions:
- theme: brand
text: Preview
link: https://ops.naibahq.com
- theme: alt
text: Get Started →
link: en_US/guide/dashboard
features:
- title: One-Click Installation
details: Supports one-click installation of the Dashboard and Agent services, making it easy to operate. Compatible with mainstream systems, including Linux, Windows, macOS, OpenWRT, and Synology.
- title: Real-Time Monitoring
details: Supports monitoring the status of multiple servers simultaneously, providing historical network status and latency charts, monitoring webpage and port availability, and SSL certificate status. Supports alerts for status such as faults and traffic, with notifications via Telegram, email, Slack, and more.
- title: Easy Operations
details: Provides an API to get server status, supports WebSSH, DDNS, and traffic monitoring. Allows setting up scheduled and triggered tasks and executing server tasks in batches.
---

View File

@ -1,355 +0,0 @@
---
outline: deep
---
# 安装 Agent
**哪吒监控的被控端服务被称为 Agent本文档将介绍如何在被控端服务器上安装 Agent并与 Dashboard 连接。**
::: tip
Agent 二进制文件仓库地址为:<https://github.com/nezhahq/agent/releases>
:::
## 一键安装 Agent
哪吒监控支持在 Windows 和 Linux 上一键安装 Agent。遵循本文档的步骤你可以很轻松地在服务器上部署它。
### 准备工作
你需要提前在管理面板中设置好通信域名,此域名不可以接入 CDN。本文档以示例通信域名 “data.example.com” 为例。
进入后台管理面板,转到“设置”页,在“未接入 CDN 的面板服务器域名/IP”项中填入通信域名然后点击"保存"。
### 在 Linux 中一键安装
1. 首先在管理面板中添加一台服务器。
2. 点击新添加的服务器旁的绿色 Linux 图标按钮,复制一键安装命令。
3. 在被控端服务器中运行复制的一键安装命令,等待安装完成后返回到 Dashboard 主页查看服务器是否上线。
### 在 macOS 中一键安装
1. 首先在管理面板中添加一台服务器。
2. 点击新添加的服务器旁的绿色 Apple 图标按钮,复制一键安装命令。
3. 在被控端服务器中运行复制的一键安装命令,等待安装完成后返回到 Dashboard 主页查看服务器是否上线。
### 在 Windows 中一键安装
1. 首先在管理面板中添加一台服务器。
2. 点击新添加的服务器旁的绿色 Windows 图标按钮,复制一键安装命令。
3. 进入 Windows 服务器,运行 PowerShell在 PowerShell 中运行复制的安装命令。
4. 如遇到确认「执行策略变更」请选择 Y。
5. 等待安装完成后返回 Dashboard 主页查看服务器是否上线。
:::warning
如果在 PowerShell 中运行一键安装命令时遇到错误,请尝试下方的**在 Windows 中手动安装 Agent**。
:::
## 其他方式安装 Agent
### 在 Linux 中安装 Agent支持大部分发行版
<details>
<summary>点击展开/收起</summary>
1. 首先在管理面板中添加一台服务器。
2. 在被控服务器中,运行脚本(位于中国大陆的服务器请使用镜像):
```bash
curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
```
如果你的被控服务器位于中国大陆,可以使用镜像:
```bash
curl -L https://gitee.com/naibahq/scripts/raw/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
```
3. 选择“安装监控 Agent”。
4. 输入通信域名”data.example.com“。
5. 输入面板通信端口gRPC 端口),默认为 5555。
6. 输入 Agent 密钥Agent 密钥在管理面板中添加服务器时生成,可以在管理面板中的“服务器”页中找到。
7. 等待安装完成后返回 Dashboard 主页查看服务器是否上线。
</details>
### 使用 Agent 内置服务命令安装(支持主流系统)
<details>
<summary>点击展开/收起</summary>
首先获取 Agent 的二进制文件https://github.com/nezhahq/agent/releases
解压后输入以下命令安装服务(可能需要 root 权限):
```bash
./nezha-agent service install -s server_name:port -p password
```
除了服务器地址和密码,还可以添加其它支持的参数。具体参考[自定义 Agent 监控项目](/guide/q7.html)
卸载服务:
```bash
./nezha-agent service uninstall
```
启动服务:
```bash
./nezha-agent service start
```
停止服务:
```bash
./nezha-agent service stop
```
重启服务:
```bash
./nezha-agent service restart
```
</details>
### runit 安装 Agent
<details>
<summary>点击展开/收起</summary>
目前 Agent 内置的服务功能已经支持了绝大部分 init 系统,包括 FreeBSD rc.d 和 openrc。尽管如此还是有一些漏网之鱼。
这里使用 Void Linux 的 runit 作为示例:
1. 创建 `/etc/sv/nezha-agent` 目录:
```bash
mkdir /etc/sv/nezha-agent
```
2. 创建 `/etc/sv/nezha-agent/run` 服务文件,写入以下内容:
```bash
#!/bin/sh
exec 2>&1
exec /opt/nezha/agent/nezha-agent -s server_name:port -p password 2>&1
```
这里同样可以添加其它参数。
3. 创建 `/etc/sv/nezha-agent/log/run`
```bash
#!/bin/sh
exec vlogger -t nezha-agent -p daemon
```
4. 启用服务:
```bash
sudo ln -s /etc/sv/nezha-agent/ /var/service
```
之后可以通过 `sv` 命令来操作服务。
如何查看日志:
1. 安装 `socklog`,并启用:
```bash
sudo xbps-install -S socklog-void
sudo ln -s /etc/sv/socklog-unix /var/service
```
2. 运行 `svlogtail` 查看日志:
```bash
sudo svlogtail | grep nezha-agent
```
</details>
### 在 Windows 中手动安装 Agent
* 请参考社区文章:
[哪吒探针 - Windows 客户端安装](https://nyko.me/2020/12/13/nezha-windows-client.html)
### 在群晖 DSM 中安装 Agent
<details>
<summary>点击展开/收起</summary>
* 请参考社区文章:
[群晖 DSM 7.x 安装 哪吒监控 Agent](https://blog.mitsea.com/3929551d08bd4bb0a8baa453e2d92b0c/)
[哪吒探针——群晖客户端(被控端)安装教程](https://wl.gta5pdx.cn/archives/546/)
* Systemd 实现 *仅适用于 DSM7*:
```sh
# Agent 路径
EXEC="/PATH/TO/nezha-agent"
# 日志路径地址
LOG="${EXEC}.log"
# 额外执行参数, 可留空
ARGS=""
# 哪吒服务端 gRPC 地址
SERVER="HOST_OR_IP:gRPC_PORT"
# 上一步获取的主机密钥
SECRET="APP_SECRET"
# 运行服务的用户名, *强烈建议使用非root用户执行*
RUN_USER="nezha"
# 写入到 systemd 服务文件
cat << EOF > /usr/lib/systemd/system/nezha.service
[Unit]
Description=Nezha Agent Service
After=network.target
[Service]
Type=simple
ExecStart=/bin/nohup ${EXEC} ${ARGS} -s ${SERVER} -p ${SECRET} &>> ${LOG} &
ExecStop=ps -fe |grep nezha-agent|awk '{print \$2}'|xargs kill
User=${RUN_USER
}
Restart=on-abort
[Install]
WantedBy=multi-user.target
EOF
# 重载服务
systemctl daemon-reload
# 启动服务
systemctl start nezha
# 服务自启动
systemctl enable nezha
```
‼️修改对应信息后‼️
使用 `root` 账号执行上述命令即可安装完成。
</details>
### 在 macOS 中使用 Homebrew 安装 Agent
<details>
<summary>点击展开/收起</summary>
***本节内容改编自 [🐿️松鼠收集🌰](https://blog.mre.red/archives/install_nezha_monitoring_agent_service_with_homebrew),改编已获得原作者授权***
::: warning
请务必先添加环境变量,再通过 Homebrew 安装 nezha-agent
因 Homebrew 在软件安装时创建服务所需 plist 文件,若先安装再添加环境变量,会因缺少参数而启动失败。
:::
1. 添加环境变量:
```shell
echo 'export HOMEBREW_NEZHA_AGENT_PASSWORD="通信密钥,在服务页面获取"' >> ~/.zshrc
echo 'export HOMEBREW_NEZHA_AGENT_SERVER="你的服务器和端口,格式 your.domain:5555 "' >> ~/.zshrc
source ~/.zshrc
```
2. 安装 Nezha Agent
::: danger
请注意,此 Homebrew 仓库由第三方维护,与哪吒监控无关。
Nezha 项目组不对该仓库的可用性和安全性等方面作出背书。在使用前,请自行评估风险!
:::
由于暂未提交到 Homebrew Core 官方库,暂时放在上述博客作者参与维护的 [第三方 Homebrew 仓库](https://github.com/Brewforge/homebrew-chinese) 中:
```shell
brew install brewforge/chinese/nezha-agent
```
3. 通过 Homebrew 启动 Nezha Agent 服务:
```shell
brew services start nezha-agent
```
4. 检查服务状态:
```shell
brew services info nezha-agent
```
5. 停止服务:
```shell
brew services stop nezha-agent
```
6. 卸载 Nezha Agent
```shell
brew rm nezha-agent
```
7. 报错时先检查环境变量:
```shell
echo $HOMEBREW_NEZHA_AGENT_PASSWORD
echo $HOMEBREW_NEZHA_AGENT_SERVER
```
8. 若环境变量配置正确,再尝试重装:
```shell
brew services stop nezha-agent
brew reinstall nezha-agent
brew services start nezha-agent
```
9. 若仍未解决,请前往上述 [第三方 Homebrew 仓库](https://github.com/Brewforge/homebrew-chinese) 提交 issue。
</details>
### 在 OpenWRT 中安装 Agent
<details>
<summary>点击展开/收起</summary>
**如何一步到位,解决安装过程中的疑难杂症?**
* 请参考项目:
[NZ-OpenWrt](https://github.com/dysf888/NZ-OpenWrt)
**如何使旧版 OpenWRT/LEDE 自启动?**
* 请参考项目:
[哪吒监控 For OpenWRT](https://github.com/Erope/openwrt_nezha)
**如何使新版 OpenWRT 自启动? 贡献者:@艾斯德斯**
* 首先在 release 下载对应的二进制解压 zip 包后放置到 `/root`
* 运行 `chmod +x /root/nezha-agent` 赋予执行权限,然后创建 `/etc/init.d/nezha-service`
```shell
#!/bin/sh /etc/rc.common
START=99
USE_PROCD=1
start_service() {
procd_open_instance
procd_set_param command /root/nezha-agent -s 面板通信地址:端口 -p 秘钥 -d
procd_set_param respawn
procd_close_instance
}
stop_service() {
killall nezha-agent
}
restart() {
stop
sleep 2
start
}
```
* 运行 `chmod +x /etc/init.d/nezha-service` 赋予执行权限。
* 启动服务: `/etc/init.d/nezha-service enable && /etc/init.d/nezha-service start`
</details>
## Agent 有 Docker 镜像吗?
**Agent 目前没有推出 Docker 镜像。**
Agent 的设计思路和 Dashboard 相反Dashboard 要尽可能不影响宿主机工作,但 Agent 则需要在宿主机中执行监控服务和运行命令。
将 Agent 放入容器中确实可以继续执行监控任务,但 WebShell 等功能无法正常运行,因此不提供 Docker 镜像。

View File

@ -1,23 +0,0 @@
---
outline: deep
---
# Agent 常见问题
## 后台显示的 IP 和 Agent 实际 IP 不一致?
请查看 [Dashboard 相关-为什么管理面板中显示的 IP 和 Agent 实际 IP 不一致?](/guide/dashboardq.html#为什么管理面板中显示的ip和agent实际ip不一致)。在此不再赘述。
## 一键脚本安装时出错
### curl: Failed to connect to raw.githubusercontent.com......
多出现在中国大陆的服务器中,目前一键脚本只从 Github 直接获取安装脚本,您可以多尝试几次,或者[手动安装 Agent](/guide/agent.html#其他方式安装agent)。另外,也可以自行寻找第三方 Github 加速服务或者镜像,并在一键安装脚本中设置。
### sudo: command not found
请先手动安装 sudo例如在 Ubuntu 中:
```shell
apt install sudo
```

View File

@ -1,392 +0,0 @@
---
outline: deep
---
# API 接口
**哪吒监控支持使用 API 接口查询面板中 Agent 的状态信息**
## 创建 Token
哪吒面板的 API 接口允许使用 Token 认证与 Cookies 认证。要新建一个 Token在进入管理面板后点击右上角的头像选择 “API Token”进入 Token 管理页面。点击 “API Token”自定义备注后点击 “添加”。
如需删除一个 Token请选择相应的 Token点击右侧的删除图标。
::: warning
Token 是 API 接口的鉴权凭据,它对你的面板的信息安全非常重要,请不要泄漏你的 Token 给他人。
:::
## 认证方式
确保在请求头中包含 `Authorization: Token` 进行身份认证。
Token 认证方式:
```
Request Headers:
Authorization: Token
```
## 使用说明
::: warning
下面示例中的负数时间戳为0000-00-00目前表示 Dashboard 上线后该 Agent 从未汇报过,但不建议用正负性判断状态。
:::
::: tip
**请求方式为 `GET`,返回格式为 `JSON`**
:::
### 获取服务器列表
请求:
```
GET /api/v1/server/list?tag=
```
参数:
- `tag`可选ServerTag 是服务器的分组,提供此参数则仅查询该分组中的服务器。
返回示例:
```json
{
"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 /api/v1/server/details?id=&tag=
```
参数:
- `id`可选ServerID多个 ID 以逗号分隔,提供此参数则查询该 ID 对应的服务器,同时无视 `tag` 参数。
- `tag`可选ServerTag提供此参数则仅查询该分组下的服务器。
返回示例:
```json
{
"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.33,
"MemUsed": 14013841408,
"SwapUsed": 0,
"DiskUsed": 2335048912896,
"NetInTransfer": 2710273234,
"NetOutTransfer": 695454765,
"NetInSpeed": 10806,
"NetOutSpeed": 5303,
"Uptime": 331080,
"Load1": 5.23,
"Load5": 4.87,
"Load15": 3.99,
"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
}
}
]
}
```
### 获取 ICMP Ping / TCPing 数据
此 API 无需认证。(除限制游客访问的服务器)
请求:
```
GET /api/v1/monitor/{id}
```
参数:
- `id`必填ServerID只能是一个正整数。
返回示例:
```json
{
"code": 0,
"message": "success",
"result": [
{
"monitor_id": 1,
"server_id": 1,
"monitor_name": "Monitor1",
"server_name": "Server1",
"created_at": [
1722142860000,
1722142920000
],
"avg_delay": [
68.2275,
70.1129
]
},
{
"monitor_id": 2,
"server_id": 1,
"monitor_name": "Monitor2",
"server_name": "Server1",
"created_at": [
1722142860000,
1722142920000
],
"avg_delay": [
66.656,
68.2153
]
},
{
"monitor_id": 3,
"server_id": 1,
"monitor_name": "Monitor3",
"server_name": "Server1",
"created_at": [
1722142860000,
1722142920000
],
"avg_delay": [
61.4525,
62.342
]
}
]
}
```
注: `created_at``avg_delay` 为对应关系。
### 自动注册节点
说明: 用于自动化注册节点的脚本,示例代码详见下文。
参考: [https://github.com/naiba/nezha/pull/472](https://github.com/naiba/nezha/pull/472)
```http
POST /api/v1/server/register?simple=1
```
参数:
- `simple`:(可选) 指定返回数据的格式。
- 当设置为 `simple=1`或者`simple=true` 时,返回的数据仅包含 Token 字符串(如 `8GYwaxYuLfU7zl7ndC`)。
- 其他则返回完整的 JSON 对象:`{"code": 200, "message": "Server created successfully","secret": "8GYwaxYuLfU7zl7ndC"}`
请求体 (Payload):
你可以设置为空内容(`{}`), 然后nezha面板会使用默认值进行填充
- `Name`: 默认是节点的IP
- `Tag`: 默认是 "AutoRegister".
- `Note`:默认是 "".
- `HideForGuest`: 默认是 "on".
你也可以设置自己的请求参数:
```json
{
"Name": "abcd", // 节点名称
"Tag": "", // 标签,可选
"Note": "", // 备注信息,可选
"HideForGuest": "on" // 是否对访客隐藏
}
```
## 使用案例
### 获取所有服务器信息
```python
import requests
url = "http://your-dashboard/api/v1/server/list"
headers = {
"Authorization": "your_token"
}
response = requests.get(url, headers=headers)
data = response.json()
for server in data['result']:
print(f"Server Name: {server['name']}, Last Active: {server['last_active']}, IP: {server['valid_ip']}")
```
### 获取特定服务器详情
```python
import requests
server_id = 1 # 替换为你的服务器ID
url = f"http://your-dashboard/api/v1/server/details?id={server_id}"
headers = {
"Authorization": "your_token"
}
response = requests.get(url, headers=headers)
data = response.json()
server = data['result'][0]
print(f"Server Name: {server['name']}")
print(f"CPU Usage: {server['status']['CPU']}%")
print(f"Memory Used: {server['status']['MemUsed']} bytes")
print(f"Disk Used: {server['status']['DiskUsed']} bytes")
print(f"Network In Speed: {server['status']['NetInSpeed']} bytes/s")
print(f"Network Out Speed: {server['status']['NetOutSpeed']} bytes/s")
```
通过以上示例代码,可以轻松获取和处理服务器的状态信息,从而实现自动化监控和管理。
### 自动注册节点
1. 创建文件 `nezha_register.sh`,将以下内容复制到文件中:
```bash
#!/bin/bash
# Exit if NEZHA_TOKEN is not set
if [ -z "${NEZHA_TOKEN}" ]; then
echo "NEZHA_TOKEN is not set. Exiting."
exit 0
fi
# Set default values if variables are not set
NEZHA_PROBE_ADDRESS="${NEZHA_PROBE_ADDRESS:-probe.example.com}"
NEZHA_PROBE_PORT="${NEZHA_PROBE_PORT:-5555}"
NEZHA_DASHBOARD_URL="${NEZHA_DASHBOARD_URL:-https://nezha.example.com}"
NODE_NAME=${NODE_NAME:-$(hostname)}
# Send POST request and capture response and HTTP status code
response=$(curl -s -o response_body.json -w "%{http_code}" -X POST "${NEZHA_DASHBOARD_URL}/api/v1/server/register?simple=true" \
-H "Content-Type: application/json" \
-H "Authorization: ${NEZHA_TOKEN}" \
-d "{\"Name\": \"${NODE_NAME}\"}")
# Extract HTTP status code and Nezha secret
HTTP_CODE="$response"
NEZHA_SECRET=$(cat response_body.json)
rm -f response_body.json
if [ "$HTTP_CODE" != "200" ]; then
echo "Failed to get Nezha Secret. HTTP status code: $HTTP_CODE"
exit 1
fi
# Additional check for NEZHA_SECRET to ensure it's not JSON-formatted (indicating failure)
if [[ "${NEZHA_SECRET:0:1}" == "{" ]]; then
echo "Failed to get Nezha Secret. Received response: ${NEZHA_SECRET}"
exit 1
fi
# Download and execute the install script with cleanup
curl -fsSL https://raw.githubusercontent.com/nezhahq/scripts/main/install.sh -o nezha.sh && \
chmod +x nezha.sh || { echo "Failed to download or make the script executable"; exit 1; }
# Clean up nezha.sh on exit
trap 'rm -f nezha.sh' EXIT
# Run the Nezha agent installation script
CMD="./nezha.sh install_agent "${NEZHA_PROBE_ADDRESS}" "${NEZHA_PROBE_PORT}" "${NEZHA_SECRET}" --tls"
echo "Run commnad : ${CMD}"
eval $CMD
```
2. 为脚本赋予可执行权限: `chmod +x nezha_register.sh`
3. 从dashboard获取token, 比如为 `POXbxorKJBM8wPMKX8r2PdMblyXvpggB`
4. 配置环境变量
```bash
export NEZHA_TOKEN="POXbxorKJBM8wPMKX8r2PdMblyXvpggB" # 从面板获取
export NEZHA_PROBE_ADDRESS="your_probe_address" # 填写探针地址
export NEZHA_DASHBOARD_URL="https://nezha.example.com" # 修改为你的面板地址
export NEZHA_PROBE_PORT="5555" # 修改为你的探针端口(如有不同)
```
5. 运行注册脚本
```bash
./nezha_register.sh
```
6. 如果脚本成功运行,你会看到类似以下的日志:
```bash
Run command: ./nezha.sh install_agent probe.example.com 5555 YOUR_SECRET --tls
```

View File

@ -1,141 +0,0 @@
---
outline: deep
---
# 安装 Dashboard
## 准备工作
搭建一个哪吒监控,你需要:
1. 一台可以连接公网的服务器,防火墙和安全策略需要放行 8008 和 5555 端口,否则会无法访问和无法接收数据。单核 512MB 内存的服务器配置就足以满足大多数使用场景。
2. 一个已经设置好 A 记录,指向 Dashboard 服务器 IP 的域名。
::: tip
如果你想使用 CDN请准备两个域名一个配置好 CDN 用作公开访问CDN 需要支持 WebSocket 协议;另一个域名不要使用 CDN用作 Agent 端与 Dashboard 的通信。
本文档分别以 "dashboard.example.com" 和 "data.example.com" 两个域名来演示。
:::
3. 一个 Github 账号Gitlab、Gitee
**本文档将以宝塔面板反代 Dashboard 的过程作为示范,随着未来版本的变化,部分功能的入口可能会发生改变,本文档仅供参考。**
:::warning
本项目并不依赖宝塔,你可以选择使用你喜欢的任何服务器面板,或手动安装 Nginx 或 Caddy 来配置 SSL 和反代。
如果你认为没有必要使用 80、443 端口来访问 Dashboard你甚至不需要安装 Nginx 就可以直接使用安装脚本安装并运行哪吒监控。
:::
## 获取 Github 的 Client ID 和密钥
哪吒监控接入 Github、Gitlab、Gitee 作为后台管理员账号。
1. 首先我们需要新建一个验证应用,以 Github 为例,登录 Github 后,打开 https://github.com/settings/developers 依次选择“OAuth Apps” - “New OAuth App”。
`Application name` - 随意填写。
`Homepage URL` - 填写面板的访问域名,如:"http://dashboard.example.com"(你的域名)。
`Authorization callback URL` - 填写回调地址,如:"http://dashboard.example.com/oauth2/callback"(不要忘记`/oauth2/callback`)。
2. 点击 “Register application”。
3. 保存页面中的 Client ID然后点击 “Generate a new client secret“创建一个新的 Client Secret新建的密钥仅会显示一次**请妥善保存**。
## 使用 Cloudflare Access 作为 OAuth2 提供方
对于位于中国大陆的用户,直接连接到 GitHub 可能会遇到困难。如果您在使用 GitHub、GitLab 或 Gitee 作为管理员账户登录时遇到问题,建议切换到使用 [Cloudflare Access 作为 OAuth2 提供方](/guide/q8.html) 进行登录。
### 新建 SaaS-OIDC 应用流程
:::warning
以下步骤适用于已经开始使用 Zero Trust 的用户。如果您尚未使用过 Cloudflare Zero Trust强烈建议您首先阅读 [Cloudflare Access 作为 OAuth2 提供方的使用指南](/guide/q8.html),以了解 Cloudflare Access 的配置示例和流程。
:::
1. 前往 [Zero Trust Dashboard](https://one.dash.cloudflare.com),使用 Cloudflare 账号登录。
2. `My Team` -> `Users` -> `<具体用户>` -> 获取 `User ID` 并保存。
3. `Access` -> `Application` -> `Add an Application`
4. 选择 `SaaS`,在 `Application` 中输入自定义的应用名称(例如 nezha选择 `OIDC` 后点击 `Add application`
5. `Scopes` 选择 `openid`, `email`, `profile`, `groups`
6. `Redirect URLs` 填写你的 callback 地址,例如 `https://dashboard.example.com/oauth2/callback`
7. 保存 `Client ID``Client Secret``Issuer` 地址中协议与域名的部分,例如 `https://xxxxx.cloudflareaccess.com`
**如使用此方式,安装 Dashboard 完成后,需要修改配置文件 `/opt/nezha/dashboard/data/config.yaml`,将 `Endpoint` 配置修改为之前保存的 `Issuer` 地址,例如 `https://xxxxx.cloudflareaccess.com`,保存后需重启 Dashboard。**
## OIDC 验证配置(可选)
哪吒支持自定义 OIDC 验证登录。有关配置详情,请参考文档:[启用 OIDC 认证](/guide/q10.html)。
## 在服务器中安装 Dashboard
在面板服务器中,运行安装脚本:
```bash
curl -L https://raw.githubusercontent.com/nezhahq/scripts/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh
```
如果你的面板服务器位于中国大陆,可以使用镜像:
```bash
curl -L https://gitee.com/naibahq/scripts/raw/main/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh
```
等待 Docker 安装完毕后,分别输入以下值:
- `OAuth提供商` - github、cloudflare、gitlab、gitee 中选择一个。
- `Client ID` - 之前保存的 Client ID。
- `Client Secret` - 之前保存的 Client Secret。
- `用户名` - OAuth 提供商中的用户名/User ID。
- `站点标题` - 自定义站点标题。
- `访问端口` - 公开访问端口,可自定义,默认 8008。
- `Agent的通信端口` - Agent 与 Dashboard 的通信端口,默认 5555。
输入完成后,等待拉取镜像。
安装结束后,如果一切正常,此时你可以访问域名+端口号,如 “http://dashboard.example.com:8008” 来查看面板。
将来如果需要再次运行脚本,可以运行:
```bash
./nezha.sh
```
来打开管理脚本。
## 配置反向代理
在宝塔面板中新建一个站点,域名填写公开访问域名,如 “http://dashboard.example.com“ ,然后点击“设置”进入站点设置选项,选择“反向代理” - “新建反向代理”。
自定义一个代理名称,在下方“目标 URL”中填入 `http://127.0.0.1` 然后点击“保存”。
打开刚刚新建的反向代理右边的“配置文件”,将配置文件替换为以下内容:
```nginx
#PROXY-START/
location / {
proxy_pass http://127.0.0.1:8008;
proxy_set_header Host $http_host;
proxy_set_header Upgrade $http_upgrade;
}
location ~ ^/(ws|terminal/.+|file/.+)$ {
proxy_pass http://127.0.0.1:8008;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
}
#PROXY-END/
```
点击“保存”。
现在你应该可以直接使用域名“http://dashboard.example.com“ 来访问面板了。
### 扩展内容:
CaddyServer v1v2 无需特别配置):
```caddy
proxy /ws http://ip:8008 {
websocket
header_upstream -Origin
}
proxy /terminal/* http://ip:8008 {
websocket
header_upstream -Origin
}
proxy /file/* http://ip:8008 {
websocket
header_upstream -Origin
}
```
## 在宝塔面板中配置 SSL
首先,先暂时关闭反向代理。
正如在其他网站中配置 SSL 证书一样,进入站点设置中的 “SSL”你可以选择自动申请 Let´s Encrypt 证书或手动配置已有的证书。
完成 SSL 的设置后,你需要回到 https://github.com/settings/developers ,编辑之前创建的验证应用程序,将之前我们填入的 "Homepage URL" 和 "Authorization callback URL" 中的域名全部从 `http` 改为 `https`,如:"https://dashboard.example.com" 和 "https://dashboard.example.com/oauth2/callback" **不更改此项可能会导致你无法登录面板后台**。
## 更新 Dashboard
运行脚本 `./nezha.sh` ,选择重启面板并更新。

View File

@ -1,111 +0,0 @@
---
outline: deep
---
# Dashboard 常见问题
## 为什么管理面板中显示的 IP 和 Agent 实际 IP 不一致?
首先解释管理面板中显示的IP是怎么得到的Agent 会每隔一段时间请求一遍 IP-API获取到 IP 信息后上报到 Dashboard目前使用的 IP-API 可在此查看:[myip.go](https://github.com/nezhahq/agent/blob/main/pkg/monitor/myip.go)。
如您发现管理面板中显示的 IP 和服务商提供给您的 IP 不一致,最大的可能是服务商给您的是**入口 IP**,但 Agent 测试的是您的**出口 IP**。这个问题也可能会出现在多线服务器和 IPLC 专线中。
::: tip
举个简单也十分常见的例子,服务商给您提供的是一台高防服务器,为了同时满足高防和低网络中断率的目标,提供给您的 IP 可能是经过映射后的高防 IP 而并非您服务器的真实出口 IP。
:::
您也可以在 Agent 服务器中运行以下命令测试出口 IP:
```shell
curl https://ipapi.co/ip/
curl ip.sb
curl ip-api.com
```
## 忘记查看密码\删除查看密码
请查看或编辑 `/opt/nezha/dashboard/data/config.yaml` 文件。
密码位于 `site-viewpassword` 项中。
## 面板安装/重启/更新失败: iptables ......
首先尝试重启 Docker 再操作:
```shell
systemctl status docker
systemctl restart docker
systemctl status docker
```
重启后尝试重新安装面板。
若依然出现 iptables... 等错误,则考虑直接关闭 iptables 甚至移除 iptables。
这个问题也可能与内核有关,也可以尝试更换官方内核。
## 面板重启失败Invalid hostPort: nz_site_port 等
如出现此问题,可以通过安装脚本修改配置,或者直接修改 `/opt/nezha/dashboard/docker-compose.yaml` 文件。
## 面板布局错误、CSS 资源无法被加载
如果出现 Dashboard 页面布局错误,通常是 CSS 文件丢失或无法被加载。
出现此类错误,可以先尝试 `重启并更新面板`
如果更新面板后问题没有得到解决,那么可能是你的 vhost 配置文件内有不适用的配置,你可以编辑 Nginx 的 vhost 文件或在宝塔面板内:
1. 在 `网站` 中找到安装 Dashboard 时配置的站点,点击右侧 `设置`
2. 选择 `配置文件`,删除配置文件中的:
```nginx
location ~ .*\.(js|css)?$
{
expires 12h;
error_log /dev/null;
access_log /dev/null;
}
```
3. 保存配置并清空浏览器、Nginx、CDN 中的缓存,此时刷新页面应恢复正常。
## 面板无法启动panic无法找到配置的 DDNS 提供者...
填入的 DDNS provider 的值有误,目前仅支持 `webhook``cloudflare``tencentcloud``dummy`
## 面板更新 DDNS 崩溃panicinterface conversion: interface {} is nil, not []interface {}
填入的 DDNS `AccessID``AccessSecret` 有误。
## 面板警告NEZHA>> 错误的服务监控上报...
1. Dashboard 与 Agent 版本不兼容导致含有对端不支持的 `TaskType` 导致,全部更新至最新版本即可解决。
2. Dashboard v0.17.10 - v0.18.0 也存在此问题,更新至最新版本可以解决。
## 无法启动 Agent 服务Unix syslog delivery error
此报错见于 Agent v0.16.9+。原因为系统的 `/dev/log` 套接字工作不正常或不存在。可参考 <https://unix.stackexchange.com/questions/317064/how-do-i-restore-dev-log-in-systemdrsyslog-host> 解决。如果使用的是 Docker请避免使用 `systemd` 等 init 系统。
## 打开网络监控页显示server monitor history not found
出现此错误说明没有在服务页中设置 TCP-Ping 和 ICMP-Ping 类型的监控或者监控数据还未生成。
如已经设置完毕,可以等待一段时间后再查看。
## 启用 HTTPS 后 /terminal 或 /ws 不能正常连接
常常是由于证书不完整造成的,请在 agent 运行参数中添加 -d若 log 中有 `x509:certificate signed by unknown authority`,更换完整证书则可解决该问题。
## 对面板提供的数据修改/增加功能不满意,想要修改/增加数据
常见于批量新建 Agent 等需求中,可以直接修改数据库。
请注意,数据库中并非什么都可以修改,错误的修改会导致数据混乱无法启动 Dashboard**请勿随意修改数据库!**
::: danger
再重复一遍,**请勿随意修改数据库!**
:::
如需要在数据库中修改数据,请先**停止**面板容器再修改。
数据库类型是 sqlite3位于 `/opt/nezha/dashboard/data/sqlite.db`,修改前请备份。
## Dashboard 会自动更新吗?
Agent 通常情况下会自动更新,但 Dashboard 并不会,需要手动更新。
## 连接在线终端时提示:`Agent 信令下发失败`
当 Agent 离线,或与 Dashboard 之间的连接不稳定时,可能会导致在线终端无法正常连接。
请检查 Agent 是否正常运行,是否与 Dashboard 保持稳定的连接。

View File

@ -1,77 +0,0 @@
---
outline: deep
---
# DDNS
DDNS 功能适用于使用动态 IP 的服务器,当 Agent 上报了一个新的 IP10分钟一次Dashboard 会根据配置自动更新 DNS 记录。
## 为什么我要使用哪吒监控的 DDNS 功能?
- 方便集中管理 DDNS 设置,而不是在每台服务器上都部署一个 DDNS 服务。
- 仅在面板服务器上保存您的机密信息,防止外泄。
## 配置说明
可以直接在 Dashboard 管理页面中添加 DDNS 配置。
1. 点击菜单栏中的“动态 DNS”选项进入配置页面。
2. 点击“新配置”按钮,在弹出窗口中按需填写信息。选项说明:
- **名称**:配置名称。
- **DDNS供应商**:供应商类型,决定了使用何种方法更新 DNS 记录。
- **域名(逗号分隔)**:域名,如填写多个域名需要用 `,` 分隔。支持 IDN国际化域名
- **最大重试次数**DDNS 更新尝试次数,默认为 3范围为 1 到 10 的整数。
- **DDNS 凭据 1** 以及 **DDNS 凭据 2** 为选填,通常需要至少填 1 个。下面的[表格](#供应商列表)列出了所有供应商的对应选项。
3. 如果使用 `webhook` 供应商,那么需要按需填写 Webhook 的对应选项。具体的说明请见 [Webhook 配置说明](#webhook-配置说明)。
4. 需要至少勾选 **启用DDNS IPv4****启用DDNS IPv6** 中的一个,否则不会进行任何更新操作。
5. 在添加了新的配置后,还需要修改服务器配置才能使 DDNS 生效。服务器相关选项说明:
- **启用 DDNS**:为此服务器启用 DDNS 功能。
- **DDNS 配置**:要使用的 DDNS 配置 ID 列表,可以根据配置名称进行搜索。
## Webhook 配置说明
Webhook 需要自行构建 HTTP 请求,适用于需要使用其它供应商的服务且操作较为简单的情况。
Webhook 相关选项说明:
- **Webhook 地址**HTTP 请求 URL。其中只有参数可以使用占位符。
- **Webhook 请求方式**HTTP 请求方式。支持 `GET``POST``PATCH``DELETE` 以及 `PUT`
- **Webhook 请求类型**HTTP 请求体格式,为 `JSON` 或者 `Form`
- **Webhook 请求头**HTTP 请求头,用 JSON 填写,注意不支持嵌套。
- **Webhook 请求体**HTTP 请求体,`GET``DELETE` 不会使用。如需使用嵌套格式,必须选择 `JSON` 作为请求类型。
Webhook 支持的占位符:
- `#ip#`:主机 IP。
- `#domain#`DDNS 域名。每个域名的请求是分别进行的,所以此项的值只会是单个域名字符串。
- `#type#`IP 类型,值为 `"ipv4"``"ipv6"`
- `#record#`:记录类型,值为 `"A"``"AAAA"`
- `#access_id#`DDNS 凭据 1。
- `#access_secret#`DDNS 凭据 2。
### 花生壳 Webhook 示例
<details>
<summary>点击展开/收起</summary>
- URL`http://ddns.oray.com/ph/update?hostname=#domain#&myip=#ip#`
- 请求方式: `GET`
- 请求头:`{"Authorization": "Basic pass"}`,把 `pass` 替换成你的用户名:密码的 Base64 编码(例如,`user:pass``dXNlcjpwYXNzCg==`)。
- 花生壳只支持 A 记录,所以只勾选启用 IPv4。其它 Webhook 选项不需要填。
</details>
## 供应商列表
| 供应商 | 凭据1ID | 凭据2Secret |
| ------------ | ----------- | --------------- |
| `dummy` | ❌️ | ❌️ |
| `webhook` | 可选 | 可选 |
| `cloudflare` | ❌️ | ✅ |
| `tencentcloud`| ✅ | ✅ |
## 查看日志
在 Dashboard 的日志中,可以看到 DDNS 功能的相关日志,配置正确时,更新 DNS 记录时会有相应的日志记录。
```shell
dashboard_1 | 2024/03/16 23:16:25 NEZHA>> 正在尝试更新域名(ddns.example.com)DDNS(1/3)
dashboard_1 | 2024/03/16 23:16:28 NEZHA>> 尝试更新域名(ddns.example.com)DDNS成功
```

View File

@ -1,65 +0,0 @@
---
outline: deep
---
# 登录常见问题
## 登录回调后页面卡住\拒绝连接\响应时间过长
还有其他一些表现形式,总之登录后浏览器无法正常显示。
1. 您的服务器无法连接到 Github/Gitee最常见于国内服务器配置 Github 情况下,可以考虑多尝试几次或者切换到 Cloudflare Access。
2. 您配置错了回调地址,确保您的回调地址正确且**端口与协议**均正确!
3. Dashboard 发生未知错误,您可以使用脚本查看日志。
::: tip
什么是协议?
在浏览器中,您的域名以 `://` 结尾的字符串即为协议,通常为 `http``https` 两种。由于正常部署情况下面板可能有多种协议+域名+端口组合均可访问,请务必选一个最合适的作为回调。
:::
### 如何检查我的回调地址是否错误?
请确保登录前浏览器显示的协议+域名+端口和登录后跳转到的协议+域名+端口一致。
请确保您的路径为 `/oauth2/callback`**全部小写**。
## 登录后面板报错
### http: named cookie not present
1. 清理 cookies 后重新登录,或换个浏览器。
2. 检查回调地址,确保您的回调地址正确且**端口与协议**均正确!发起请求的地址需要和回调地址处于同域,端口、协议和域名(或IP)都需要一致。
### lookup xxx
容器 DNS 解析失败,多数情况下为修改了 iptables 相关配置。
建议先重启 docker`sudo systemctl restart docker`,再使用脚本重启面板。
仍然出现 lookup 错误建议查看是否有其他控制 iptables 的工具,如宝塔防火墙等。
这个问题也可能与内核有关系,请尝试更换官方内核。
### 授权方式无效,或者登录回调地址无效、过期或已被撤销
只出现在 Gitee 登录方式中,原因不明,建议更换到 GitHub。
### oauth2: server response missing access_token
可能由多种因素引起,最大可能性是网络问题,建议检查网络后重试。
无法解决的话建议更换 Github 等。
### 该用户不是本站点管理员,无法登录
您登陆错了账号或者配置错了用户名,注意**用户名不是邮箱**,可使用脚本修改。
Cloudflare Access 用户请注意,您的用户名不是邮箱,而是 User ID。
### dial tcp xxx:443 i/o timeout
网络问题,可先重启 Docker`sudo systemctl restart docker`,再使用脚本重启面板。
如为国内服务器配置 Github 登陆方式,则建议切换到 Cloudflare Access 以避免网络干扰。
### net/http: TLS handshake timeout
同上。
### 使用 Cloudflare Access 作为 OAuth2 提供方时无法收到邮件验证码
- 确认在 `Policies` 中已正确配置了邮件验证策略。
- 检查您提供的邮箱地址是否正确无误。注意,不在策略白名单中的邮箱地址将不会接收到验证码。

View File

@ -1,34 +0,0 @@
---
outline: deep
---
# 内网穿透功能配置
哪吒服务器监控提供内置的内网穿透功能,允许用户通过设定 Dashboard 作为服务端,将运行在 Agent 上的内网服务(如家庭 OpenWrt 路由器、NAS 设备等)映射到公网上,便于外部访问。目前仅支持明文 HTTP 的穿透。
## 准备工作
在配置内网穿透前,请确保完成以下准备工作:
- 确认已在您的设备上安装并运行哪吒监控的 Agent并保持其与 Dashboard 的连接状态。
- 准备一个公网域名,推荐使用子域名进行操作,如`service-1.example.com`。将此域名解析指向 Dashboard 服务器的公网 IP 地址。
- 请注意,一个域名只能映射到一个 Agent 的内网服务。若需映射多个服务,请分别使用不同的域名,例如 `service-2.example.com`
::: warning
如果您的 Dashboard 服务器使用宝塔面板或其他管理工具,请确保所用域名,如 `service-1.example.com` 已在该面板中正确绑定至 Dashboard 站点,否则可能导致无法访问。
:::
## 内网穿透配置步骤
1. 登录至 Dashboard 管理页面,选择菜单栏中的“内网穿透”选项。
2. 点击“添加”按钮,并填写以下所需信息:
- **穿透名称**:为此穿透配置自定义一个名称,如`OpenWrt 登录页`
- **Agent ID**:填写需要进行穿透的 Agent 的 ID。
- **内网服务地址**:填写需穿透的内网服务地址,格式为 `IP:端口`,例如 `127.0.0.1:80`
- **绑定域名**:填写已准备的公网域名,如 `service-1.example.com`。如果面板使用了非标准端口访问(比如默认的 `8008`),需要手动添加才可以生效。
3. 完成填写后,点击“新增”按钮,等待穿透生效。
4. 尝试访问 `http://service-1.example.com`,以验证是否成功映射至 Agent 上的内网服务。
## 使用须知
- 保持 Agent 与 Dashboard 之间的连接是内网穿透功能正常运作的前提。若 Agent 连接中断,已配置的穿透将暂时失效。
- 考虑到内网穿透隧道本身不加密数据,建议在 Agent 与 Dashboard 之间以及 Dashboard 与客户端浏览器之间均**使用 TLS/SSL**,以确保数据传输过程的安全性。

View File

@ -1,368 +0,0 @@
---
outline: deep
---
# 通知设置
哪吒监控支持对服务器的负载、CPU、内存、硬盘、流量、月流量、进程数、连接数进行监控并在达到用户设定的阈值时发送告警通知。
## 灵活的通知方式
- 在面板消息中,占位符 `#DATETIME#` 代表事件发生的时间戳。当通知被触发时,面板会自动将 `#DATETIME#` 替换为事件的实际时间。
- `#NEZHA#` 是面板消息占位符,面板触发通知时会自动用实际消息替换占位符。
- Body 内容是 `JSON` 格式的:**当请求类型为 FORM 时**,值为 `key:value` 的形式,`value` 里面可放置占位符,通知时会自动替换。**当请求类型为 JSON 时** 只会简单进行字符串替换后直接提交到 `URL`
- URL 里面也可放置占位符,请求时会进行简单的字符串替换。
**请参考以下的通知方式示例,也可以根据自己的需求灵活设置推送方式。**
### Bark 示例
<details>
<summary>点击展开/收起</summary>
- 名称Bark
- URL 组成: /:key/:body or /:key/:title/:body or /:key/:category/:title/:body
- 请求方式: GET
- 请求类型: 默认
- Body: 空
- 名称Bark
- URL 组成: /push
- 请求方式: POST
- 请求类型: form
- Body: `{"title": "#SERVER.NAME#","device_key":"xxxxxxxxx","body":"#NEZHA#","icon":"https://xxxxxxxx/nz.png"}`
</details>
### Slack 示例 贡献者:[@白歌](https://github.com/cantoblanco)
<details>
<summary>点击展开/收起</summary>
#### URL 参数获取说明
请提前准备好 Slack 的 Workspace 并为这个 Workspace 创建一个 App。如果你还没有创建可以在 [Slack API](https://api.slack.com/apps) 创建一个 App。
创建完成 App 后,需要为这个 App 添加一个 Incoming Webhook。在 App 的设置页面中找到 Incoming Webhooks将 Activate Incoming Webhooks 勾选为 ON在页面下方找到并点击 Add New Webhook to Workspace选择一个 Channel然后点击允许。完成创建后你会得到一个 Webhook URL使用这个 URL 替换下方的示例 URL。
- 名称Slack
- URLhttps://hooks.slack.com/services/xxxxxxxxx/xxxxxxxxx/xxxxxxxxxxxxxxxxxxxxxxxx
- 请求方式: POST
- 请求类型: JSON
- Body: `{"text":"#NEZHA#"}`
</details>
### Server 酱示例
<details>
<summary>点击展开/收起</summary>
- 名称Server 酱
- URLhttps://sc.ftqq.com/SCUrandomkeys.send?title=哪吒告警信息&desp=#NEZHA#
- 请求方式: GET
- 请求类型: 默认
- Body: 空
**Server 酱进阶**
- 名称Server 酱
- URLhttps://sc.ftqq.com/SCUrandomkeys.send
- 请求方式: POST
- 请求类型: FORM
- Body:
```json
{
"title": "#SERVER.NAME#",
"desp": "**#NEZHA#\n\n平均负载: \"#SERVER.LOAD1#\",\"#SERVER.LOAD5#\",\"#SERVER.LOAD15#\"\n\n## [点击访问面板](https://你的面板域名)\n\n![logo](https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.svg)"
}
```
![展示](https://github.com/iilemon/nezhahq.github.io/blob/main/docs/images/photo_2023-03-16_00-22-47a.jpg?raw=true)
</details>
### Telegram 示例 贡献者:[@白歌](https://github.com/cantoblanco)
<details>
<summary>点击展开/收起</summary>
#### URL 参数获取说明
请提前在 Telegram 中创建一个机器人,获取到机器人的 token 和你的 Telegram 用户 ID。
机器人的 token 和用户 ID 都是数字和字母的组合,可以在 Telegram 中与 @userinfobot 对话获取自己的用户 ID。与 @BotFather 对话,输入命令 /newbot 创建一个机器人,创建完成后可以获得机器人的 token。
得到的 token 和用户 ID 都是字符串,可以直接拼接到 URL 中,如下所示,将 botXXXXXX 中的 XXXXXX 替换为你的机器人 token要保留其中的 bot将 YYYYYY 替换为你的用户 ID。注意你需要先与机器人对话否则机器人无法发送消息给你。#NEZHA# 是占位符,不要修改和删除
- 名称Telegram
- URLhttps://api.telegram.org/botXXXXXX/sendMessage?chat_id=YYYYYY&text=#NEZHA#
- 请求方式: GET
- 请求类型: 默认
- Body: 留空
</details>
### wxpusher 示例
**需要提前关注你的应用**
<details>
<summary>点击展开/收起</summary>
- 名称: wxpusher
- URLhttp://wxpusher.zjiecode.com/api/send/message
- 请求方式: POST
- 请求类型: JSON
- Body: `{"appToken":"你的appToken","topicIds":[],"content":"#NEZHA#","contentType":"1","uids":["你的uid"]}`
</details>
### 邮件通知示例 - SendCloud 贡献者:[@白歌](https://github.com/cantoblanco)
<details>
<summary>点击展开/收起</summary>
**注意SendCloud 有每日免费发送邮件限额限制,这里仅作示例,你可以选择付费服务或其他类似的免费服务,使用方法类似。**
#### URL 参数获取说明
该示例使用 SendCloud 作为发信服务,需提前在 [SendCloud](https://www.sendcloud.net/) 注册账号,创建发件邮箱,然后在[这里](https://www.sendcloud.net/sendSetting/apiuser)获取 APIUSER 和 APIKEY。
替换示例 URL 中的 `<替换APIUSER>``<替换APIKEY>` 为自己的 APIUSER 和 APIKEY替换 URL 中的 `<自定义发件邮箱>``<自定义收件邮箱>` 为任意的的发件邮箱和收件邮箱。
- 名称:邮件告警
- URLhttps://api.sendcloud.net/apiv2/mail/send?apiUser=<替换APIUSER>&apiKey=<替换APIKEY>&from=<自定义发件邮箱>&fromName=Nezha&to=<自定义收件邮箱>&subject=Nezha-Notification&html=#NEZHA#
- 请求方式: POST
- 请求类型: JSON
- Header: 留空
- Body: 留空
</details>
### 钉钉群机器人配置 示例
<details>
<summary>点击展开/收起</summary>
#### URL 参数获取说明
请提前在钉钉中创建一个机器人,获取到机器人的 token。
机器人 URL 在钉钉群 - 管理机器人 - 创建机器人后获取安全方式选择自定义关键词Body 中 content 值内需包含该关键词。
- 名称: 哪吒探针小跟班
- URLhttps://oapi.dingtalk.com/robot/send?access_token=xxxxxxxxxxxxxxxxx
- 请求方式: POST
- 请求类型: JSON
- Header: `{"Content-Type": "application/json"}`
- Body: `{"msgtype": "text","text": {"content":"哪吒探针:\n#NEZHA#"}}`
</details>
### 企业微信群机器人 示例 贡献者:[@ChowRex](https://github.com/ChowRex)
<details>
<summary>点击展开/收起</summary>
支持的占位符一览
```json
{
"content": "#NEZHA#",
"ServerName": "#SERVER.NAME#",
"ServerIP": "#SERVER.IP#",
"ServerIPV4": "#SERVER.IPV4#",
"ServerIPV6": "#SERVER.IPV6#",
"CPU": "#SERVER.CPU#",
"MEM": "#SERVER.MEM#",
"SWAP": "#SERVER.SWAP#",
"DISK": "#SERVER.DISK#",
"NetInSpeed": "#SERVER.NETINSPEED#",
"NetOutSpeed": "#SERVER.NETOUTSPEED#",
"TransferIn": "#SERVER.TRANSFERIN#",
"TranferOut": "#SERVER.TRANSFEROUT#",
"Load1": "#SERVER.LOAD1#",
"Load5": "#SERVER.LOAD5#",
"Load15": "#SERVER.LOAD15#",
"TCP_CONN_COUNT": "#SERVER.TCPCONNCOUNT", # 无效
"UDP_CONN_COUNT": "#SERVER.UDPCONNCOUNT", # 无效
}
```
> [群机器人配置说明 - 文档 - 企业微信开发者中心](https://developer.work.weixin.qq.com/document/path/91770#markdown%E7%B1%BB%E5%9E%8B)
- 名称:企业微信群机器人
- URLhttps://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=YOUR_BOT_KEY
- 请求方式: POST
- 请求类型: JSON
- Body:
```json
{
"msgtype": "markdown",
"markdown": {
"content": "# 哪吒通知消息\n\n\"#NEZHA#\"\n\n> 名称: \"#SERVER.NAME#\"\n> IP: \"#SERVER.IP#\"\n> IPv4: \"#SERVER.IPV4#\"\n> IPv6: \"#SERVER.IPV6#\"\n> CPU: \"#SERVER.CPU#\"\n> 内存: \"#SERVER.MEM#\"\n> 交换分区: \"#SERVER.SWAP#\"\n> 存储: \"#SERVER.DISK#\"\n> 实时上传速度: \"#SERVER.NETINSPEED#\"\n> 实时下载速度: \"#SERVER.NETOUTSPEED#\"\n> 总上传: \"#SERVER.TRANSFERIN#\"\n> 总下载: \"#SERVER.TRANSFEROUT#\"\n> 1分钟内负载: \"#SERVER.LOAD1#\"\n> 5分钟内负载: \"#SERVER.LOAD5#\"\n> 15分钟内负载: \"#SERVER.LOAD15#\"\n> TCP连接数: \"#SERVER.TCPCONNCOUNT\"\n> UDP连接数: \"#SERVER.UDPCONNCOUNT\"\n\n"
}
}
```
根据需求删减相关内容信息即可。
![通知效果](https://user-images.githubusercontent.com/30169860/223605620-eac53ee6-09f9-4583-94fa-9b0cdedba81c.png)
</details>
### 飞书群机器人配置 示例 贡献者:[@eya46](https://github.com/eya46)
<details>
<summary>点击展开/收起</summary>
#### URL 参数获取说明
机器人 URL 通过飞书群 - 群机器人 - 添加机器人 - 自定义机器人(webhook)创建后获取。
- 名称: 哪吒面板 Bot
- URLhttps://open.feishu.cn/open-apis/bot/v2/hook/xxxxxxxxxxxxxxxxx
- 请求方式: POST
- 请求类型: JSON
- Body: `{"content":{"text":"#NEZHA#\n#DATETIME#"},"msg_type":"text"}`
</details>
### Matrix 通知示例
<details>
<summary>点击展开/收起</summary>
#### 参数说明
* 以 `$` 开头的大写变量都需要替换为你的实际值。
* **`YOUR_HOME_SERVER`**: Matrix 服务器的地址。
* **`YOUR_NEZHA_URL`**: 你的哪吒面板的 URL。
* **`YOUR_MATRIX_USERNAME`** 和 **`YOUR_MATRIX_PASSWD`**: Matrix 用户名和密码。
* **`YOUR_MATRIX_TOKEN`** 获取方式:
```sh
curl -XPOST -d '{"type": "m.login.password", "identifier": {"user": "$YOUR_MATRIX_USERNAME", "type": "m.id.user"}, "password": "$YOUR_MATRIX_PASSWD"}' "https://$YOUR_HOME_SERVER/_matrix/client/r0/login"
```
#### 请求配置
- **名称**: Matrix
- **URL**: `https://$YOUR_HOME_SERVER/_matrix/client/r0/rooms/$ROOM_ID/send/m.room.message`
- **请求方式**: `POST`
- **请求类型**: `JSON`
- **Header**:
```json
{
"Authorization": "Bearer $YOUR_MATRIX_TOKEN"
}
```
- **Body**:
```json
{
"msgtype": "m.text",
"format": "org.matrix.custom.html",
"formatted_body": "<html><head><title>Nezha Dashboard</title></head><body><h1><a href=\"$YOUR_NEZHA_URL\" target=\"_blank\">Nezha Dashboard</a></h1><ul><li>datetime: #DATETIME#</li><li>Message: #NEZHA#</li></ul></body></html>",
"body": "#NEZHA#"
}
```
#### 使用步骤
1. **替换变量**: 将 `$YOUR_HOME_SERVER`, `$YOUR_NEZHA_URL`, `$YOUR_MATRIX_USERNAME`, `$YOUR_MATRIX_PASSWD`, 以及 `$YOUR_MATRIX_TOKEN` 替换为你自己的值。
2. **获取 Token**: 使用上面提供的 `curl` 命令来获取 `YOUR_MATRIX_TOKEN`,确保替换所有相关的变量。
3. **配置请求**: 使用上述配置来设置你的请求,确保使用正确的 URL、请求头和请求体。
4. **发送通知**: 通过配置后的请求发送 Matrix 消息,完成哪吒监控的通知集成。
这样设置好后,每次触发通知时,你的 Matrix 房间中就会收到格式化的哪吒面板信息。
</details>
## 告警规则说明
### 基本规则
- `type`:可选取一个或多个类型,如在一个规则中选择了多个类型,需要**同时满足**所有选择的类型才会触发通知(可参考后面的示例)
- `cpu``gpu``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` 连接数
- `temperature_max` 最高温度值
- `duration`:持续数秒,数秒内采样记录 30% 以上触发阈值才会告警(防数据插针)
- `min``max`
- 流量、网速类单位为字节1KB=1024B1MB=1024*1024B
- 内存、硬盘、CPU 以占用百分比计数
- 离线监控无需设置此项
- `cover`
- `0` 监控所有服务器,通过 `ignore` 忽略特定服务器
- `1` 忽略所有服务器,通过 `ignore` 监控特定服务器
例如:`[{"type":"offline","duration":10, "cover":0, "ignore":{"5": true}}]`
- `ignore`:选择忽略特定服务器,搭配 `cover` 使用,内容为服务器 ID 和布尔值,例如:`{"1": true, "2": false}`
**完整示例:**
添加一个离线告警:
- 名称:离线通知
- 规则:`[{"Type":"offline","Duration":10}]`
- 启用:√
添加一个监控 CPU 持续 10 秒超过 50% **且** 内存持续 20 秒占用低于 20% 的告警:
- 名称CPU+内存
- 规则:`[{"Type":"cpu","Min":0,"Max":50,"Duration":10},{"Type":"memory","Min":20,"Max":0,"Duration":20}]`
- 启用:√
将特定的服务器通知发送到特定的通知分组:
示例场景:
有 1、2、3、4 四台服务器和 A、B 两个不同的通知组。
1、2 这两台服务器掉线十分钟后给通知组 A 发送通知。
3、4 这两台服务器掉线十分钟后给通知组 B 发送通知。
首先你需要先设置好 A、B 两个通知组,然后添加两条告警规则:
**规则一:**
- 名称1、2 离线,发送给通知组 A
- 规则:`[{"type":"offline","duration":600,"cover":1,"ignore":{"1":true,"2":true}}]`
- 通知方式组A
- 启用:√
**规则二:**
- 名称3、4 离线,发送给通知组 B
- 规则:`[{"type":"offline","duration":600,"cover":1,"ignore":{"3":true,"4":true}}]`
- 通知方式组B
- 启用:√
**灵活使用参数可以让你的告警功能被充分使用**
### 特殊:任意周期流量告警
可以用作月流量监控
- `type`
- `transfer_in_cycle` 周期内的入站流量
- `transfer_out_cycle` 周期内的出站流量
- `transfer_all_cycle` 周期内双向流量的和
- `cycle_start`:统计周期开始日期(可以是你机器计费周期的开始日期),时间格式为 RFC3339例如北京时间为 `2022-01-11T08:00:00.00+08:00`
- `cycle_interval`:统计周期单位的数量(例如,周期单位为天,该值为 7则代表每隔 7 天统计一次)
- `cycle_unit`:统计周期单位,默认 `hour`,可选(`hour`, `day`, `week`, `month`, `year`
- `min/max``cover``ignore` 参考基本规则配置
示例:
ID 为 3 和 4 的服务器ignore 里面定义),以每月 1 号为统计周期,周期内统计的出站月流量达到 1TB 时告警:
```json
[{"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}}]
```
::: tip
如果对告警配置仍感到有困难,可以试试以下第三方配置生成器简化操作。哪吒监控不对生成配置的功能性作任何保证。
- [Nezha Rule Generator](https://nz.sina.us.kg/): 适用绝大多数场景
- [Nezha-Traffic-Alarm-Generator](https://wiziscool.github.io/Nezha-Traffic-Alarm-Generator/): 适用于生成周期流量告警规则,且更加方便一些
:::
## 通知触发模式
- **始终触发**:每当 Agent 上报的状态符合告警的规则时,都会触发一次通知。
- **单次触发**:仅状态改变时触发一次通知,如从正常状态改变为异常状态,或异常状态恢复为正常状态。
## 设置告警时执行任务
如果需要在发出告警消息的同时执行某项任务,可以设置此项目。
- **告警时触发任务**:当告警状态符合从“正常”变更为“事件”时,所要执行的任务,任务应提前在任务页设置。
- **恢复时触发任务**:当告警状态符合从“事件”恢复为“正常”时,所要执行的任务,任务应提前在任务页设置。

View File

@ -1,86 +0,0 @@
# 反向代理 Telegram Bot API
如果你的 Dashboard 服务器无法访问 Telegram Bot API但你依然想使用 Telegram 来推送通知,你可以尝试使用反向代理的方式解决这个问题。
## 准备工作
**这里介绍使用你自己的服务器进行反代的方法。你也可以选择使用 Cloudflare 的 Workers 进行反代,但可能对于中国大陆的用户来说网络连通性依然不佳。**
要搭建一个 Telegram Bot API 反代,你需要准备以下内容:
1. 一个可以连接 Telegram Bot API 服务器(并安装好 Nginx
2. 一个域名(提前申请 SSL 证书)。
## NGINX 配置
编辑 Nginx 配置文件,在 `http{}` 中添加如下配置:
```nginx
# HTTP 强制跳转到 HTTPS
server {
listen 80;
listen [::]:80;
server_name <yourDomainName>;
# 强制 HTTPS
return 301 https://$server_name$request_uri;
}
# HTTPS 配置
server {
listen 443 ssl;
listen [::]:443 ssl;
server_name <yourDomainName>;
# SSL 证书路径
ssl_certificate </path/to/your/server.pem>;
ssl_certificate_key </path/to/your/server.key>;
# Root 非必要
root /var/www/tgbot/;
# 必须配置 DNS否则会报 502 错误
resolver 8.8.8.8;
# 以 /bot 开头的请求会被正则匹配
location ~* ^/bot {
proxy_buffering off;
proxy_pass https://api.telegram.org$request_uri;
proxy_http_version 1.1;
}
# Root 非必要,主要用于确认服务器状态。也可以改为 return 403
location / {
try_files $uri $uri /index.html;
}
# 错误日志
error_log /var/log/tg.log error;
}
```
- `yourDomainName`:你准备的域名
- `ssl_certificate`SSL 证书路径
- `ssl_certificate_key`SSL 证书路径
## 使用方式
执行 `systemctl restart nginx` 重启 Nginx。然后在 Nezha 中将原来的 `https://api.telegram.org/` 替换为 `https://<yourDomainName>/`,即可正常推送消息。
## 防止盗用
配置防火墙以防止他人盗用你的反代服务:
- `serverIp`Agent 的 IP 地址。根据你的系统选择适用的命令,`ufw``iptables` 均可。
```bash
# Ubuntu
ufw allow proto tcp from <serverIp> to any port 443
# CentOS
iptables -I INPUT -p tcp --dport 443 -j DROP
iptables -I INPUT -s <serverIp> -p tcp --dport 443 -j ACCEPT
```
通过以上配置,可以有效防止未经授权的访问。

View File

@ -1,28 +0,0 @@
---
outline: deep
---
# 配置OIDC认证
修改 `config.yaml` 文件的内容来配置 OIDCOpenID Connect认证。OIDC 是建立在 OAuth 2.0 协议之上的认证层,允许应用程序通过授权服务器执行的认证来验证用户的身份。这种方法广泛用于实现现代应用程序的单点登录。
## 配置详细信息
以下是在 `config.yaml` 中配置 OIDC 设置的逐步指南:
```yaml
oauth2:
type: oidc # (必填)指定认证类型为 OIDC
oidcDisplayName: OIDC # (可选,默认值为 OIDC登录页面显示的名称
admin: "" # (至少填写 admin 或 adminGroups 中的一个;默认为空)管理员用户名,用逗号分隔。列在此处的用户被视为管理员
adminGroups: "" # (至少填写 admin 或 adminGroups 中的一个;默认为空)管理员组,用逗号分隔。属于这些组的用户被视为管理员。如果不使用组管理,可以省略此项
clientid: # 必填OIDC 客户端 ID
clientsecret: # 必填OIDC 客户端密钥
oidcIssuer: https://auth.example.com/realms/master # 必填OIDC 提供商的 issuer URL可以从您的OIDC 提供商处获取
# oidcLogoutUrl: https://auth.example.com/realms/master/protocol/openid-connect/logout # (因 bug 目前不能使用)
# oidcRegisterUrl: # 可选OIDC 提供商的注册链接
oidcScopes: openid,profile,email # (可选,默认值为 openid,profile,email OIDC 请求的 scope用逗号分隔
oidcLoginClaim: sub # (可选,默认值为 subOIDC 返回的用户名字段,可以是 preferred_username、sub 或email
oidcGroupsClaim: groups # (如果使用 adminGroups则必填默认值为 groups OIDC 返回的用户组信息字段,可以是 groups 或 roles
oidcAutoCreate: false # (可选,默认值为 false如果用户不存在是否自动创建用户
oidcAutoLogin: false # (可选,默认值为 false当地址是 /login 时是否自动跳转到OIDC登录页面
```

View File

@ -1,69 +0,0 @@
---
outline: deep
---
# 自定义 IP 地理位置数据库
Dashboard v0.18.3+ 采用离线数据库获取 GeoIP 信息,如需编译正确显示地理位置信息的 Dashboard必须在 `pkg/geoip/geoip.db` 路径下放置符合 IPinfo 格式的 mmdb 数据库。
IPinfo 格式包含以下字段:
- 作为条目的 IP 子网
- `continent`:大洲代码
- `continent_name`:大洲名称
- `country`:国家/地区代码
- `country_name`:国家/地区名称
其中 Dashboard 只需要用到 `country` 信息,其它字段可留空。
## 编辑数据库
目前推荐使用 MaxMind 官方使用的 `mmdbwriter``maxminddb-golang` 这两个库进行 mmdb 的编辑操作。
如果你的主要目的是为了校正地理信息,建议直接在 IPinfo 原版数据库的基础上修改。类似的操作可以参考 [sing-geoip](https://github.com/SagerNet/sing-geoip) 项目。
这里以校正 IPinfo 数据为例,你需要使用 `ReplaceWith` inserter此为默认值并写入 `mmdbtype.Map` 信息:
```go
subnet := &net.IPNet{
IP: net.ParseIP("114.5.1.4")
Mask: net.CIDRMask(32, 32)
}
countryMap := make(map[mmdbtype.String]mmdbtype.String)
countryMap[mmdbtype.String("country")] = mmdbtype.String("JP")
if err := writer.Insert(subnet, mmdbtype.Map(countryMap)); err != nil {
return err
}
```
其中 `writer` 为一个 `*mmdbwriter.Tree` 的实例,需要通过 `mmdbwriter.New` 方法创建。具体操作和插入其它字段的过程不再赘述。
编辑完成并将数据库信息写入到文件后,可以使用 `mmdbinspect` 命令行工具测试数据库信息。例如:
```shell
$ mmdbinspect -db ./country.mmdb 114.5.1.4
[
{
"Database": "./country.mmdb",
"Records": [
{
"Network": "114.5.1.4/32",
"Record": {
"continent": "AS",
"continent_name": "Asia",
"country": "JP",
"country_name": "Japan"
}
}
],
"Lookup": "114.5.1.4"
}
]
```
确定格式、信息无误后便可用于 Dashboard 编译。之后可通过 `grpcurl` 或类似工具测试查询 API 是否工作正常:
```shell
grpcurl -proto ./nezha/proto/nezha.proto -plaintext -H 'client_secret: test' -d '{"ip": "114.5.1.4"}' 127.0.0.1:5555 proto.NezhaService/LookupGeoIP
```

View File

@ -1,4 +0,0 @@
# Agent 启动/上线 问题自检流程
1. 直接执行 `/opt/nezha/agent/nezha-agent -s 面板IP或非CDN域名:面板RPC端口 -p Agent密钥 -d` 查看日志是否是因为 DNS、网络不佳导致超时timeout
2. `nc -v 域名/IP 面板RPC端口` 或者 `telnet 域名/IP 面板RPC端口` 来检验是否是网络问题,检查本机与面板服务器的出入站防火墙,如果无法判断问题可借助 <https://port.ping.pe/> 提供的端口检查工具进行检测。
3. 如果上面步骤检测正常Agent 依然没有正常上线,请尝试关闭 SELinux[如何关闭 SELinux](https://www.google.com/search?q=%E5%85%B3%E9%97%ADSELINUX)

View File

@ -1,109 +0,0 @@
# 反向代理 gRPC 端口(支持 Cloudflare CDN
使用 Nginx 或者 Caddy 反向代理 gRPC
- Nginx 配置
```nginx
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name data.example.com; # 你的 Agent 连接 Dashboard 的域名
ssl_certificate /data/letsencrypt/fullchain.pem; # 你的域名证书路径
ssl_certificate_key /data/letsencrypt/key.pem; # 你的域名私钥路径
ssl_stapling on;
ssl_session_timeout 1d;
ssl_session_cache shared:SSL:10m; # 此项可能会和其他配置文件冲突,如冲突请注释此项
ssl_protocols TLSv1.1 TLSv1.2 TLSv1.3;
underscores_in_headers on;
keepalive_time 24h;
keepalive_requests 100000;
keepalive_timeout 120s;
location / {
grpc_read_timeout 300s;
grpc_send_timeout 300s;
grpc_socket_keepalive on;
grpc_pass grpc://grpcservers;
}
}
upstream grpcservers {
server localhost:5555;
keepalive 512;
}
```
- Caddy 配置
```
data.example.com:443 { # 你的 Agent 连接 Dashboard 的域名
reverse_proxy {
to localhost:5555
transport http {
versions h2c 2
}
}
}
```
Dashboard 面板端配置
- 首先登录面板进入管理后台 打开设置页面,在 `未接入CDN的面板服务器域名/IP` 中填入上一步在 Nginx 或 Caddy 中配置的域名 比如 `data.example.com` ,并保存。
- 然后在面板服务器中,打开 /opt/nezha/dashboard/data/config.yaml 文件,将 `proxygrpcport` 修改为 Nginx 或 Caddy 监听的端口,比如上一步设置的 `443` ;因为我们在 Nginx 或 Caddy 中开启了 SSL/TLS所以需要将 `tls` 设置为 `true` ;修改完成后重启面板。
Agent 端配置
- 登录面板管理后台,复制一键安装命令,在对应的服务器上面执行一键安装命令重新安装 agent 端即可。
开启 Cloudflare CDN可选
根据 Cloudflare gRPC 的要求gRPC 服务必须侦听 443 端口 且必须支持 TLS 和 HTTP/2。
所以如果需要开启 CDN必须在配置 Nginx 或者 Caddy 反向代理 gRPC 时使用 443 端口并配置证书Caddy 会自动申请并配置证书)。
- 登录 Cloudflare选择使用的域名。打开 `网络` 选项将 `gRPC` 开关打开,打开 `DNS` 选项,找到 Nginx 或 Caddy 反代 gRPC 配置的域名的解析记录,打开橙色云启用 CDN。
开启`gRPC`后,可能不能立即可用,需要等待一段时间。具体可通过`curl`和使用`nezha-agent -d`来验证:
```bash
localhost:~/agent# curl -H "content-type: application/grpc+proto" -H "authorization: Bearer test" https://xxx.xxx.ovh -v
* processing: https://xxx.xxx.ovh
* Trying [2606:4700:3035::ac43:8bed]:443...
* Connected to xxx.xxx.ovh (2606:4700:3035::ac43:8bed) port 443
# ... SSL info
* using HTTP/2
* h2 [:method: GET]
* h2 [:scheme: https]
* h2 [:authority: xxx.xxx.ovh]
* h2 [:path: /]
* h2 [user-agent: curl/8.2.1]
* h2 [accept: */*]
* Using Stream ID: 1
> GET / HTTP/2
> Host: xxx.xxx.ovh
> User-Agent: curl/8.4.0
> Accept: */*
> content-type: application/grpc+proto
> authorization: Bearer test
>
< HTTP/2 405
< date: Wed, 20 Dec 2023 08:56:27 GMT
< content-type: application/grpc+proto
< cf-ray: 8386ac12dabd5ddc-HKG
< cf-cache-status: DYNAMIC
< grpc-message: Received a HEADERS frame with :method "GET" which should be POST
< grpc-status: 13
< report-to: {"endpoints":[{"url":"https:\/\/a.nel.cloudflare.com\/report\/v3?s=%2BTjgJvXWyRF11nUOYx9Lq7UDC1xOYBLtjvWrdjVJQIqu9YqnFJeZFran2KRs6zabQc%2BLV8AubNqYRYDb7hQAZe6bglmVz0wQjrb0tNovYf%2B59SAp%2BQfZnH%2BAFDydNT95ZCmTPnKgWetcwQiUfXU%3D"}],"group":"cf-nel","max_age":604800}
< nel: {"success_fraction":0,"report_to":"cf-nel","max_age":604800}
< vary: Accept-Encoding
< server: cloudflare
< alt-svc: h3=":443"; ma=86400
<
* Connection #0 to host xxx.xxx.ovh left intact
localhost:~/agent# /opt/nezha/agent/nezha-agent -s nezha.xxx.xxx:443 -p YOUR_KEY --tls -d
NEZHA@2023-12-20 05:14:00>> 检查更新: 0.15.14
NEZHA@2023-12-20 05:14:01>> 上报系统信息失败: rpc error: code = Unknown desc = EOF # 需要修改主控端 /opt/nezha/dashboard/data/config.yaml的 GRPCHost 和 TLS 选项
NEZHA@2023-12-20 05:14:01>> Error to close connection ...
```

View File

@ -1,4 +0,0 @@
# 实时通道断开
- 如果你使用了 CDN请确认 CDN 服务商提供 WebSocket 服务,并且已开启 WebSocket。
- 确认你的反代规则中针对 `/ws`, `/terminal` 路径的 WebSocket 进行了特别配置,你可以 [点击这里](/guide/dashboard.html#配置反向代理) 查看反向代理配置。

View File

@ -1,5 +0,0 @@
# 如何进行数据迁移、备份恢复?
1. 先运行一键脚本,选择 `停止面板`
2. 在旧服务器中打包 `/opt/nezha` 文件夹,复制到新服务器相同位置解压
3. 在新服务器中运行一键脚本,选择 `启动面板`

View File

@ -1,11 +0,0 @@
# 如何每月重置流量统计?
主页中的流量统计每次服务器重启时都会重置,如果要实现每月重置一次流量计数,可以这样实现:
1. 进入管理面板的 `告警`
2. 参考[这篇文档](/guide/notifications.html#特殊:任意周期流量告警),创建一个月流量告警
3. 返回主页,在 `服务` 页中就可以看到月流量统计了,这里的统计数据不会因为服务器重启而重置
::: tip
此方式可以设置任何周期,包括且不限于每小时/每天/每周/每月/每年重置流量统计,非常灵活!
:::

View File

@ -1,44 +0,0 @@
---
outline: deep
---
# 自定义 Agent 监控项目
## 自定义监控的网卡和硬盘分区
执行以下命令来选择网卡和分区,然后重启 Agent 即可生效:
```bash
/opt/nezha/agent/nezha-agent edit
```
## 其他运行参数
### 查看支持的参数
要查看支持的运行参数,请执行以下命令:
```bash
./nezha-agent --help
```
### 配置参数
如果您通过一键脚本安装了 Agent可以通过编辑系统服务配置来添加或修改参数。编辑文件 `/etc/systemd/system/nezha-agent.service`,并在 `ExecStart=` 行的末尾添加您需要的参数:
::: tip
如果您需要批量添加参数,可以利用 Dashboard 的计划任务功能。以禁用 Agent 自动更新功能为例,您可以设置一个计划任务。添加以下命令以修改系统服务配置,并触发该任务执行:
```bash
sed -i '/^ExecStart=/ s/$/ --disable-auto-update/' /etc/systemd/system/nezha-agent.service && systemctl daemon-reload
```
:::
- `--report-delay`:设置系统信息上报的间隔时间。默认为 1 秒。为了降低系统资源占用,可以设置为 3有效范围1-4 秒)。
- `--skip-conn`:不监控网络连接数。建议在连接数较多或 CPU 资源占用较高的服务器上使用此参数。
- `--skip-procs`:不监控进程数,有助于降低 Agent 的资源占用。
- `--disable-auto-update`:禁用 Agent 的**自动更新**功能,增强安全性。
- `--disable-force-update`:禁用 Agent 的**强制更新**功能,增强安全性。
- `--disable-command-execute`:禁止在 Agent 上执行任何定时任务或使用在线终端,增强安全性。
- `--tls`:启用 SSL/TLS 加密。当您使用 nginx 反向代理 Agent 的 gRPC 连接且 nginx 配置了 SSL/TLS 时,应启用此配置。
- `--use-ipv6-countrycode`:强制使用 IPv6 地址查询国家代码。默认情况下Agent 使用 IPv4 地址查询国家代码,如果服务器支持 IPv6 且与 IPv4 地址的国家代码不同,可以使用此参数。
- `--gpu`:启用 GPU 监控。注意GPU 使用率监控可能需要安装额外的依赖包,详细信息可以参考文档:[启用 GPU 监控](/guide/q9.html)。
- `--temperature`:启用硬件温度监控。仅支持的硬件有效,部分 VPS 可能无法获取温度信息。
- `-d` `--debug`:启用调试模式。
- `-u` `--ip-report-period`本地IP更新间隔, 如果这个值小于 `--report-delay` 设置的值,那么以 `--report-delay` 的值为准。默认为1800秒30分钟
- `-k` `--insecure`:禁用证书检查,适用于使用自签证书的场景。

View File

@ -1,54 +0,0 @@
---
outline: deep
---
# 使用 Cloudflare Access 作为 OAuth2 提供方
相较于 GithubCloudflare Access 对于中国大陆用户更加友好。如您当前使用 Github、Gitlab、Gitee 作为管理员账户登录时遇到问题,您可以考虑切换 Cloudflare Access 作为 OAuth2 提供方
## 示例配置:
```yaml
Oauth2:
Admin: 701b9ea6-9f56-48cd-af3e-cbb4bfc1475c
ClientID: 3516291f53eca9b4901a01337e41be7dc52f565c8657d08a3fddb2178d13c5bf
ClientSecret: 0568b67c7b6d0ed51c663e2fe935683007c28f947a27b7bd47a5ad3d8b56fb67
Endpoint: "https://xxxxx.cloudflareaccess.com"
Type: cloudflare
```
## 配置说明:
| 参数 | 获取方式 |
|-----------------------|-----------------------------------------------------------------------------|
| Admin | `My Team` -> `Users` -> `<具体用户>` -> `User ID` |
| ClientID/ClientSecret | `Access` -> `Application` -> `Add an Application` <br/> -> `SaaS` -> `OIDC` |
| Endpoint | `Access` -> `Application` -> `Application URL` -> `只保留协议+域名的部分,路径不需要` |
### 新建 SaaS-OIDC 应用流程
前往 Zero Trust Dashboard[https://one.dash.cloudflare.com/](https://one.dash.cloudflare.com/)选择或新建一个账户Account然后按照以下步骤操作
1. `My Team` -> `Users` -> 点击`<具体用户>` -> 获取 `User ID` 并保存 *(如果是第一次使用 Zero TrustUsers 列表会为空,可暂时跳过这一步;你需要完成一次验证后,用户才会出现在 Users 列表中)*
2. `Access` -> `Applications` -> `Add an Application`;
3. 选择 `SaaS`,在 `Application` 字段中输入自定义的应用名称(例如 `nezha`),选择 `OIDC` 后点击 `Add application`;
4. `Scopes` 选择 `openid`, `email`, `profile`, `groups`;
5. 在 `Redirect URLs` 中填写你的 Dashboard Callback 地址,例如 `https://dashboard.example.com/oauth2/callback`;
6. 分别记录 `Client ID``Client Secret``Issuer` 地址中的协议与域名部分,例如 `https://xxxxx.cloudflareaccess.com`;
7. 编辑 Dashboard 配置文件(通常位于 `/opt/nezha/dashboard/data/config.yaml`),参照示例配置修改 `OAuth2` 设置,并重启 Dashboard 服务。
### 身份验证策略配置
在完成 Dashboard 设置后,您还需要在 Zero Trust Dashboard 中配置身份验证策略,路径为:`Access` -> `Applications` -> `<应用名>` -> `Policies`。您可以选择多种 SSO 验证方式,包括邮件 OTP 验证、硬件密钥验证等,详细配置请参考 [Cloudflare Zero Trust 文档](https://developers.cloudflare.com/cloudflare-one/)。
### 策略配置示例One-time PIN
默认使用邮件 OTP 验证方式:
1. `Access` -> `Applications` -> `<应用名>` -> `Policies` -> `Add a policy`;
2. 设置一个 `Policy Name`,例如 `OTP``Action` 设置为 `Allow`;
3. 在 `Configure rules` 下新增一条 `Include` 规则,`Selector` 选择 `Emails`,在文本框中输入你的邮箱地址;
4. 点击 `Save policy` 保存策略。
### 测试策略
1. 在配置正确的情况下,访问 Dashboard 登录界面,会显示为 `使用 Cloudflare 账号登录`,点击登录会跳转到 Cloudflare Access 登录页面;
2. 输入前面配置的 Email 地址,点击 `Send me a code`,输入收到的验证码,即可登录 Dashboard
3. 如果在之前的步骤中,未在 `Admin` 中未填写 `User ID`,登录后会提示错误信息:“该用户不是本站点管理员,无法登录”。此时需要在 `My Team` -> `Users` 中找到对应的用户,点击用户名获取 `User ID` 并填写到 Dashboard 配置文件里的 `Admin` 部分,重启 Dashboard 服务后再次尝试登录。

View File

@ -1,81 +0,0 @@
---
outline: deep
---
# 启用 GPU 监控
GPU 监控是哪吒监控 v0.17.x 引入的新功能,使用前请检查您的 Dashboard 版本是否为 v0.17.2+ / Agent 版本是否为 v0.17.0+。
## 启用
### 通过启动参数
在 Agent 运行参数后添加 `--gpu` 即可。例如:
```bash
/opt/nezha/agent/nezha-agent -s example.com:5555 -p example --gpu
```
### 通过配置文件
执行以下命令修改 Agent 配置文件以启用 GPU 监控:
```bash
/opt/nezha/agent/nezha-agent edit
```
在返回的互动菜单中选择启用 GPU 功能即可。
## 打开 GPU 占用率监控支持
GPU 型号与 GPU 使用率为两个不同的监控项目,使用了不同实现获取。
其中 Windows 和 macOS 支持无依赖获取 GPU 使用率,并支持多个品牌显卡;
Linux 平台则仅支持 NVIDIA / AMD 显卡,且需要安装额外依赖。
以下将介绍如何在 Linux 上为 NVIDIA / AMD 显卡启用 GPU 使用率监控。
### NVIDIA
NVIDIA 显卡获取 GPU 使用率需要用到 `nvidia-smi` 工具,一般为官方驱动自带。
如果您使用的是非官方驱动,例如 `nouveau`,那么将无法获取 GPU 使用率。
### AMD
AMD 显卡获取 GPU 使用率需要安装 `amdgpu` 开源驱动和 `rocm-smi` 工具。
主流系统均已打包 `rocm-smi` ,以下是部分系统的安装命令:
```bash
# Arch Linux
pacman -Sy rocm-smi-lib
# Debian / Ubuntu
apt install rocm-smi
# Fedora / RHEL 8+
dnf install rocm-smi
```
如果您的系统并没有相应包,那么则需要手动编译安装 `rocm_smi_lib`
您的系统需要安装这些依赖:`git` `cmake` `gcc`
首先 Clone `rocm_smi_lib` 的 git 仓库:
```bash
git clone https://github.com/ROCm/rocm_smi_lib
```
然后进行编译并安装即可。
```bash
cd rocm_smi_lib
mkdir -p build
cd build
cmake ..
make -j $(nproc)
# Install library file and header; default location is /opt/rocm
make install
```

View File

@ -1,130 +0,0 @@
---
outline: deep
---
# 服务器
## 介绍
服务器区域负责管理 Agent是哪吒探针中最基础的区域也是其他功能的基础。
## 新增服务器
第一步是新增服务器,可以自定义名称、分组、排序和备注。
拥有相同分组的服务器会在受支持的主题中划分到一起进行显示,备注仅会在后台显示,无需担心泄露信息。
## 安装 Agent
请参考前文[安装 Agent](/guide/agent.html)。
推荐使用一键安装,即**配置好参数后**,点击服务器**一键安装**列上的对应的系统图标即可复制安装命令,在相应服务器上进行安装。
## 强制更新
Agent 更新相关的参数是 [自定义 Agent 监控项目](/guide/q7.html) 中的 `--disable-auto-update``--disable-force-update`
默认情况下Agent 会自动更新,无需干预。但当用户关闭自动更新后,也可以选中指定服务器进行强制更新。
`disable-force-update` 开启时此功能不生效。
## 数据列
* 版本号:记录 Agent 当前版本。
* 对游客隐藏:为 True 时,游客在面板中无法查看到此服务器。
* 启用 DDNS为 True 时,当该服务器 IP 发生变化Dashboard 会自动更新 DNS 记录。
* DDNS 域名:为该服务器配置的 DDNS 域名。
* 密钥:即 secret/key配置 Agent 时会用到,用于验证 Agent 与 Dashboard 的通信。
* 一键安装:点击相应的系统按钮,复制命令到服务器执行即可一键安装。
* 备注:服务器备注,仅验证后可见。
* 公开备注:服务器公开备注,前台可见。可以根据此字段做一些自定义,具体见[公开备注示例](#公开备注示例)。
* 管理:分别为连接 WebShell修改服务器配置删除服务器。
## 在线终端
即 WebShell`disable-command-execute` 开启时此功能不生效。
Linux 和 Windows 均可用,可使用 Ctrl+Shift+V 粘贴。
连接失败请参考[实时通道断开/在线终端连接失败](/guide/q4.html)。
## FM
Dashboard v0.19.1 / Agent v0.19.0 加入的新功能,是嵌入 WebShell 的一个伪文件管理器,提供文件下载和上传功能,也可以进行目录跳转或者复制路径。点击 WebShell 右下角的蓝色按钮就可以打开。
## 公开备注示例
### ServerStatus主题agent账单信息展示
<details>
<summary>点击展开/收起</summary>
<strong>配置位置:后台-> 服务器 -> 编辑服务器 -> 公开备注</strong>
<strong>完整配置,包含过期时间和价格展示</strong>
```json
{
"billingDataMod": {
"startDate": "2024-10-01T00:00:00+08:00",
"endDate": "2024-11-01T00:00:00+08:00",
"autoRenewal": "1",
"cycle": "月",
"amount": "$3.99"
}
}
```
<strong>单独配置过期时间</strong>
```json
{
"billingDataMod": {
"startDate": "2024-10-01T00:00:00+08:00",
"endDate": "2024-11-01T00:00:00+08:00",
"autoRenewal": "1",
"cycle": "月"
}
}
```
<strong>配置详细说明:</strong>
<strong>startDate 账单开始时间</strong>
```
格式如 2022-04-01T23:59:59+08:00
```
<strong>endDate 账单到期时间</strong>
```
格式如 2022-05-01T23:59:59+08:00
当以0000-00-00开头时表示账单无期限适用于永久免费的vps如0000-00-00T23:59:59+08:00
```
<strong>Date格式说明</strong>
```
分3部分
1. 日期2022-04-01
2. 时间T23:59:59
3. 时区:+08:00
例如:
2024-10-01T23:59:59+05:00
2024-09-21T12:00:00-05:00
2024-03-15T23:59:59+00:00
```
<strong>autoRenewal 自动续期</strong>
```
支持值
1自动续期
0不自动续期
当设置 "autoRenewal": 1 时程序会根据当前时间自动判断vps账单到期后无需手动更改startDate和endDate
```
<strong>amount 价格</strong>
```
格式如 $9.99 、€19.92 、¥199、19.99HKD、9.99USD、49.99CNY
如果vps是免费的请设置为"0" , 如 "amount": "0", 前台展示为 FREE
如果vps是按量收费请设置为"-1" , 如 "amount": "-1", 前台展示为PAYG
```
<strong>cycle 付费周期</strong>
```
支持格式(英文大小写字母都支持,大小写字母混用也支持)
1. 月、month、monthly、m、mo
2. 季、quarterly、q
3. 半年、半、half、semi-annually、h
4. 年、year、annually、y、yr
```
</details>

View File

@ -1,53 +0,0 @@
---
outline: deep
---
# 服务监控
**服务区域是设置 Agent 监控外部网站或服务器的功能设置区**
**设置好的服务监控可以在主页中的“服务”页查看过去 30 天的可用性监控结果**
## 使用方法
如需新增一个监控,可以进入管理面板中的“服务”页,点击“添加监控”。
新增一个服务监控时,你需要设置以下参数:
- **名称**:自定义一个名称。
- **类型**选择一个监控类型。目前哪吒监控支持三种监控类型分别是“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。
- **通知方式组**:选择你已经在“告警”页设置好的通知方式,[点击这里](/guide/notifications.html#灵活的通知方式)了解详情。
- **启用故障通知**:根据需要选择是否接收目标故障通知,默认为不勾选。
设置完成后,点击“添加”即可。稍等片刻前往主页的“服务”页查看监控结果。
## 延迟变化告警
哪吒监控可以监测并统计 Agent 到目标服务器之间的延迟,在发生较大变化的情况下发送通知。利用此功能可以帮助你监控服务器的线路是否发生了变化。
- **启用延迟通知**:开启时,当 Agent 至目标服务器的延迟大于`最高延迟`或小于`最低延迟`时,将会发送告警通知。
## 告警时触发任务
如果你需要在服务监控告警触发时执行一些任务,可以勾选“启用触发任务”,并在“告警时触发任务”和“恢复时触发任务”中选择你已经提前设置好的触发任务。
## 网络延迟图表
在服务页中设置的 TCP-Ping 和 ICMP-Ping 类型的监控都会自动启用监控图表功能。在主页的“网络”页中,你可以查看历史网络延迟监控图表。图表中的数据是根据 Agent 到目标服务器的延迟统计而来,你可以点击 Agent 的名称来切换图表。在图表中,可以取消勾选目标服务器的名称来隐藏或显示对应的数据。
## 管理监控
如需对已有的服务监控进行管理,可以前往管理面板中的“服务”页。选择一条监控配置,点击右侧的图标进行编辑或删除。

View File

@ -1,425 +0,0 @@
---
outline: deep
---
# 设置
## 站点标题
你可以在此项中自定义站点标题。
## 管理员列表
- 如果你修改了自己的 Github、Gitlab 或 Gitee 的用户名,需要在此项中同步修改,否则无法登录。多个用户请用逗号隔开:`user1,user2`
- 如需更改管理员账户,请前往 `/opt/nezha/dashboard/data/config.yaml`,重新设置新的管理员 `Client ID``Client Secret`
## 界面主题
在这里选择主页和管理界面主题,如果选项中没有某个已存在的主题,请更新面板。
使用自定义主页主题需要创建主题描述文件,关于自定义主题更多信息请参考[哪吒主题开发环境](/developer/theme.html)。
启用管理界面 Custom 主题前,你需要提前安装自定义主题,否则启用该项后,面板将无法正常显示。
## Language
哪吒监控目前支持以下语言:
- 简体中文
- 繁體中文
- English
- Español
我们欢迎您对翻译进行勘误或贡献更多语言。
## 自定义代码 (style, script)
可以在此修改 LOGO、修改色调、添加美化代码和统计代码等。
:::warning
自定义代码仅在游客首页生效,管理面板不生效。由于不同主题的代码不同,如确需修改管理面板中的内容,请修改 Docker 中的主题文件。
:::
#### 默认主题更改进度条颜色、背景图片、导航栏等效果示例
<details>
<summary>点击展开/收起</summary>
```html
<style>
/* 屏幕适配 */
@media only screen and (min-width: 1200px) {
.ui.container {
width: 80% !important;
}
}
@media only screen and (max-width: 767px) {
.ui.card>.content>.header:not(.ui), .ui.cards>.card>.content>.header:not(.ui) {
margin-top: 0.4em !important;
}
}
/* 整体图标 */
i.icon {
color: #000;
width: 1.2em !important;
}
/* 背景图片 */
body {
content: " " !important;
background: fixed !important;
z-index: -1 !important;
top: 0 !important;
right: 0 !important;
bottom: 0 !important;
left: 0 !important;
background-position: top !important;
background-repeat: no-repeat !important;
background-size: cover !important;
background-image: url(https://backgroud.img) !important;
font-family: Arial,Helvetica,sans-serif !important;
}
/* 导航栏 */
.ui.large.menu {
border: 0 !important;
border-radius: 0px !important;
background-color: rgba(255, 255, 255, 55%) !important;
}
/* 首页按钮 */
.ui.menu .active.item {
background-color: transparent !important;
}
/* 导航栏下拉框 */
.ui.dropdown .menu {
border: 0 !important;
border-radius: 0 !important;
background-color: rgba(255, 255, 255, 80%) !important;
}
/* 登录按钮 */
.nezha-primary-btn {
background-color: transparent !important;
color: #000 !important;
}
/* 大卡片 */
#app .ui.fluid.accordion {
background-color: #fbfbfb26 !important;
border-radius: 0.4rem !important;
}
/* 小卡片 */
.ui.four.cards>.card {
border-radius: 0.6rem !important;
background-color: #fafafaa3 !important;
}
.status.cards .wide.column {
padding-top: 0 !important;
padding-bottom: 0 !important;
height: 3.3rem !important;
}
.status.cards .three.wide.column {
padding-right: 0rem !important;
}
.status.cards .wide.column:nth-child(1) {
margin-top: 2rem !important;
}
.status.cards .wide.column:nth-child(2) {
margin-top: 2rem !important;
}
.status.cards .description {
padding-bottom: 0 !important;
}
/* 服务器名 */
.status.cards .flag {
margin-right: 0.5rem !important;
}
/* 弹出卡片图标 */
.status.cards .header > .info.icon {
margin-right: 0 !important;
}
.nezha-secondary-font {
color: #2175ba !important;
}
/* 上传下载 */
.status.cards .outline.icon {
margin-right: 1px !important;
}
i.arrow.alternate.circle.down.outline.icon {
color: #2175ba !important;
}
i.arrow.alternate.circle.up.outline.icon {
color: red !important;
}
/* 弹出卡片小箭头 */
.ui.right.center.popup {
margin: -3px 0 0 0.914286em !important;
-webkit-transform-origin: left 50% !important;
transform-origin: left 50% !important;
}
.ui.bottom.left.popup {
margin-left: 1px !important;
margin-top: 3px !important;
}
.ui.top.left.popup {
margin-left: 0 !important;
margin-bottom: 10px !important;
}
.ui.top.right.popup {
margin-right: 0 !important;
margin-bottom: 8px !important;
}
.ui.left.center.popup {
margin: -3px .91428571em 0 0 !important;
-webkit-transform-origin: right 50% !important;
transform-origin: right 50% !important;
}
.ui.right.center.popup:before,
.ui.left.center.popup:before {
border: 0px solid #fafafaeb !important;
background: #fafafaeb !important;
}
.ui.top.popup:before {
border-color: #fafafaeb transparent transparent !important;
}
.ui.popup:before {
border-color: #fafafaeb transparent transparent !important;
}
.ui.bottom.left.popup:before {
border-radius: 0 !important;
border: 1px solid transparent !important;
border-color: #fafafaeb transparent transparent !important;
background: #fafafaeb !important;
-webkit-box-shadow: 0px 0px 0 0 #fafafaeb !important;
box-shadow: 0px 0px 0 0 #fafafaeb !important;
-webkit-tap-highlight-color: rgba(0,0,0,0) !important;
}
.ui.bottom.right.popup:before {
border-radius: 0 !important;
border: 1px solid transparent !important;
border-color: #fafafaeb transparent transparent !important;
background: #fafafaeb !important
-webkit-box-shadow: 0px 0px 0 0 #fafafaeb !important;
box-shadow: 0px 0px 0 0 #fafafaeb !important;
-webkit-tap-highlight-color: rgba(0,0,0,0) !important;
}
.ui.top.left.popup:before {
border-radius: 0 !important;
border: 1px solid transparent !important;
border-color: #fafafaeb transparent transparent !important;
background: #fafafaeb !important;
-webkit-box-shadow: 0px 0px 0 0 #fafafaeb !important;
box-shadow: 0px 0px 0 0 #fafafaeb !important;
-webkit-tap-highlight-color: rgba(0,0,0,0) !important;
}
.ui.top.right.popup:before {
border-radius: 0 !important;
border: 1px solid transparent !important;
border-color: #fafafaeb transparent transparent !important;
background: #fafafaeb !important;
-webkit-box-shadow: 0px 0px 0 0 #fafafaeb !important;
box-shadow: 0px 0px 0 0 #fafafaeb !important;
-webkit-tap-highlight-color: rgba(0,0,0,0) !important;
}
.ui.left.center.popup:before {
border-radius: 0 !important;
border: 1px solid transparent !important;
border-color: #fafafaeb transparent transparent !important;
background: #fafafaeb !important;
-webkit-box-shadow: 0px 0px 0 0 #fafafaeb !important;
box-shadow: 0px 0px 0 0 #fafafaeb !important;
-webkit-tap-highlight-color: rgba(0,0,0,0) !important;
}
/* 弹出卡片 */
.status.cards .ui.content.popup {
min-width: 20rem !important;
line-height: 2rem !important;
border-radius: 5px !important;
border: 1px solid transparent !important;
background-color: #fafafaeb !important;
font-family: Arial,Helvetica,sans-serif !important;
}
.ui.content {
margin: 0 !important;
padding: 1em !important;
}
/* 服务页 */
.ui.table {
background: RGB(225,225,225,0.6) !important;
}
.ui.table thead th {
background: transparent !important;
}
/* 服务页进度条 */
.service-status .good {
background-color: #2175ba !important;
}
.service-status .danger {
background-color: red !important;
}
.service-status .warning {
background-color: orange !important;
}
/* 版权 */
.ui.inverted.segment, .ui.primary.inverted.segment {
color: #000 !important;
font-weight: bold !important;
background-color: #fafafaa3 !important;
}
</style>
<!--Logo和版权-->
<script>
window.onload = function(){
var avatar=document.querySelector(".item img")
var footer=document.querySelector("div.is-size-7")
footer.innerHTML="Copyright info"
footer.style.visibility="visible"
avatar.src="https:/img.src"
avatar.style.visibility="visible"
}
</script>
```
</details>
#### DayNight 主题更改进度条颜色、修改页脚示例(来自 [@hyt-allen-xu](https://github.com/hyt-allen-xu) [@tech-fever](https://github.com/tech-fever)
<details>
<summary>点击展开/收起</summary>
```html
<style>
.ui.fine.progress> .progress-bar {
background-color: #00a7d0 !important;
}
</style>
<script>
window.onload = function(){
var avatar = document.querySelector("img");
var footer = document.querySelector("div.footer-container");
footer.innerHTML = "©2021 你的名字 & Powered by 你的名字";
footer.style.visibility = "visible";
avatar.src = "你的图片连接";
avatar.style.visibility = "visible";
}
</script>
```
</details>
#### 默认主题修改 LOGO、修改页脚示例来自 [@iLay1678](https://github.com/iLay1678)
<details>
<summary>点击展开/收起</summary>
```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 你的名字";
footer.style.visibility = "visible";
avatar.src = "你的方形 logo 地址";
avatar.style.visibility = "visible";
}
</script>
```
</details>
#### hotaru 主题更改背景图片示例
<details>
<summary>点击展开/收起</summary>
```html
<style>
.hotaru-cover {
background: url(https://s3.ax1x.com/2020/12/08/DzHv6A.jpg) center;
}
</style>
```
</details>
## 前台查看密码
如果你不想向游客直接展示你的 Dashboard可以在这里设置一个查看密码。设置密码后需要输入密码才可以访问主页。
## 未接入 CDN 的面板服务器域名/IP
此项设置是使用一键脚本安装 Agent 的前提,详情请查看[这里](/guide/agent.html#%E5%87%86%E5%A4%87%E5%B7%A5%E4%BD%9C)。
## IP 变更提醒
如果你希望当某个服务器的 IP 发生变更时收到通知,可以在这里进行设置。
#### 覆盖范围
在这里选择一条规则,来确定需要监控哪些服务器,可以根据自己的需求进行选择。
#### 特定服务器
配合覆盖范围的设置,在这里设置选定规则的排除项。
#### 提醒发送至指定的通知分组
选择通知方式,通知方式请提前在“告警”页内设置。
:::warning
**设置完成后,勾选启用时,通知生效**。
:::
#### 通知中显示完整 IP 地址
IP 变更通知默认隐藏完整 IP如果你不希望隐藏可以勾选“通知信息中显示完整 IP 地址”。
## 禁止主页切换主题
Dashboard 默认启用允许访客修改显示主题的功能,此功能只会影响单一访客,不会影响管理员在后台设置的启用主题。如果你不希望访客切换主题,可以勾选此项。

View File

@ -1,44 +0,0 @@
---
outline: deep
---
# 任务管理
**在任务区域中,可以设置计划任务,触发任务,多服务器批量执行任务**
哪吒监控支持推送命令到 Agent 执行,此功能非常灵活。使用此功能可以定期结合 restic、rclone 给服务器备份,定期重启某项服务来重置网络连接。也可以配合告警通知,在触发告警时执行某项任务,例如在 CPU 长时间高占用的情况下运行某个脚本。
## 使用方法
进入管理面板的“任务”页,点击“添加计划任务”。添加计划任务时,你需要填入以下参数:
- **名称**:自定义一个任务名称。
- **任务类型**:选择任务的类型。
- **计划任务**:按下方设置的计划时间,周期性执行任务。
- **触发任务**:仅被 API 或告警规则触发的任务,每次触发执行一次。
- **计划**:设置计划时间(使用触发任务类型时不生效),时间格式为:`* * * * * *`,分别对应`秒 分 时 天 月 星期`,详情见[计划表达式格式](https://pkg.go.dev/github.com/robfig/cron/v3#hdr-CRON_Expression_Format)。
例如:`0 0 3 * * *` 对应为“每天 3 点”。
- **命令**:设置需要执行的命令,就像写 Shell/Bat 脚本一样,但不推荐换行,多个命令使用 `&&/&` 连接。
例如执行定期重启命令,可以在这里输入 `reboot`
- **覆盖范围**和**特定服务器**:选择规则来确定哪些 Agent 执行计划任务,类似于“服务”页中的设置。使用触发任务类型时,可选择“由触发的服务器执行”。
- **通知方式组**:选择你已经在“告警”页设置好的通知方式,[点击这里](/guide/notifications.html#灵活的通知方式)了解详情。
- **推送成功的消息**:勾选此项,任务执行成功后会触发消息通知。
## 管理任务
如需对已有的计划任务进行管理,可以前往管理面板中的“任务”页。选择一条任务配置,右侧的三个图标分别是:
- **立即执行**:点击后将忽略计划时间,立刻执行任务。
- **编辑**:点击可以修改任务配置。
- **删除**:删除这条计划任务。
## 常见问题
1. **xxx 命令找不到**
如果运行失败,提示 xxx 命令找不到,可能是 PATH 环境变量的问题。在 Linux 服务器上,可以在命令开头加入 `source ~/.bashrc`,或者使用绝对路径执行命令。

Binary file not shown.

Before

Width:  |  Height:  |  Size: 66 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 79 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 41 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 329 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 112 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

View File

@ -1,29 +0,0 @@
<svg id="CNSC" xmlns="http://www.w3.org/2000/svg" width="108.85157" height="40" viewBox="0 0 108.85157 40">
<title>Download_on_the_App_Store_Badge_CNSC_RGB_blk_092917</title>
<g>
<g>
<path d="M99.32227,0H9.53468c-.3667,0-.729,0-1.09473.002-.30615.002-.60986.00781-.91895.0127A13.21476,13.21476,0,0,0,5.5171.19141a6.66509,6.66509,0,0,0-1.90088.627A6.43779,6.43779,0,0,0,1.99757,1.99707,6.25844,6.25844,0,0,0,.81935,3.61816a6.60119,6.60119,0,0,0-.625,1.90332,12.993,12.993,0,0,0-.1792,2.002C.00587,7.83008.00489,8.1377,0,8.44434V31.5586c.00489.3105.00587.6113.01515.9219a12.99232,12.99232,0,0,0,.1792,2.0019,6.58756,6.58756,0,0,0,.625,1.9043A6.20778,6.20778,0,0,0,1.99757,38.001a6.27445,6.27445,0,0,0,1.61865,1.1787,6.70082,6.70082,0,0,0,1.90088.6308,13.45514,13.45514,0,0,0,2.0039.1768c.30909.0068.6128.0107.91895.0107C8.80567,40,9.168,40,9.53468,40H99.32227c.3594,0,.7246,0,1.084-.002.3047,0,.6172-.0039.9219-.0107a13.279,13.279,0,0,0,2-.1768,6.80432,6.80432,0,0,0,1.9082-.6308,6.27742,6.27742,0,0,0,1.6172-1.1787,6.39482,6.39482,0,0,0,1.1816-1.6143,6.60413,6.60413,0,0,0,.6191-1.9043,13.50643,13.50643,0,0,0,.1856-2.0019c.0039-.3106.0039-.6114.0039-.9219.0078-.3633.0078-.7246.0078-1.0938V9.53613c0-.36621,0-.72949-.0078-1.09179,0-.30664,0-.61426-.0039-.9209a13.5071,13.5071,0,0,0-.1856-2.002,6.6177,6.6177,0,0,0-.6191-1.90332,6.46619,6.46619,0,0,0-2.7988-2.7998,6.76754,6.76754,0,0,0-1.9082-.627,13.04394,13.04394,0,0,0-2-.17676c-.3047-.00488-.6172-.01074-.9219-.01269C100.04687,0,99.68167,0,99.32227,0Z" style="fill: #a6a6a6"/>
<path d="M8.44483,39.125c-.30468,0-.602-.0039-.90429-.0107a12.68714,12.68714,0,0,1-1.86914-.1631,5.88381,5.88381,0,0,1-1.65674-.5479,5.40573,5.40573,0,0,1-1.397-1.0166,5.32082,5.32082,0,0,1-1.02051-1.3965,5.72186,5.72186,0,0,1-.543-1.6572,12.41351,12.41351,0,0,1-.1665-1.875c-.00634-.2109-.01464-.9131-.01464-.9131V8.44434S.88185,7.75293.8877,7.5498a12.37039,12.37039,0,0,1,.16553-1.87207,5.7555,5.7555,0,0,1,.54346-1.6621A5.37349,5.37349,0,0,1,2.61183,2.61768,5.56543,5.56543,0,0,1,4.01417,1.59521a5.82309,5.82309,0,0,1,1.65332-.54394A12.58589,12.58589,0,0,1,7.543.88721L8.44532.875h91.956l.9131.0127a12.38493,12.38493,0,0,1,1.8584.16259,5.93833,5.93833,0,0,1,1.6709.54785,5.59374,5.59374,0,0,1,2.415,2.41993A5.76267,5.76267,0,0,1,107.794,5.667a12.995,12.995,0,0,1,.1738,1.88721c.0029.2832.0029.5874.0029.89014.0079.375.0079.73193.0079,1.09179V30.4648c0,.3633,0,.7178-.0079,1.0752,0,.3252,0,.6231-.0039.9297a12.73126,12.73126,0,0,1-.1709,1.8535,5.739,5.739,0,0,1-.54,1.67,5.48029,5.48029,0,0,1-1.0156,1.3857,5.4129,5.4129,0,0,1-1.3994,1.0225,5.86168,5.86168,0,0,1-1.668.5498,12.54218,12.54218,0,0,1-1.8692.1631c-.2929.0068-.5996.0107-.8974.0107l-1.084.002Z"/>
</g>
<g>
<path d="M41.16742,16.55462H37.11585l-.973,2.873H34.42678L38.26437,8.79837h1.783l3.83759,10.62922H42.13957Zm-3.632-1.32573H40.747l-1.58318-4.66261h-.0443Z" style="fill: #fff"/>
<path d="M52.1728,15.55322c0,2.40821-1.28895,3.95545-3.23407,3.95545a2.62719,2.62719,0,0,1-2.4383-1.35582h-.03678v3.83842H44.87294V11.678h1.53972V12.967h.02926a2.749,2.749,0,0,1,2.46756-1.37C50.87633,11.59694,52.1728,13.1517,52.1728,15.55322Zm-1.635,0c0-1.569-.81082-2.60046-2.04794-2.60046-1.21539,0-2.03289,1.05323-2.03289,2.60046,0,1.56145.8175,2.60715,2.03289,2.60715C49.727,18.16037,50.53779,17.1364,50.53779,15.55322Z" style="fill: #fff"/>
<path d="M60.70267,15.55322c0,2.40821-1.28937,3.95545-3.23449,3.95545a2.62719,2.62719,0,0,1-2.4383-1.35582H54.9931v3.83842H53.4024V11.678h1.53972V12.967h.02926a2.749,2.749,0,0,1,2.46756-1.37C59.40578,11.59694,60.70267,13.1517,60.70267,15.55322Zm-1.63543,0c0-1.569-.81082-2.60046-2.04794-2.60046-1.21539,0-2.03289,1.05323-2.03289,2.60046,0,1.56145.8175,2.60715,2.03289,2.60715C58.25643,18.16037,59.06725,17.1364,59.06725,15.55322Z" style="fill: #fff"/>
<path d="M66.3391,16.466c.11786,1.05406,1.14183,1.74618,2.54112,1.74618,1.34077,0,2.30539-.69212,2.30539-1.64253,0-.825-.58178-1.319-1.95933-1.65758l-1.37755-.33185c-1.95181-.47144-2.85792-1.38424-2.85792-2.86544,0-1.834,1.59823-3.09364,3.86684-3.09364,2.24688,0,3.7866,1.25969,3.83842,3.09364H71.09032c-.09613-1.06075-.973-1.701-2.2544-1.701s-2.15828.64782-2.15828,1.59071c0,.75147.56,1.19366,1.93008,1.53219l1.17109.28755c2.18085.51575,3.08612,1.39176,3.08612,2.94652,0,1.98859-1.58318,3.23407-4.10257,3.23407-2.35722,0-3.94876-1.21623-4.05158-3.13878Z" style="fill: #fff"/>
<path d="M76.29961,9.84407v1.834h1.47368v1.25969H76.29961V17.21c0,.6637.29507.973.94289.973a4.971,4.971,0,0,0,.52327-.03678v1.25217a4.36838,4.36838,0,0,1-.88354.07356c-1.569,0-2.18085-.5893-2.18085-2.09224V12.93771H73.5746V11.678h1.12678v-1.834Z" style="fill: #fff"/>
<path d="M78.6259,15.55322c0-2.4383,1.43607-3.97049,3.67542-3.97049,2.24688,0,3.67626,1.53219,3.67626,3.97049,0,2.445-1.42185,3.97049-3.67626,3.97049C80.04776,19.52372,78.6259,17.99821,78.6259,15.55322Zm5.73089,0c0-1.67262-.76651-2.65981-2.05546-2.65981s-2.05546.99471-2.05546,2.65981c0,1.67931.76651,2.659,2.05546,2.659S84.35679,17.23253,84.35679,15.55322Z" style="fill: #fff"/>
<path d="M87.2891,11.678h1.51715v1.319H88.843a1.84835,1.84835,0,0,1,1.864-1.40012,2.4533,2.4533,0,0,1,.545.05935v1.48789a2.22372,2.22372,0,0,0-.71469-.09613,1.6029,1.6029,0,0,0-1.65758,1.783v4.59658H87.2891Z" style="fill: #fff"/>
<path d="M98.5862,17.15145a3.11011,3.11011,0,0,1-3.33689,2.37227c-2.2544,0-3.65369-1.51046-3.65369-3.93372,0-2.43078,1.40681-4.00727,3.58682-4.00727,2.14407,0,3.49236,1.47284,3.49236,3.82254v.545H93.20138v.09613a2.01837,2.01837,0,0,0,2.08472,2.19506,1.75329,1.75329,0,0,0,1.78965-1.09Zm-5.3773-2.31292h3.87437a1.86367,1.86367,0,0,0-1.90082-1.96686A1.96188,1.96188,0,0,0,93.2089,14.83853Z" style="fill: #fff"/>
</g>
<g>
<path d="M34.42873,24.04h7.46143v.78027H38.34328v1.10352q.76245.353,1.53467.77832.772.4248,1.562.91211l-.45947.7168q-.813-.51855-1.46094-.91406-.64819-.39551-1.17627-.65723v4.6084h-.79053V24.82031h-3.124Z" style="fill: #fff"/>
<path d="M43.95607,24.27441h1.562v-.62988h.772v.62988h1.44727v.7168H46.29006v.61035h1.82422q-.01831-.44971-.03662-.93945-.019-.48926-.01855-1.02637h.76709q0,.54639.01611,1.03125t.03467.93457h2.03076v.72656H48.91359q.03662.50537.09424.92285c.03809.2793.07275.52832.10352.749a1.65659,1.65659,0,0,1,.05518.22363c.01221.07129.02441.14453.03662.21777A8.07449,8.07449,0,0,0,49.543,27.582q.15161-.4541.27588-.97363l.70313.32129a9.7383,9.7383,0,0,1-1.00635,2.57813c.02441.06055.05127.123.08057.18555q.04321.09375.08936.18164.28931.57422.45947.57422.115,0,.2666-1.208l.67529.3584q-.28931,1.67725-.85449,1.67676-.42773,0-.96973-.75391a2.1332,2.1332,0,0,1-.188-.3584,5.12,5.12,0,0,1-1.40186,1.2041l-.436-.62891a4.19187,4.19187,0,0,0,1.48828-1.40234q-.08276-.271-.16748-.55762-.085-.28711-.145-.59961a12.605,12.605,0,0,1-.26172-1.85156H43.51955v-.72656h1.99854v-.61035h-1.562Zm3.78125,5.28809V30.252q-.30322.03662-.61328.06836c-.20654.02148-.416.04492-.627.06934v.95117h-.772v-.85449q-.43652.03662-.88721.06836c-.2998.02148-.605.0498-.91406.083l-.10107-.74414q.50977-.019.97852-.05273.46875-.03516.92383-.0625V29.1582H44.19045l-.16113-.62988a5.21327,5.21327,0,0,0,.55615-.88672h-.80859v-.70312h1.11621a1.73325,1.73325,0,0,0,.09668-.26855q.03662-.13477.0918-.28711l.75342.13379c-.03027.085-.05469.16113-.07324.22754a.99246.99246,0,0,1-.07812.19434h2.09033v.70313H45.40334q-.12378.249-.25049.46t-.23682.40918h.80908V27.9541h.772v.55664h1.19434v.64746H46.49709v.53711c.21094-.01758.42041-.03906.627-.06152Q47.43386,29.59863,47.73732,29.5625Zm1.34619-5.459.5835-.39453a12.55594,12.55594,0,0,1,.979,1.23633l-.59277.42188q-.17944-.28418-.42041-.60352Q49.39113,24.44434,49.08352,24.10352Z" style="fill: #fff"/>
</g>
<g id="_Group_" data-name="&lt;Group&gt;">
<g id="_Group_2" data-name="&lt;Group&gt;">
<path id="_Path_" data-name="&lt;Path&gt;" d="M24.76888,20.30068a4.94881,4.94881,0,0,1,2.35656-4.15206,5.06566,5.06566,0,0,0-3.99116-2.15768c-1.67924-.17626-3.30719,1.00483-4.1629,1.00483-.87227,0-2.18977-.98733-3.6085-.95814a5.31529,5.31529,0,0,0-4.47292,2.72787c-1.934,3.34842-.49141,8.26947,1.3612,10.97608.9269,1.32535,2.01018,2.8058,3.42763,2.7533,1.38706-.05753,1.9051-.88448,3.5794-.88448,1.65876,0,2.14479.88448,3.591.8511,1.48838-.02416,2.42613-1.33124,3.32051-2.66914a10.962,10.962,0,0,0,1.51842-3.09251A4.78205,4.78205,0,0,1,24.76888,20.30068Z" style="fill: #fff"/>
<path id="_Path_2" data-name="&lt;Path&gt;" d="M22.03725,12.21089a4.87248,4.87248,0,0,0,1.11452-3.49062,4.95746,4.95746,0,0,0-3.20758,1.65961,4.63634,4.63634,0,0,0-1.14371,3.36139A4.09905,4.09905,0,0,0,22.03725,12.21089Z" style="fill: #fff"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 8.4 KiB

View File

@ -1,46 +0,0 @@
<svg id="livetype" xmlns="http://www.w3.org/2000/svg" width="119.66407" height="40" viewBox="0 0 119.66407 40">
<title>Download_on_the_App_Store_Badge_US-UK_RGB_blk_4SVG_092917</title>
<g>
<g>
<g>
<path d="M110.13477,0H9.53468c-.3667,0-.729,0-1.09473.002-.30615.002-.60986.00781-.91895.0127A13.21476,13.21476,0,0,0,5.5171.19141a6.66509,6.66509,0,0,0-1.90088.627A6.43779,6.43779,0,0,0,1.99757,1.99707,6.25844,6.25844,0,0,0,.81935,3.61816a6.60119,6.60119,0,0,0-.625,1.90332,12.993,12.993,0,0,0-.1792,2.002C.00587,7.83008.00489,8.1377,0,8.44434V31.5586c.00489.3105.00587.6113.01515.9219a12.99232,12.99232,0,0,0,.1792,2.0019,6.58756,6.58756,0,0,0,.625,1.9043A6.20778,6.20778,0,0,0,1.99757,38.001a6.27445,6.27445,0,0,0,1.61865,1.1787,6.70082,6.70082,0,0,0,1.90088.6308,13.45514,13.45514,0,0,0,2.0039.1768c.30909.0068.6128.0107.91895.0107C8.80567,40,9.168,40,9.53468,40H110.13477c.3594,0,.7246,0,1.084-.002.3047,0,.6172-.0039.9219-.0107a13.279,13.279,0,0,0,2-.1768,6.80432,6.80432,0,0,0,1.9082-.6308,6.27742,6.27742,0,0,0,1.6172-1.1787,6.39482,6.39482,0,0,0,1.1816-1.6143,6.60413,6.60413,0,0,0,.6191-1.9043,13.50643,13.50643,0,0,0,.1856-2.0019c.0039-.3106.0039-.6114.0039-.9219.0078-.3633.0078-.7246.0078-1.0938V9.53613c0-.36621,0-.72949-.0078-1.09179,0-.30664,0-.61426-.0039-.9209a13.5071,13.5071,0,0,0-.1856-2.002,6.6177,6.6177,0,0,0-.6191-1.90332,6.46619,6.46619,0,0,0-2.7988-2.7998,6.76754,6.76754,0,0,0-1.9082-.627,13.04394,13.04394,0,0,0-2-.17676c-.3047-.00488-.6172-.01074-.9219-.01269-.3594-.002-.7246-.002-1.084-.002Z" style="fill: #a6a6a6"/>
<path d="M8.44483,39.125c-.30468,0-.602-.0039-.90429-.0107a12.68714,12.68714,0,0,1-1.86914-.1631,5.88381,5.88381,0,0,1-1.65674-.5479,5.40573,5.40573,0,0,1-1.397-1.0166,5.32082,5.32082,0,0,1-1.02051-1.3965,5.72186,5.72186,0,0,1-.543-1.6572,12.41351,12.41351,0,0,1-.1665-1.875c-.00634-.2109-.01464-.9131-.01464-.9131V8.44434S.88185,7.75293.8877,7.5498a12.37039,12.37039,0,0,1,.16553-1.87207,5.7555,5.7555,0,0,1,.54346-1.6621A5.37349,5.37349,0,0,1,2.61183,2.61768,5.56543,5.56543,0,0,1,4.01417,1.59521a5.82309,5.82309,0,0,1,1.65332-.54394A12.58589,12.58589,0,0,1,7.543.88721L8.44532.875H111.21387l.9131.0127a12.38493,12.38493,0,0,1,1.8584.16259,5.93833,5.93833,0,0,1,1.6709.54785,5.59374,5.59374,0,0,1,2.415,2.41993,5.76267,5.76267,0,0,1,.5352,1.64892,12.995,12.995,0,0,1,.1738,1.88721c.0029.2832.0029.5874.0029.89014.0079.375.0079.73193.0079,1.09179V30.4648c0,.3633,0,.7178-.0079,1.0752,0,.3252,0,.6231-.0039.9297a12.73126,12.73126,0,0,1-.1709,1.8535,5.739,5.739,0,0,1-.54,1.67,5.48029,5.48029,0,0,1-1.0156,1.3857,5.4129,5.4129,0,0,1-1.3994,1.0225,5.86168,5.86168,0,0,1-1.668.5498,12.54218,12.54218,0,0,1-1.8692.1631c-.2929.0068-.5996.0107-.8974.0107l-1.084.002Z"/>
</g>
<g id="_Group_" data-name="&lt;Group&gt;">
<g id="_Group_2" data-name="&lt;Group&gt;">
<g id="_Group_3" data-name="&lt;Group&gt;">
<path id="_Path_" data-name="&lt;Path&gt;" d="M24.76888,20.30068a4.94881,4.94881,0,0,1,2.35656-4.15206,5.06566,5.06566,0,0,0-3.99116-2.15768c-1.67924-.17626-3.30719,1.00483-4.1629,1.00483-.87227,0-2.18977-.98733-3.6085-.95814a5.31529,5.31529,0,0,0-4.47292,2.72787c-1.934,3.34842-.49141,8.26947,1.3612,10.97608.9269,1.32535,2.01018,2.8058,3.42763,2.7533,1.38706-.05753,1.9051-.88448,3.5794-.88448,1.65876,0,2.14479.88448,3.591.8511,1.48838-.02416,2.42613-1.33124,3.32051-2.66914a10.962,10.962,0,0,0,1.51842-3.09251A4.78205,4.78205,0,0,1,24.76888,20.30068Z" style="fill: #fff"/>
<path id="_Path_2" data-name="&lt;Path&gt;" d="M22.03725,12.21089a4.87248,4.87248,0,0,0,1.11452-3.49062,4.95746,4.95746,0,0,0-3.20758,1.65961,4.63634,4.63634,0,0,0-1.14371,3.36139A4.09905,4.09905,0,0,0,22.03725,12.21089Z" style="fill: #fff"/>
</g>
</g>
<g>
<path d="M42.30227,27.13965h-4.7334l-1.13672,3.35645H34.42727l4.4834-12.418h2.083l4.4834,12.418H43.438ZM38.0591,25.59082h3.752l-1.84961-5.44727h-.05176Z" style="fill: #fff"/>
<path d="M55.15969,25.96973c0,2.81348-1.50586,4.62109-3.77832,4.62109a3.0693,3.0693,0,0,1-2.84863-1.584h-.043v4.48438h-1.8584V21.44238H48.4302v1.50586h.03418a3.21162,3.21162,0,0,1,2.88281-1.60059C53.645,21.34766,55.15969,23.16406,55.15969,25.96973Zm-1.91016,0c0-1.833-.94727-3.03809-2.39258-3.03809-1.41992,0-2.375,1.23047-2.375,3.03809,0,1.82422.95508,3.0459,2.375,3.0459C52.30227,29.01563,53.24953,27.81934,53.24953,25.96973Z" style="fill: #fff"/>
<path d="M65.12453,25.96973c0,2.81348-1.50586,4.62109-3.77832,4.62109a3.0693,3.0693,0,0,1-2.84863-1.584h-.043v4.48438h-1.8584V21.44238H58.395v1.50586h.03418A3.21162,3.21162,0,0,1,61.312,21.34766C63.60988,21.34766,65.12453,23.16406,65.12453,25.96973Zm-1.91016,0c0-1.833-.94727-3.03809-2.39258-3.03809-1.41992,0-2.375,1.23047-2.375,3.03809,0,1.82422.95508,3.0459,2.375,3.0459C62.26711,29.01563,63.21438,27.81934,63.21438,25.96973Z" style="fill: #fff"/>
<path d="M71.71047,27.03613c.1377,1.23145,1.334,2.04,2.96875,2.04,1.56641,0,2.69336-.80859,2.69336-1.91895,0-.96387-.67969-1.541-2.28906-1.93652l-1.60937-.3877c-2.28027-.55078-3.33887-1.61719-3.33887-3.34766,0-2.14258,1.86719-3.61426,4.51855-3.61426,2.624,0,4.42285,1.47168,4.4834,3.61426h-1.876c-.1123-1.23926-1.13672-1.9873-2.63379-1.9873s-2.52148.75684-2.52148,1.8584c0,.87793.6543,1.39453,2.25488,1.79l1.36816.33594c2.54785.60254,3.60645,1.626,3.60645,3.44238,0,2.32324-1.85059,3.77832-4.79395,3.77832-2.75391,0-4.61328-1.4209-4.7334-3.667Z" style="fill: #fff"/>
<path d="M83.34621,19.2998v2.14258h1.72168v1.47168H83.34621v4.99121c0,.77539.34473,1.13672,1.10156,1.13672a5.80752,5.80752,0,0,0,.61133-.043v1.46289a5.10351,5.10351,0,0,1-1.03223.08594c-1.833,0-2.54785-.68848-2.54785-2.44434V22.91406H80.16262V21.44238H81.479V19.2998Z" style="fill: #fff"/>
<path d="M86.065,25.96973c0-2.84863,1.67773-4.63867,4.29395-4.63867,2.625,0,4.29492,1.79,4.29492,4.63867,0,2.85645-1.66113,4.63867-4.29492,4.63867C87.72609,30.6084,86.065,28.82617,86.065,25.96973Zm6.69531,0c0-1.9541-.89551-3.10742-2.40137-3.10742s-2.40039,1.16211-2.40039,3.10742c0,1.96191.89453,3.10645,2.40039,3.10645S92.76027,27.93164,92.76027,25.96973Z" style="fill: #fff"/>
<path d="M96.18606,21.44238h1.77246v1.541h.043a2.1594,2.1594,0,0,1,2.17773-1.63574,2.86616,2.86616,0,0,1,.63672.06934v1.73828a2.59794,2.59794,0,0,0-.835-.1123,1.87264,1.87264,0,0,0-1.93652,2.083v5.37012h-1.8584Z" style="fill: #fff"/>
<path d="M109.3843,27.83691c-.25,1.64355-1.85059,2.77148-3.89844,2.77148-2.63379,0-4.26855-1.76465-4.26855-4.5957,0-2.83984,1.64355-4.68164,4.19043-4.68164,2.50488,0,4.08008,1.7207,4.08008,4.46582v.63672h-6.39453v.1123a2.358,2.358,0,0,0,2.43555,2.56445,2.04834,2.04834,0,0,0,2.09082-1.27344Zm-6.28223-2.70215h4.52637a2.1773,2.1773,0,0,0-2.2207-2.29785A2.292,2.292,0,0,0,103.10207,25.13477Z" style="fill: #fff"/>
</g>
</g>
</g>
<g id="_Group_4" data-name="&lt;Group&gt;">
<g>
<path d="M37.82619,8.731a2.63964,2.63964,0,0,1,2.80762,2.96484c0,1.90625-1.03027,3.002-2.80762,3.002H35.67092V8.731Zm-1.22852,5.123h1.125a1.87588,1.87588,0,0,0,1.96777-2.146,1.881,1.881,0,0,0-1.96777-2.13379h-1.125Z" style="fill: #fff"/>
<path d="M41.68068,12.44434a2.13323,2.13323,0,1,1,4.24707,0,2.13358,2.13358,0,1,1-4.24707,0Zm3.333,0c0-.97607-.43848-1.54687-1.208-1.54687-.77246,0-1.207.5708-1.207,1.54688,0,.98389.43457,1.55029,1.207,1.55029C44.57522,13.99463,45.01369,13.42432,45.01369,12.44434Z" style="fill: #fff"/>
<path d="M51.57326,14.69775h-.92187l-.93066-3.31641h-.07031l-.92676,3.31641h-.91309l-1.24121-4.50293h.90137l.80664,3.436h.06641l.92578-3.436h.85254l.92578,3.436h.07031l.80273-3.436h.88867Z" style="fill: #fff"/>
<path d="M53.85354,10.19482H54.709v.71533h.06641a1.348,1.348,0,0,1,1.34375-.80225,1.46456,1.46456,0,0,1,1.55859,1.6748v2.915h-.88867V12.00586c0-.72363-.31445-1.0835-.97168-1.0835a1.03294,1.03294,0,0,0-1.0752,1.14111v2.63428h-.88867Z" style="fill: #fff"/>
<path d="M59.09377,8.437h.88867v6.26074h-.88867Z" style="fill: #fff"/>
<path d="M61.21779,12.44434a2.13346,2.13346,0,1,1,4.24756,0,2.1338,2.1338,0,1,1-4.24756,0Zm3.333,0c0-.97607-.43848-1.54687-1.208-1.54687-.77246,0-1.207.5708-1.207,1.54688,0,.98389.43457,1.55029,1.207,1.55029C64.11232,13.99463,64.5508,13.42432,64.5508,12.44434Z" style="fill: #fff"/>
<path d="M66.4009,13.42432c0-.81055.60352-1.27783,1.6748-1.34424l1.21973-.07031v-.38867c0-.47559-.31445-.74414-.92187-.74414-.49609,0-.83984.18213-.93848.50049h-.86035c.09082-.77344.81836-1.26953,1.83984-1.26953,1.12891,0,1.76563.562,1.76563,1.51318v3.07666h-.85547v-.63281h-.07031a1.515,1.515,0,0,1-1.35254.707A1.36026,1.36026,0,0,1,66.4009,13.42432Zm2.89453-.38477v-.37646l-1.09961.07031c-.62012.0415-.90137.25244-.90137.64941,0,.40527.35156.64111.835.64111A1.0615,1.0615,0,0,0,69.29543,13.03955Z" style="fill: #fff"/>
<path d="M71.34816,12.44434c0-1.42285.73145-2.32422,1.86914-2.32422a1.484,1.484,0,0,1,1.38086.79h.06641V8.437h.88867v6.26074h-.85156v-.71143h-.07031a1.56284,1.56284,0,0,1-1.41406.78564C72.0718,14.772,71.34816,13.87061,71.34816,12.44434Zm.918,0c0,.95508.4502,1.52979,1.20313,1.52979.749,0,1.21191-.583,1.21191-1.52588,0-.93848-.46777-1.52979-1.21191-1.52979C72.72121,10.91846,72.26613,11.49707,72.26613,12.44434Z" style="fill: #fff"/>
<path d="M79.23,12.44434a2.13323,2.13323,0,1,1,4.24707,0,2.13358,2.13358,0,1,1-4.24707,0Zm3.333,0c0-.97607-.43848-1.54687-1.208-1.54687-.77246,0-1.207.5708-1.207,1.54688,0,.98389.43457,1.55029,1.207,1.55029C82.12453,13.99463,82.563,13.42432,82.563,12.44434Z" style="fill: #fff"/>
<path d="M84.66945,10.19482h.85547v.71533h.06641a1.348,1.348,0,0,1,1.34375-.80225,1.46456,1.46456,0,0,1,1.55859,1.6748v2.915H87.605V12.00586c0-.72363-.31445-1.0835-.97168-1.0835a1.03294,1.03294,0,0,0-1.0752,1.14111v2.63428h-.88867Z" style="fill: #fff"/>
<path d="M93.51516,9.07373v1.1416h.97559v.74854h-.97559V13.2793c0,.47168.19434.67822.63672.67822a2.96657,2.96657,0,0,0,.33887-.02051v.74023a2.9155,2.9155,0,0,1-.4834.04541c-.98828,0-1.38184-.34766-1.38184-1.21582v-2.543h-.71484v-.74854h.71484V9.07373Z" style="fill: #fff"/>
<path d="M95.70461,8.437h.88086v2.48145h.07031a1.3856,1.3856,0,0,1,1.373-.80664,1.48339,1.48339,0,0,1,1.55078,1.67871v2.90723H98.69v-2.688c0-.71924-.335-1.0835-.96289-1.0835a1.05194,1.05194,0,0,0-1.13379,1.1416v2.62988h-.88867Z" style="fill: #fff"/>
<path d="M104.76125,13.48193a1.828,1.828,0,0,1-1.95117,1.30273A2.04531,2.04531,0,0,1,100.73,12.46045a2.07685,2.07685,0,0,1,2.07617-2.35254c1.25293,0,2.00879.856,2.00879,2.27V12.688h-3.17969v.0498a1.1902,1.1902,0,0,0,1.19922,1.29,1.07934,1.07934,0,0,0,1.07129-.5459Zm-3.126-1.45117h2.27441a1.08647,1.08647,0,0,0-1.1084-1.1665A1.15162,1.15162,0,0,0,101.63527,12.03076Z" style="fill: #fff"/>
</g>
</g>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 267 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

View File

@ -1,26 +0,0 @@
---
layout: home
title: 哪吒监控 - 服务器监控与运维工具
titleTemplate: 使用文档
hero:
name: 哪吒监控
text: 开源、轻量、易用的服务器监控与运维工具
image: https://raw.githubusercontent.com/naiba/nezha/master/resource/static/brand.svg
actions:
- theme: brand
text: 预览
link: https://ops.naibahq.com
- theme: alt
text: 开始使用 →
link: /guide/dashboard
features:
- title: 一键安装
details: 支持一键安装面板和监控服务,操作便捷。兼容主流系统,包括 Linux、Windows、macOS、OpenWRT 以及群晖。
- title: 实时监控
details: 支持同时监控多个服务器的状态,提供历史网络状态和延迟图表,监控网页、端口可用性和 SSL 证书状态。支持故障和流量等状态告警,可通过 Telegram、邮件、微信等多种方式提醒。
- title: 轻松运维
details: 提供 API 获取服务器状态支持WebSSH、DDNS 和流量监控。可设置定时和触发任务,并批量执行服务器任务。
---

View File

@ -1,4 +0,0 @@
{
"private": true,
"name": "vitepress-docs"
}

Some files were not shown because too many files have changed in this diff Show More