How to get Machine IP Address using beanshell in JMeter?

Nikhil

I am trying to write a script in beanshell for jmeter through which I can get the IP address of a machine (using ipconfig command and extract only IP Address from the output)?

The following code is giving only the IP of the request of which needs to be passed to jmeter.

String IP = InetAddress.getByName(prev.getURL().getHost()).getHostAddress();
vars.put("IP", IP);

Can anyone guide me?

Naveen Kumar R B

you can also use as follows:

log.info("IP " + InetAddress.getLocalHost().getHostAddress());
String IP = InetAddress.getLocalHost().getHostAddress();
vars.put("localIP", IP);

later, you can refer the IP using the following syntax:

${localIP} or vars.get("localIP")

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to get the name given to transaction controller using beanshell preprocesssor in jmeter

How to get the IP address of a Unix machine?

How to get value from property in BeanShell (jmeter)

How to get public ip address for virtual-machine using Azure CLI command

How to get IP address of MAAS machine by terraform output

How to get the primary IP address of the local machine on Linux and OS X?

how to get container host machine ip address and container name in EKS

How to get the machine IP address in a “systemd” service file

How to get the IP address of a client using aiohttp

how to get ip address using rack and geocoder

How to get IP address using q language

How to get response message HTTP Request on Beanshell Jmeter

Get correct IP address of user machine

How do i remove empty parameter using beanshell preprocessor in jmeter

How to generate hash(SHA1) using beanshell in JMeter?

How can we Verify Json response using Beanshell in Jmeter?

how to fetch ip address in JMeter remote testing

Querying Sesame on local machine using IP address

Getting the IP address of the current machine using Java

How to get MAC address of your machine using a C program?

Using grep to get ip address

How do I get `apt-get update` to work on a machine with no internet access and manually assigned IP address?

How to set static IP address on the FreeBSD machine?

How can I get IP address showing from using Conky

How to get the real IP address of someone using a proxy?

How to get a URL address without IP or hostname using javascript or jQuery?

How to get latitude and longitude from IP address using maxmind?

How to get IP Address in ubuntu when installed using virtual box

how to get client public ip address using php?