arrow

Use CloudMonitor to better manage cloud resources

1. Experiment introduction

1.1 Knowledge points

This experiment is designed to help you learn how to use the CloudMonitor console to better manage cloud resources, which includes the following knowledge points:

  • Create an alert rule to be aware of exceptions of Alibaba services or sites in real time
  • Use site monitoring service to monitor an Nginx site
  • Clear monitoring resources in CloudMonitor

1.2 Experiment process

Start the lab environment, then the system will automatically create an ECS instance and an SLB instance. We will first install Nginx on the ECS instance, and use Alibaba Cloud’s CloudMonitor service to configure and view monitoring data of the ECS and SLB instances. Then, we’ll set an alert rule for the ECS instance and verify this rule. Then, we will use site monitoring service to monitor the status of the site that has been deployed with Nginx, and then set an alert rule and verify this rule. Finally, we will clear monitoring resources in CloudMonitor.

1.3 Cloud resources required

  • ECS instance (Ubuntu)
  • Server Load Balancer (SLB) instance
  • CloudMonitor

1.4 Requirements

  • Familiar with the use of Linux OS
  • Familiar with installation of Nginx in Linux
  • Familiar with how to view monitoring data and how to create alert rules in CloudMonitor
  • Familiar with the creation and use of site monitoring in CloudMonitor

1.5 Hint

  • When you enter the ECS console, the default region area may be different because of the different network addresses of your logon location. If you find that the resource automatically created in the document does not exist at the console interface, please manually switch to the United States - Silicon Valley’s region, you will find them there.

image desc

  • If you encounter some differences between the real experimental environment and the captured pictures in the lab manual, it may be caused by cloud portal version difference, which does not have a great impact on your experimental experience. You can click comment to give feedback to us. We will update the document in time. Thank you for your cooperation.

2. Start the lab environment

Click Start Lab in the upper right corner of the page to start the experiment.

image desc.

After the experiment environment is successfully started, the system has deployed resources required by this experiment in the background, including the ECS instance, RDS instance, Server Load Balancer instance, and OSS bucket. An account consisting of the username and password for logging on to the Web console of Alibaba Cloud is also provided.

image desc

After the experiment environment is started and related resources are properly deployed, the experiment starts a countdown. You have an hour to perform experimental operations. After the countdown ends, the experiment stops, and related resources are released. During the experiment, pay attention to the remaining time and arrange your time wisely. Next, use the username and password provided by the system to log on to the Web console of Alibaba Cloud and view related resources:

openCole

Go to the logon page of Alibaba Cloud console.

image desc

Fill in the sub-user account and click Next.

image desc

Fill in the sub-user password and click Log on.

image desc

After you successfully log on to the console, the following page is displayed.

image desc

3. Install Nginx on an ECS instance

3.1 Select an ECS instance

When the lab environment is started, the system has already created an ECS instance for us. Choose the option as shown in the following figure:

image desc

After entering the environment, select the running ECS. Choose the option as shown in the following figure:

image desc

The following figure shows a running ECS instance. We can see the ECS instance’s elastic IP address and the relevant configuration formation. We can also click Manage to perform other operations on the ECS instance:

image desc

3.2 Log on to the ECS instance remotely

If you are using a <font size=4>Windows</font> computer, please download the SSH tool putty

image desc

If you are using <font size=4>Linux</font> or <font size=4>Mac OS</font>, you can open the client application on your local computer and run the following command to log on to the ECS instance with the default account:

Account: root

Password: nkYHG890..

ssh root@ipadd

image desc

If you need to see the detailed login method, you can open the login link for further viewing.

3.3 Install Nginx

Before installation, update the software package by using the following command:

apt-get update

image desc

image desc

Install Nginx by using the following command:

apt-get install nginx -y

image desc

image desc

Check the firewall status. If it is inactive, proceed with the next step:

systemctl status firewalld

image desc

If it is active, disable it by using the following command:

systemctl stop firewalld

Check the Nginx service status. Leave it as is if it is enabled:

systemctl status nginx

image desc

If it is inactive, enable it by using the following command:

systemctl enable nginx
systemctl start nginx

Once the Nginx installation is finished we should verify the installation result.

3.4 Verify the installation result

Enter the ECS instance’s IP address in a browser’s address bar. The following figure indicates that the installation was successful.

http://ECS_ipadd

image desc

<font color='red'>The user can cut off the above result picture when doing the experiment and send it to the teacher, indicating that the part of the current chapter has been completed.</font>

Once Nginx deployment has completed we can proceed with the monitoring operations.

4. CloudMonitor operations on an ECS instance

4.1 Overview of the CloudMonitor page

First, select the CloudMonitor service as shown in the following figure:

image desc

After entering the CloudMonitor service page, we will be able to see functional options on the left and the functional module display pane on the right as shown in the following figure:

image desc

4.2 Configure the ECS Instance’s monitoring data

