0

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.

Deepak N
  • 1,408
  • 3
  • 15
  • 37

2 Answers2

1

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;
v0devil
  • 512
  • 1
  • 6
  • 23
  • Can you put the same above code in the form of jmeter -n -t C:\User\Scriptname.jmx -Jusers=0 format so that I can understand better – Deepak N Apr 13 '18 at 10:46
  • The same like you send Users. Or i did not get the question correctly – v0devil Apr 13 '18 at 11:17
  • sending users is same for all slaves but I need to send differet number for different slaves, such as 1 for first 2 for second 3 for third so on – Deepak N Apr 16 '18 at 04:33
0

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.

Dmitri T
  • 159,985
  • 5
  • 83
  • 133