Steps:
1. Install the plug-in manager
The role of the plug-in manager: It can provide online installation, upgrade and uninstallation of extension plug-ins. Because we need to install monitoring plug-ins online, we must first install the plug-in manager.
Download address of plug-in manager: https://jmeter-plugins.org/install/Install/
Download "plugins-manager.jar" as shown in the figure below. After downloading, place it in the "jmeter\lib\ext" directory and restart jmeter.
2. Install the resource monitoring extension plug-in
Click "Options"\"Plugins Manager" to open the plug-in manager dialog box ;
Switch to the "Available Plugins Upgrades" tab, select "PerMon (Servers Performance Monitoring)", and click "Apply Changes and Restart JMeter";
Observe the download and installation progress. After the installation is completed, JMeter will automatically restart.
Note: You can also put the downloaded jar package directly into the "jmeter\lib\ext" directory and restart jmeter.
3. Install the server monitoring agent
Download "ServerAgent-2.2.3", unzip it and copy it to the server to be monitored. It is common for windows and Linux. Before using this agent service, the JDK must be installed and configured successfully. I'll take centos as an example. picture
4. Start the monitoring agent
Switch to "ServerAgent-2.2.3" and enter ./startAgent.sh;
[root@localhost ServerAgent-2.2.3]# ./startAgent.sh
bash: ./startAgent.sh: Permission denied
If the reported permissions are not enough, increase the permissions through chmod;
[root@localhost ServerAgent-2.2.3]# chmod 775 startAgent.sh
Then start the proxy service again. The following prompt appears to prove success. The default port is 4444.
[root@localhost ServerAgent-2.2.3]# ./startAgent.sh
Java HotSpot™ Client VM warning: You have loaded library /usr/local/ServerAgent-2.2.3/ServerAgent-2.2.3/lib/libsigar-x86- linux.so which might have disabled stack guard. The VM will try to fix the stack guard now.
It's highly recommended that you fix the library with 'execstack -c ', or link it with '-z noexecstack'.
^[[AINFO 2019-07-31 20:10:05.695 [kg.apc.p] (): Binding UDP to 4444
INFO 2019-07-31 20:10:06.709 [kg.apc.p] (): Binding TCP to 4444
INFO 2019-07-31 20:10:06.799 [kg.apc.p] (): JP@GC Agent v2.2.3 started
5. Add resource monitoring
Add "jp@gc - PerfMon Metrics Collector" listener in JMeter script
Add the resource of the listening server, click "Add Row" in the "jp@gc - PerfMon Metrics Collector" listener;
Host/IP: The default is localhost, change it to the IP or domain name that needs to be monitored, and the port must be consistent with the server port that starts the agent;
Metric to Collect: You can select CPU, Disks I/O, Network I/O, etc. according to the monitoring requirements. You can only select one at a time. If you want to monitor multiple resources, you can click "Add Row" to continue adding.
6. Execute script to observe indicators
Observe changes in execution performance indicators.
If it cannot be monitored, it may be due to the server firewall. After closing the firewall, restart the proxy service and execute the performance script.
[root@localhost sq]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@localhost sq]#
Finally, I would like to thank everyone who reads my article carefully. Reciprocity is always necessary. Although it is not a very valuable thing, if you can use it, you can take it directly:
This information should be the most comprehensive and complete preparation warehouse for [software testing] friends. This warehouse has also accompanied tens of thousands of test engineers through the most difficult journey. I hope it can also help you!