Click Host Monitoring, Enter the ECS instance’s management page as shown in the following figure:

image desc

After entering the console, we can see the ECS instance’s relevant information. To view the monitoring data, we must install a plug-in. We can click Click to install to install the plug-in as shown in the following figure:

image desc

After clicking Click to install, the agent status will be changed to Installing as shown in the following figure:

image desc

After the installation has been completed, the status will be changed to Running as shown in the following figure. We can see CPU, memory, and disk usage information on the right side:

image desc

4.3 View the ECS instance’s monitoring data

After installation of the plug-in, we are able to view the ECS instance’s monitoring data.

Click Monitoring Charts to go to the monitoring data page as shown in the following figure:

image desc

After entering the monitoring page, refresh the page several times to see the relevant data. The monitoring data page is shown as follows (the monitored items are too many, and I don’t want to show them all here):

image desc

4.4 Set an alert rule for the ECS instance

On the monitoring data page, we can see a lot of ECS related data. We can create an alert rule based on such data by proceeding with the following steps:

Click Create Alert Rule as shown in the following figure:

image desc

Create an alert rule as needed after entering the settings page by proceeding with the following steps:

Note that when setting an alert rule, we can see the real-time line chart data of the selected option on the right side. You can set the threshold value of the alert rule based on fluctuation of the line chart. In this experiment, I will set a rule where we can quickly see the result. When the data is 0 all the time, it sends an alert. This way, we can see the result very soon. Use of other rules are not demonstrated here.

image desc

The following is the group where the alerts will be sent to:

image desc

Click Confirm after entering the required information as shown in the following figure:

image desc

After creating the rule, we can see the relevant information of the alert as shown in the following figure:

image desc

image desc

4.5 Verify if the alert rule takes effect

After creating the alert rule, we don’t have to perform any operations, except for clicking Refresh after a specified period of time (according to the monitoring frequency) (set to be 1 minute in this experiment) as shown in the following figure:

image desc

When the status is changed to a red alert, it means the alert rule has taken effect.

4.6 Use site monitoring service to monitor status of the site that has been deployed with Nginx

Choose Site Manager in the status bar on the left side, and then click New Monitoring Task as shown in the following figure:

image desc

Enter the information as shown in the following figure when creating the site rule. We must enter the site type, site name, site address and the monitoring frequency.

image desc

Refer to the configuration below, Click Create.

image desc

4.7 Check monitoring status

Please wait a few minutes and refresh the page.

image desc

Click on nginx in the image above. Users can view more details themselves.

image desc

<font color='red'>The user can cut off the above result picture when doing the experiment and send it to the teacher, indicating that the part of the current chapter has been completed.</font>

5. CloudMonitor operations on an SLB instance

5.1 View the SLB instance

When the lab environment is started, the system has already created an SLB instance for us, as shown in the following figure:

image desc

The following figure shows the relevant information of the running SLB instance:

image desc

5.2 Add a listening port

We will create a new listening port for the SLB instance as shown in the following figure:

Click Configure Listener to go to the instance details page

image desc

Click Next.

image desc

Click Add More.

image desc

image desc

Click Next.

image desc

image desc

Click Submit.

image desc

Click OK.

image desc

Now, the listening port has been created. View the listening port that we have created as shown in the following figure:

image desc

Enter SLB’s IP address in the browser.

image desc

We can see that we have been directed to our ECS instance. If we have added two instances, we will be directed to one of the two instances randomly after refreshing the browser, which achieves load balancing.

5.3 View the SLB instance’s monitoring data

we will be able to see the running SLB instance as shown in the following figure:

image desc

Click Monitoring Charts, we will be able to see the SLB instance’s monitoring data as shown in the following figure:

image desc

We can only see two groups of data at first as shown in the following figure. The rest of the data will be available several minutes later.

image desc

Refresh the page several minutes later, then we will be able to see all the data. The following figure shows a part of the data:

image desc

<font color='red'>Users can cut off the above result picture when they are doing the experiment and send it to the teacher, indicating that the current experiment has been completed.</font>

Reminder:
Before you leave this lab, remember to log out your Alibaba RAM account before you click the ‘stop’ button of your lab. Otherwise you’ll encounter some issue when opening a new lab session in the same browser:

image desc image desc

7. Experiment summary

We studied the use of CloudMonitor in this experiment. First, we installed Nginx on an ECS instance, and used Alibaba Cloud’s CloudMonitor service to configure and view the monitoring data of the ECS and SLB instances. Then, we set an alert rule for the ECS instance, and verified the result. Next, we used the site monitoring service to monitor the status of the site that has been deployed with Nginx, and then set the site alert rule, and verified this rule. Finally, we cleared monitoring resources in CloudMonitor. In this experiment, we have installed Nginx, and used CloudMonitor and a status code. Therefore, to complete this experiment successfully, we must be familiar with Linux, CloudMonitor, and status codes.