当前位置:网站首页>[technical grass planting] how to batch check your server status? Cloud probe panel setup tutorial

[technical grass planting] how to batch check your server status? Cloud probe panel setup tutorial

2022-06-24 01:47:00 Mintimate

author :Mintimate

Blog :https://www.mintimate.cn Mintimate's Blog, Just to share with you

The cover cannot be less !!!

Cloud probe

What is a cloud probe ? Cloud probe , In fact, it is to use TCP, After a handshake connection to the server , Get the running status of the server .

This cloud probe , Use Nezha panel , Can realize to oneself ( More than one ) The server :

  • Support system status
  • HTTP、TCP、Ping Monitoring and alarming
  • Planning tasks
  • Online terminals
probe

It is recommended that multi server users build , To improve security , Better prepare

  • domain name : Used to resolve domain name to Nezha panel ( Probe panel )API Interface , At the same time, you can compile panel migration .
  • CDN: The user resolves to the panel monitoring address , Opposite panel IP Protection , It is also convenient for migration .

This tutorial , The scheme used : domain name +CDN+ The server .

Double 11 bought so many servers , Finally, it can be monitored in batches ~

You can monitor your servers in batches

Effect demonstration

In fact, Tencent cloud's console , The information is complete , You can also see the current... On the console CPU And bandwidth , Watch one at a time :

Console

But it is always not intuitive , such as , An individual developer like me , There are several servers , You need to click one by one to view :

When there are many servers

Probe function

This is the time , Our probe is set up , You can visually view :

probe

Did you see my two servers at this time CPU It's full ?

Mainly , I'm compiling Android Source code , therefore CPU Run slowly , So the probe , It is also convenient for me to check whether the compilation is completed .

Log in online

Online login function , In fact, it is remote SSH. I know there are a lot of SSH Software for , such as : Tencent cloud's online one click login 、Windows Of Powershell and Linux/macOS Of Terminal wait .

But the Nezha panel also provides one button SSH Sign in , The effect is similar to the online one click login of Tencent cloud :

One click login

Login effect :

Login successful

Of course , Such login , It's Secret free , Use the premise :

  • User login Nezha panel
  • Yes Nginx Anti generation environment support

Don't talk much , Let's start the tutorial .

precondition

The first is the precondition , The basic requirements are simple :

  • At least one server
  • Github or Gitee account number

Enhance the experience :

  • Two domain names ( No top-level domain name , Two secondary or tertiary domain names are sufficient )
  • CDN( Tencent cloud is recommended CDN content distribution )

Recently, double 11 , It is highly recommended that new users purchase servers :https://curl.mintimate.cn/1jccDM8rK1S

Double eleven servers are recommended

here hypothesis I have prepared the domain name :

  • ops.mintimate.cn: Panel external domain name ( You can use CDN)
  • nezha.mintimate.cn: Probe connection domain name ( Not to be used CDN)

Why do you do this ? Draw a simple diagram :

Why do I need two domain names

That is to say :

  • Panel external domain name (CDN) It is used for public network access ;
  • Probe connection domain name ( Not to be used CDN), It is used to receive probe data , It is convenient to migrate the panel in the future .

CDN analysis

Considering the use of CDN Little buddy , Not as many people as the server , Here is how to use Tencent cloud CDN analysis . First, log in to Tencent cloud CDN backstage :https://console.cloud.tencent.com/cdn

after , Add a domain name here :

Add domain name

Remember to configure Https, Increase security :

To configure Https

Build panels

First we need to apply for a Oauth, Then the panel can be formally built , This server serves as the server where the panel is located and provides probes .

apply Oauth

apply Oauth, You can use GitHub, You can also use Gitee Of , Take one of the two :

In this paper, Gitee Method ,GitHub In fact, it's almost .

The permission can be set by default :

Default permissions

among :

  • apply name : at will , Just a code name. .
  • Application description : Ditto panel external domain name , It can be for IP, But it's not safe .
  • App home : As above, add the callback address to the external domain name in the panel , Nezha panel callback address is :/oauth2/callback

After creating the app , obtain :

  • Client ID: client ID, The following text requires .
  • Client Secret: Client key , The following text requires .
    The creation is complete

Remote connection

Here we use SSH Connect to our server remotely :

Remote connection successful

Here I use the server oh-my-zsh, If you want to use , article :Linux/Mac How to configure ZSH And use Oh-my-zsh? Make your terminal more practical 、 beautiful

Run script

According to official website Project tips , We can use the one click installation script to install :

