By using the Tomcat monitor function of jmeter, you can send a GET request to the Tomcat status page to obtain resource usage information and convert it to an intuitive image method, you can monitor the resource usage of the server. However, to use the Tomcat monitor function, you must install Tomcat on the server to be monitored.
1. configure $ catalina_home/CONF/tomcat-users.xml. The configuration is as follows:
<? XML version = '1. 0' encoding = 'utf-8'?>
<Tomcat-users>
<Role rolename = "manager"/>
<Role rolename = "admin"/>
<User Username = "admin" Password = "admin" roles = "Admin, Manager"/>
</Tomcat-users>
Note: two roles must be configured here. The admin role is responsible for Tomcat administration and the manager role is responsible for Tomcat Manager Management.
2. Create a test plan in jmeter
1. right-click the "thread group" and choose "add"> "Configuration component"> "HTTP Authorization manager". Here, jmeter can obtain data through the Basic Authentication of Tomcat, add the corresponding values to "User Name" and "password", as shown in
2. right-click "add" -- "sampler" -- "http request" on the "thread group". In the HTTP request interface that appears, add "Server IP", "port number", and other information, fill in "Manager/status" in "path" and add a parameter named "XML" to "SEND Parameters together with requests". The value is "true, select the "use as monitor" option at the bottom, as shown in:
3. finally, right-click "add"> "monitor result" on "http request" and then run the thread group (the number of cycles of the thread group can be set to "forever "), you can monitor Tomcat and save the monitoring data as a file for further analysis, as shown in:
Iii. Problems Encountered
1. The tomcatmanager status code: 401
2. tomcatmanager status code: 403 Access Denied
Solution: The tomcat-user.xml configures the user's maximum permissions, the configuration also reports an error because your Tomcat service has not restarted
3. The result graph of the jmeter monitor is empty. I tried the solution on the Internet and still couldn't do it. I don't know what's going on. I hope someone can give me some advice and record it here first.
Jmeter (14) jmeter monitoring Tomcat Performance