Apache JMeter – machineName Function

machineName is an in-build function of Apache JMeter and its type is ‘Information’. This function simply returns the name of the machine on which JMeter runs. By the way, JMeter in-build functions are divided into eight categories which are:

  1. Information
  2. Input
  3. Calculation
  4. Formatting
  5. Scripting
  6. Properties
  7. Variables
  8. Strings

Let’s discuss about machineName function:

Syntax: ${__machineName}

Type: Information

Purpose: To get the name of the machine on which JMeter runs.

Example: Refer to the below screenshot.

Input Argument: No input value can pass in the machineName function.

Return Value: A string i.e. the name of the JMeter machine

Use: This function is helpful when a performance test runs in a distributed mode i.e. master-slave architecture and you want to filter out the requests based on the load generator (slave). But this is a rare case scenario. The machineName function is also used to print the name in the log as a basic information collection process.

Additional Information:

  1. The machineName function uses the Java method InetAddress.getLocalHost() and passes it to getHostName()
  2. The function can be used as ${__machineName()}

Related Functions:

You may be interested: