Apache JMeter – machineIP Function

machineIP is an in-build function of Apache JMeter and its type is ‘Information’. This function simply returns the IP address 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
Apache JMeter - machineIP Function

Let’s discuss about machineIP function:

Syntax: ${__machineIP}

Type: Information

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

Example:

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

Return Value: An IP Address i.e. the IP address 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 machineIP function is also used to print the IP address in logs as a basic information collection process.

Additional Information:

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

Related Functions:


You may be interested:


Leave a Comment