1
votes

Is there any plugin in jmeter for for checking the connectivity alone (able to connect particular host ad port is success/failure) and not the load. I am pretty new to jmeter. But when i researched i found that There is a plugin in jmeter - PerfMon Server Agent. It can be used for server monitoring. but i need particulerly to check only connectivity. Thanks

1

1 Answers

1
votes
  1. Why do you need the plugin when JMeter already comes with TCP Sampler? Example below configuration tests connectivity with example.com host on port 80

    JMeter TCP Sampler Check Connectivity

    Sampler will pass if it will be able to establish the connection with given host and port and otherwise fail. You can learn more about TCP Sampler usage from How to Load Test TCP Protocol Services with JMeter

  2. As an alternative you can use JSR223 Sampler, equivalent Groovy code would be something like:

    import org.apache.commons.io.IOUtils
    import java.net.Socket
    
    Socket s = null;
    
    try {
        s = new Socket('example.com', 80)
    }
    catch (Exception ex) {
        SampleResult.setSuccessful(false)   
        SampleResult.setResponseMessage(ex.getMessage())
    }
    finally {
        IOUtils.closeQuietly(s)
    }