curl -L https://cdn.jsdelivr.net/gh/naiba/[email protected]/script/install.sh -o nezha.sh && chmod +x nezha.sh
CN=true sudo ./nezha.sh

Note here , We'd better run the script in an empty folder , It is convenient to call up the script control interface later , such as :

Run the installation script

after , Will ask if , We choose 1

choice 1: Install the panel

After selection , Input Gitee( If you use GitHub, Just hit enter ):

choice Gitee

Last , Enter the client generated above ID And key :

installation is complete

Here we are , The panel is installed . Actually , You can release 8008 After the port , The browser visited . But for the convenience of access 、 Security , Use Nginx Reverse proxy .

Be careful , This is the administrator account :

The account number is the same as this one

Nginx Reverse proxy

Nginx Reverse proxy is too simple , But consider that many users use pagoda panels , So there is a two-step demonstration :

  • Conventional methods : Use compile 、 Package manager or Docker Installed Nginx, Set up your own Nginx.conf.
  • Pagoda method : Use the pagoda to install Nginx.

If you don't know how to install Ngixn, Reference resources : An article 、 There are three ways Debian Easy to install on Nginx

The domain name resolved here is the external domain name of the panel mentioned above ( You can use CDN), This is what was assumed above ops.mintimate.cn. If it's Tencent cloud CDN, You can go to CDN Console Set up .

Conventional methods

Conventional methods , Create a new one conf, stay conf Add reverse proxy in :

location /
{
	proxy_pass http://127.0.0.1:8008;
	proxy_set_header Host $host;
}
location ~ ^/(ws|terminal/.+)$
{
	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 $host;
}
Nginx Set up

among :

location ~ ^/(ws|terminal/.+)$
{
	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 $host;
}

For remote terminal function , need Nginx Install regular rules , If you do not need the remote login function , Don't write .

Last , Save overloads Nginx The configuration can be .

Pagoda method

The pagoda method is also very simple , After adding a website , Select reverse proxy :

Reverse proxy

After adding any proxy , Editing :

edit

Paste content :

location /
{
	proxy_pass http://127.0.0.1:8008;
	proxy_set_header Host $host;
}
location ~ ^/(ws|terminal/.+)$
{
	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 $host;
}
Modify the reverse proxy

among :

location ~ ^/(ws|terminal/.+)$
{
	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 $host;
}

For remote terminal function , need Nginx Install regular rules , If you do not need the remote login function , Don't write .

Browser access

This is the time , You can access it through the browser , If open CDN, There may be a caching mechanism , Remember to cache .

Browser access successful

Create probe

Now? , We can create the probe , The first is the initialization of the panel , Then create the probe , Finally, place the probe .

Initialization panel

Initialization panel , It's simple . After browser access panel , Click login :

Click login

after , Will use Gitee/GitHub To verify :

verification

After verification , Our initialization is complete .

Once the initialization is complete , Backstage

Add key

after , We add a key , Click on the Add host

Add servers
After adding , Get the key

This key is very important , That's what follows Agent secret key , Used to bind the server .

Insert the probe

after , We log in to the server we need to detect , Run... Above Build panels - Run script One click script in , That is to say :

curl -L https://cdn.jsdelivr.net/gh/naiba/[email protected]/script/install.sh -o nezha.sh && chmod +x nezha.sh
CN=true sudo ./nezha.sh

Of course , If you have run this script before , You can run the script directly :

If there is an installation script before

This is the time , We are not choosing Install the panel end 了 , But to choose 8( Installation monitoring Agent):

Installation monitoring ( probe )
i setup script

among :

  • Don't go ahead CDN Domain name of , That's what I mentioned above “「nezha.mintimate.cn: Probe connection domain name ( Not to be used CDN)」”

This is the time , We can go to the panel home page , See our server :

Our servers

matters needing attention

Of course , You can also add more probes , But we need to pay attention :

  • Add host after , The key may not be displayed immediately , This is the reason for caching ; If you don't use it CDN, You can force the browser to refresh directly , If you use CDN, You can go to CDN The console is refreshed and preheated .
  • The migration panel is simple , Data is stored in /opt/nezha In the folder , Package this folder when migrating data , Unzip to the new environment . Then execute the one click script installation .

END

Here we are , Our cloud probe panel has been installed . Many people are concerned about performance , In fact, whether it is a panel or a probe , The memory consumption of the server is extremely low .

among , Panel function , Can be found in 64M Running on the memory server , Probe words , Not to mention oh .

That's good
原网站

版权声明
本文为[Mintimate]所创,转载请带上原文链接,感谢
https://yzsam.com/2021/11/20211115100103575r.html