Wednesday, July 31, 2013

jMeter-Server on OSX

If you want to run a jmeter-server unattended on one or several OSX boxes, you can perform this:

1. create /Library/LaunchAgents/org.apache.jmeter.server.plist


#>sudo vi /Library/LaunchAgents/org.apache.jmeter.server.plist


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>LimitLoadToSessionType</key>
<string>System</string>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.apache.jmeter.server.plist</string>
<key>Program</key>
<string>/Applications/JMeter-2.9.app/Contents/Resources/bin/jmeter-server</string>
<key>WorkingDirectory</key>
<string>/var/log</string>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>

Program path is  the path to the jmeter-server script. In the example above, I bundled jmeter 2.2 with Jar Bundler into an OSX app, added all jmeter folders to Contents/Resources (bin, lib folders) so I start the jmeter-server from the bundle app on several remote OSX boxes.

2. Load the plist file in launchctl:



# sudo launctl load /Library/LaunchAgents/org.apache.jmeter.server.plist

This should immediately start the jmeter-server with working directory set to /var/log (to get the jmeter-server.log logged in the system log dir)

3. Register remote jmeter-servers in jMeter

To register the jmeter-server instances in your local jMeter program, edit bin/jmeter.properties and edit the property "remote_hosts". Add your remote jmeter-servers by comma-separating the IP adresses. Example:

remote_hosts=127.0.0.1,192.168.17.12

No comments: