1. What is a probe
The cloud probe can monitor the running status of the server. Its main purpose is to monitor the status of the server and give an alarm in time when the service is not running normally, so that maintenance can be carried out as soon as possible.
2. Installation
2.1. Prepare OAuth application
Nezha monitoring requires access to Github, Gitlab, Jihulab or Gitee as the background administrator account.
Create a new verification application (take Github as an example):
After logging into Github, open
https://github.com/settings/developers
Select "OAuth Apps" - "New OAuth App"
The configuration items are as follows:
Application name
- fill in freelyHomepage URL
- fill in the Access Domain Name of the panel, such as: "http://cdn.example.com"Authorization callback URL
- fill in the callback address, such as: "http://cdn.example.com/oauth2/callback"
After filling, click "Register application"
Save the Client ID on the page, and then click "Generate a new client secret" to create a new Client Secret. The newly created secret will only be displayed once, please keep it safe
If it is JihuLab, the application creation entry is:
https://jihulab.com/-/profile/applications
The callback address should be filled in Redirect URL
,
Check read_user
and read_api
in the scope below
After the creation is complete, save the application ID and password.
2.2, Install the panel side
If you are abroad, execute:
1 | curl -L https://raw.githubusercontent.com/naiba/nezha/master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo ./nezha.sh |
If your panel server is located in mainland China, you can use the mirror image:
1 | curl -L https://cdn.jsdelivr.net/gh/naiba/nezha@master/script/install.sh -o nezha.sh && chmod +x nezha.sh && sudo CN=true ./nezha.sh |
Qingbei Science and Technology CDN also supports acceleration of front-end and GitHub resources. For documentation reference:
Qingbei Technology CDN
https://cdn.tsinbei.com
If there is no Docker environment, it will be installed; after waiting for Docker to be installed, enter the following values respectively:
- `OAuth Provider| - Github, Gitlab, Jihulab, Gitee choose one
Client ID
: the previously saved Client IDClient Secret
: previously saved secret key- username : the username from the OAuth provider
- Site Title: Customize the site title
- Access port: public access port, customizable, default 8008
- Agent communication port: the communication port between Agent and Dashboard, default 5555
After the input is complete, wait for the image to be pulled;
After the installation is complete, if everything is normal, you can visit the domain name + port number, such as "http://cdn.example.com:8008" to view the panel.
If HTTPS or standard ports are required on the panel side, reverse proxy can be used, so I won’t repeat them here.
2.3, install Agent
Reference documents:
One-click installation of Agent
https://nezha.wiki/guide/agent.html
Note: If your system is a weird non-mainstream Linux distribution, such as TencentOS or its new name OpenCloudOS, when you download the Agent side during one-click installation, it will report an error and exit. At this time, you only need to write the Systemd file yourself:
/usr/lib/systemd/system/nezha-agent.service
1 | [Unit] Description=Nezha Agent Service [Service] ExecStart=/opt/nezha/agent/nezha-agent -s <panel IP>:<panel port> -p <Agent key> Restart=always [Install] WantedBy=multi-user.target |
Save after replacing the information.
instruction:
1 | systemctl start nezha-agent #start systemctl stop nezha-agent #stop |
It may take a few minutes to see the Agent go online on the panel after startup.
Services started in this way cannot be started automatically by systemctl enable
, but can:
1 | echo 'systemctl start nezha-agent' >> /etc/rc.d/rc.local |
Put the startup command in the list of autostart scripts.
Docker Website (18) Nezha Monitor
Comments