How to listen to a port in cloverleaf using JMeter to receive messages and get them as response into JMeter Listeners? - jmeter

I have tried using Java Requests, TCP Samplers, JSR223 but nothing seems to work, a connection is established but no message is shown in the Listeners.

If you use Java Request or JSR223 Sampler it's you who needs to get the response, convert it into a byte array or a string and set it as a SampleResult.
See JavaDoc for all available functions (you're interested in setResponseData() mainly) and Top 8 JMeter Java Classes You Should Be Using with Groovy article for more information on this and other most commonly used JMeter API classes

Related

Jmeter: Access all results from all threadGroups from JSR223 Sampler or BeanShell Sampler in TeardownThread

is there a way to get info about all requests in the mentioned samplers after main thread group finished? In TeardownThread maybe?
I want to perform some calculation and send couple request which are based on info about those requests and it is to resource consuming to do it with sampler for each of the requests.
No.
The options are in:
Parse the .jtl results file
Use the JSR23 Listener in the main Thread Group. The Listeners obey JMeter Scoping Rules if you don't want your code to run after all samplers
Create a JMeter Plugin, the most suitable option for your case would be your own implementation of Backend Listener

Create a custom backend listener for jmeter for sending test variables and other data to Influxdb

I have a requirement to send custom parameters, variables and properties to InfluxDB as a part of my Jmeter tests so that we can analyze test data based on the functionality of the application.
As of now I can use backend listener for influxdb but it only has limited fields which would not be helpful in my case since I want to send more relevant data based on the application functionality.
Can someone point/help with right resources to develop a custom backend listener to send custom data to InfluxDB from jmeter and not depend on the existing listener.
I want a flexible option to send data as per our application and not restrict to only fields in listener.
Currently I am using a View Results in table to save this custom data to CSV files. The sample is shown in below snapshot.
To do this I have modified our user.properties files and specify the sample_variables, like below:
sample_variables=employee_code,user_id,transName,transType,transVer,deptID,deptType,deptName
But instead of using an additional listener, I would like to send these variables for EACH HIT (for every sample) to the influxDB. How do I achieve it? Any further help would be appreciated.
The easiest option is just using normal HTTP Request sampler to send the metrics you want via InfluxDB API.
If you still want to implement a custom listener you can first of all take a look at the existing Backend Listener code
Then get familiarized with the following materials:
How to write a plugin for JMeter
How to write your own JMeter listener. A guide
and maybe see a reference project like jmeter-backend-azure

Sending json payload to mqtt using jmeter

I am new to jmeter .Could someone provide me some idea how I can push a json payload using jmeter to my mqtt .
Added mqtt plugin and able to connect to my mqtt server and there is only option for string ,HexString or RandomString .
Also want to know the latency ,throughput for each message,any plugin please suggest ,I am using perfmon for cpu ,memory tracking now .
Just replace your `hi this is Chintamani" with your JSON payload like:
{"hi":"this is Chintamani"}
as JSON is nothing more than a structured string so String type should be just fine.
If you're using xmeter mqtt plugin - it does measure latency
Throughput is being measured by JMeter itself and according to JMeter Glossary it's just a number of requests which JMeter executed for the duration of the test.
You might be interested in Testing the MQTT Messaging Broker for IoT - A Guide article which sheds some light on the specifics of the MQTT load testing using JMeter

how to send custom metrics from Jmeter to InfluxDB

We are creating custom metrics in JMeter using beanshell scripting and saving them to a file.Our requirement is to send this metrics to InfluxDB. We tried using Backend Listener with Graphite and InfluxDB implementation client but couldn't send the custom values. Only the default Jmeter metrics are being passed.
Has anyone done this before, can you guide us to resolve this issues.
We are using Jmeter 3.3 and influxdb-1.4.2-1
Thanks,
BB
Two words: line protocol.
Another two words: custom listener (Beanshell/JSR223 with Groovy).
Marry them, and you'll have what you want.
I did that work once, and it didn't take long.
There may be other options (like, take this result file and feed it to script that shapes it to the same line protocol, but post-execution, not live) - but the one I suggest is the simplest.
To do it you can use /write endpoint as it described in influxdb.com
Image below shows how it can be done in Jmeter using "HTTP Request" sampler.
How to send custom data to influxDB:
In a DB it will looks like on image below:

JMeter JMS Point to Point not returning correct response

JMeter Version: 2.10 .
ActiveMQ 5.9
I have a point to point JMeter script that successfully places a message on a queue. This messaged is then consumed, transformed and placed on a different queue. When I test just a request method (from jmeter), the message is successfully submitted, transformed and returned to the out queue, however when I configure JMeter to consume the response on the out queue, it shows the original request message payload as the response.
Here is my JMeter script details:
JMS Resources
QueueuConnectionFactory: ConnectionFactory
JNDI Name Request Queue: Q.REQ
JNDI Name Reply Queue: Q.RPL
Message Properties
Communication Style: Request Response
Use alternate fields for message correlation: Use Request Message ID (ticked)
Content: (XML Payload)
JNDI Properties
InitialContextFactory: org.apache.activemq.jndi.ActiveMQInitialContextFactory
queue.Q.REQ: message.in
queue.Q.RPL: message.out
java.naming.security.principal: admin
java.naming.security.credentials: admin
Properties
Provider URL: tcp://localhost:61616
I've also tried a few different combinations such as removing the reply queue and specifying a JMSReplyTo as well as manually specifying a JMSCorrelationID. If someone could point me in the right direction or even provide a working jmeter proj example, it would be much appreciated. I also used this guide: http://jmeter.apache.org/usermanual/build-jms-point-to-point-test-plan.html to help build my test.
It looks like that you're missing Q.REQ and Q.RPL definition in JNDI Properties section. They should go along with InitialContextFactory bit.
See Building a JMS Testing Plan - Apache JMeter guide for more details.
Having spoke to a few people, this is a known issue and I haven't found a suitable workaround for this issue right now.
Currently I have had to use the JMeter JMS Pub/Sub Samplers to get this to work properly. If I hear back from the user group I will update this answer accordingly.

Resources