prometheus + grafana for server resource monitoring

In performance testing, server resources are worth paying attention to. At present, there are many server resource monitoring methods and various monitoring tools on the market, which are convenient for use in various projects.

However, in performance testing, which indicators are worthy of attention?

The monitoring has a classification system, which is quoted below:

In previous work, if we want to monitor server resources and DB, we can only rely on the task manager and the naked eye, and cannot save historical data. There are also large errors in the results, resulting in the inability to give accurate results.

The following is an introduction to prometheus:

node_expoert: The monitored machine. Both Windows and Linux systems can use Prometheus: Prometheus service, used for monitoring data collection and query, can be deployed under Windows and Linux

Grafana: Grafana service, used for data display, can be deployed under windows and Linux

node_expoert:(windows)

first step:

Open and run windows_exporter.exe

Verification method: visit in the browser: locahost:9182, if it can be accessed normally, the following content appears, indicating that the startup is successful:

现在我也找了很多测试的朋友,做了一个分享技术的交流群,共享了很多我们收集的技术文档和视频教程。
如果你不想再体验自学时找不到资源,没人解答问题,坚持几天便放弃的感受
可以加入我们一起交流。而且还有很多在自动化,性能,安全,测试开发等等方面有一定建树的技术大牛
分享他们的经验,还会分享很多直播讲座和技术沙龙
可以免费学习!划重点!开源的!!!
qq群号:110685036

 

Step 2: The firewall should be enabled on the server, and the port used needs to be allowed to pass through the firewall before it can be used.

Step 3: Verify whether it can be normal on another machine Enter the server's ip+9182 in the browser on another machine to check whether the same result as the first step occurs

node_expoert: (Linux, take centos7 as an example)

first step:

Upload node_expoert. The node_expoert used by Windows and Linux is inconsistent. Step 2:

move directory

Step 3: Start in the background

nohup /usr/local/node_exporter/node_exporter & If the output is appended to nohup.out, it is normal Step 4: Check whether the service is opened normally

Run: netstat -nultp

Successful startup results:

Step 4: The server should have opened the firewall

Under Linux, the port used by node_expoert is 9100. First check if the port is open:

Run: firewall-cmd --query-port=9100/tcp

If no is returned, the port is not open

Open the corresponding port:

firewall-cmd --zone=public --add-port=9100/tcp --permanent After opening the port, you need to restart the firewall:

firewall-cmd –reload

the fifth step:

Access the collection address on another machine:

Server ip:9100/metrics

If the following content appears, it means success

Prometheus:

Take windows as an example, if you need to use docker or Linux, please refer to: https://testerhome.com/topics/22231 Download: You can get the latest installation package on the official website

The first step: service startup: double-click to run

Authentication method:

Access the server ip+9090, it can be accessed normally, and the following content appears to indicate that the startup is successful

Step two:

prepare node_expoert

Open the configuration file of prometheus.yml and add a new job to the configuration file

Step 3: Restart the service of prometheus

the fourth step:

After a short delay, access the service address of prometheus. Enter status---targets to see the node_expoert just added

If the state of node_expoert is up, it means that the access to node_expoert is down, which means it failed

Grafana:

Grafana is an open source measurement analysis and visualization tool that can analyze, query, and then visualize the collected data, and realize alarms.

Service installation:

Visit the official website to get the installation package

Service start:

Enter GrafanaLabs\grafana\bin, run grafana-server.exe to start the service access address: server ip+3000

Similarly, if the firewall is open, you need to allow grafana-server.exe to access for the first time through the firewall, use

admini/admini can log in successfully. After that, the system will prompt to change the password. Just change the password that meets the requirements of the rules.

first step:

add data source

Enter Configuration-Data Sources, add a data source, select Prometheus

Data source settings:

Fill in the name and url and save it

Step two:

Add monitoring board Currently, we use the official board to click create----import

pay attention:

1. Windows machines and Linux machines use inconsistent kanban files. Windows machines can only use Windows kanban, and Linux machines can only use Linux kanban.

2. If node_expoert uses the latest V0.13.0 version when monitoring the window server, you need to modify and replace the query statement in the Kanban

Need to modify wmi_ to windows_

3. If you want to get the official dashboard, please visit: https://grafana.com/grafana/dashboards

The following are supporting learning materials. For friends who do [software testing], it should be the most comprehensive and complete preparation warehouse. This warehouse also accompanied me through the most difficult journey. I hope it can help you too!

Software testing interview applet

The software test question bank maxed out by millions of people! ! ! Who is who knows! ! ! The most comprehensive quiz mini program on the whole network, you can use your mobile phone to do the quizzes, on the subway or on the bus, roll it up!

The following interview question sections are covered:

1. Basic theory of software testing, 2. web, app, interface function testing, 3. network, 4. database, 5. linux

6. web, app, interface automation, 7. performance testing, 8. programming basics, 9. hr interview questions, 10. open test questions, 11. security testing, 12. computer basics

Information acquisition method:

Guess you like

Origin blog.csdn.net/jiangjunsss/article/details/132043074