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:
- Information
- Input
- Calculation
- Formatting
- Scripting
- Properties
- Variables
- Strings
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:
- The machineIP function uses the Java method InetAddress.getLocalHost() and passes it to getHostAddress()
- The function can be used as ${__machineIP()}
Related Functions:
You may be interested: