0
votes

I want to run jmeter distributed setup, but for some reason I need to Identify each slave with serial number, how can I give the serial number to all slaves like one slave has serial number 1, another is 2 and so on.

Is there any function in jmeter? giving in user input file is not the feasible solution for my setup. Think that only I have access to the master system.

2

2 Answers

1
votes

When you start those slaves you have to pass the variable with -J argument like that:

    for slave in slaves:           
        serial_index += 1
        run_jmeter_server_cmd = 'nohup java -jar "/bin/ApacheJMeter.jar" "-Djava.rmi.server.hostname={0}" -Dserver_port={1} -Jserial_index={3} > /dev/null 2>&1 '.format(hostname, port, serial_index)

And serial_index must be in User Defined Variables in test plan: serial_index: ${__P(serial_index)} Windows batch:

for /l %x in (1, 1, 100) do (
   echo %x
   jmeter -n -t C:\User\Scriptname.jmx -Jusers=0 -Jserial_number=%x
)

Linux bash:

for i in {1..5}
    cd $JMETER_DIR/bin/
    DIRNAME=`dirname $0`   
    nohup java $JVM_ARGS -jar "$JMETER_DIR/bin/ApacheJMeter.jar" "$@" "-Djava.rmi.server.hostname=$host" -Dserver_port=\$port -s -Jpoll=\$i > /dev/null 2>&1 &
done;
0
votes

If you have access only to the master system you will not be able to "set" anything, you can only use __machineName() and/or __machineIP() functions in order to distinguish where your Test Plan is running and use these functions i.e. in If Controller i.e. to run different branches of the Test Plan on different slaves or identify which slave produced this or that result.