0
votes

I create a test.jmx as follow:

<?xml version="1.0" encoding="UTF-8"?>
 <jmeterTestPlan version="1.2" properties="5.0" jmeter="5.2.1">
  <hashTree>
   <TestPlan guiclass="TestPlanGui" testclass="TestPlan" testname="Test Plan" enabled="true">
  <stringProp name="TestPlan.comments"></stringProp>
  <boolProp name="TestPlan.functional_mode">false</boolProp>
  <boolProp name="TestPlan.tearDown_on_shutdown">true</boolProp>
  <boolProp name="TestPlan.serialize_threadgroups">false</boolProp>
  <elementProp name="TestPlan.user_defined_variables" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" testname="User Defined Variables" enabled="true">
    <collectionProp name="Arguments.arguments"/>
  </elementProp>
  <stringProp name="TestPlan.user_define_classpath"></stringProp>
</TestPlan>
<hashTree>
  <BackendListener guiclass="BackendListenerGui" testclass="BackendListener" enabled="true">
    <elementProp name="arguments" elementType="Arguments" guiclass="ArgumentsPanel" testclass="Arguments" enabled="true">
      <collectionProp name="Arguments.arguments">
        <elementProp name="influxdbMetricsSender" elementType="Argument">
          <stringProp name="Argument.name">influxdbMetricsSender</stringProp>
          <stringProp name="Argument.value">org.apache.jmeter.visualizers.backend.influxdb.HttpMetricsSender</stringProp>
          <stringProp name="Argument.metadata">=</stringProp>
        </elementProp>
        <elementProp name="influxdbUrl" elementType="Argument">
          <stringProp name="Argument.name">influxdbUrl</stringProp>
          <stringProp name="Argument.value">http://tsdb-test.intra.yiran.com:8086/write?db=opencloud_monitor;u=opencloud_monitor_rw;p=ZmFiM2IyMDgxNWQ5NGY4</stringProp>
          <stringProp name="Argument.metadata">=</stringProp>
        </elementProp>
        <elementProp name="application" elementType="Argument">
          <stringProp name="Argument.name">application</stringProp>
          <stringProp name="Argument.value">VIP_TestPlan_1</stringProp>
          <stringProp name="Argument.metadata">=</stringProp>
        </elementProp>
        <elementProp name="measurement" elementType="Argument">
          <stringProp name="Argument.name">measurement</stringProp>
          <stringProp name="Argument.value">jmeter</stringProp>
          <stringProp name="Argument.metadata">=</stringProp>
        </elementProp>
        <elementProp name="summaryOnly" elementType="Argument">
          <stringProp name="Argument.name">summaryOnly</stringProp>
          <stringProp name="Argument.value">false</stringProp>
          <stringProp name="Argument.metadata">=</stringProp>
        </elementProp>
        <elementProp name="samplersRegex" elementType="Argument">
          <stringProp name="Argument.name">samplersRegex</stringProp>
          <stringProp name="Argument.value">.*</stringProp>
          <stringProp name="Argument.metadata">=</stringProp>
        </elementProp>
        <elementProp name="percentiles" elementType="Argument">
          <stringProp name="Argument.name">percentiles</stringProp>
          <stringProp name="Argument.value">90;95;99</stringProp>
          <stringProp name="Argument.metadata">=</stringProp>
        </elementProp>
        <elementProp name="testTitle" elementType="Argument">
          <stringProp name="Argument.name">testTitle</stringProp>
          <stringProp name="Argument.value">Test name</stringProp>
          <stringProp name="Argument.metadata">=</stringProp>
        </elementProp>
        <elementProp name="eventTags" elementType="Argument">
          <stringProp name="Argument.name">eventTags</stringProp>
          <stringProp name="Argument.value"></stringProp>
          <stringProp name="Argument.metadata">=</stringProp>
        </elementProp>
      </collectionProp>
    </elementProp>
    <stringProp name="classname">org.apache.jmeter.visualizers.backend.influxdb.InfluxdbBackendListenerClient</stringProp>
  </BackendListener>
  <hashTree/>
  <ThreadGroup guiclass="ThreadGroupGui" testclass="ThreadGroup" testname="Example Thread Group" enabled="true">
    <stringProp name="ThreadGroup.num_threads">10</stringProp>
    <stringProp name="ThreadGroup.ramp_time">0</stringProp>
    <elementProp name="ThreadGroup.main_controller" elementType="LoopController" guiclass="LoopControlPanel" testclass="LoopController" enabled="true">
      <boolProp name="LoopController.continue_forever">false</boolProp>
      <intProp name="LoopController.loops">-1</intProp>
    </elementProp>
    <boolProp name="ThreadGroup.scheduler">true</boolProp>
    <stringProp name="ThreadGroup.duration">10</stringProp>
    <stringProp name="ThreadGroup.delay">0</stringProp>
    <stringProp name="ThreadGroup.on_sample_error">continue</stringProp>
    <boolProp name="ThreadGroup.same_user_on_next_iteration">true</boolProp>
  </ThreadGroup>
  <hashTree>
    <HTTPSamplerProxy guiclass="HttpTestSampleGui" testclass="HTTPSamplerProxy" enabled="true">
      <elementProp name="HTTPsampler.Arguments" elementType="Arguments" guiclass="HTTPArgumentsPanel" testclass="Arguments" enabled="true">
        <collectionProp name="Arguments.arguments"/>
      </elementProp>
      <stringProp name="HTTPSampler.domain">www.csdn.net</stringProp>
      <stringProp name="HTTPSampler.port">19252</stringProp>
      <stringProp name="HTTPSampler.protocol">http</stringProp>
      <stringProp name="HTTPSampler.contentEncoding"></stringProp>
      <stringProp name="HTTPSampler.path">/</stringProp>
      <stringProp name="HTTPSampler.method">GET</stringProp>
      <boolProp name="HTTPSampler.follow_redirects">false</boolProp>
      <boolProp name="HTTPSampler.auto_redirects">true</boolProp>
      <boolProp name="HTTPSampler.use_keepalive">false</boolProp>
      <boolProp name="HTTPSampler.DO_MULTIPART_POST">false</boolProp>
      <stringProp name="HTTPSampler.embedded_url_re"></stringProp>
      <stringProp name="HTTPSampler.connect_timeout">5000</stringProp>
      <stringProp name="HTTPSampler.response_timeout"></stringProp>
    </HTTPSamplerProxy>
    <hashTree/>
  </hashTree>
  <ResultCollector guiclass="SummaryReport" testclass="ResultCollector" enabled="true">
    <boolProp name="ResultCollector.error_logging">false</boolProp>
    <objProp>
      <name>saveConfig</name>
      <value class="SampleSaveConfiguration">
        <time>true</time>
        <latency>true</latency>
        <timestamp>true</timestamp>
        <success>true</success>
        <label>true</label>
        <code>true</code>
        <message>true</message>
        <threadName>true</threadName>
        <dataType>true</dataType>
        <encoding>false</encoding>
        <assertions>true</assertions>
        <subresults>true</subresults>
        <responseData>false</responseData>
        <samplerData>false</samplerData>
        <xml>false</xml>
        <fieldNames>true</fieldNames>
        <responseHeaders>false</responseHeaders>
        <requestHeaders>false</requestHeaders>
        <responseDataOnError>false</responseDataOnError>
        <saveAssertionResultsFailureMessage>true</saveAssertionResultsFailureMessage>
        <assertionsResultsToSave>0</assertionsResultsToSave>
        <bytes>true</bytes>
        <sentBytes>true</sentBytes>
        <url>true</url>
        <threadCounts>true</threadCounts>
        <idleTime>true</idleTime>
        <connectTime>true</connectTime>
      </value>
    </objProp>
    <stringProp name="filename"></stringProp>
    </ResultCollector>
    <hashTree/>
  </hashTree>
</hashTree>

no errors recorded in jmeter.log, but there are only "startedT" datas:

{
"time": "2020-01-16T13:11:42.507Z",
"application": "VIP_TestPlan_1",
"avg": null,
"count": null,
"countError": null,
"endedT": 0,
"hit": null,
"max": null,
"maxAT": 0,
"meanAT": 0,
"min": null,
"minAT": 0,
"pct90.0": null,
"pct95.0": null,
"pct99.0": null,
"rb": null,
"sb": null,
"startedT": 0,
"statut": null,
 "transaction": "internal"
},
{
  "time": "2020-01-16T13:11:47.507Z",
"application": "VIP_TestPlan_1",
"avg": null,
"count": null,
"countError": null,
"endedT": 0,
"hit": null,
"max": null,
"maxAT": 0,
"meanAT": 0,
"min": null,
"minAT": 0,
"pct90.0": null,
"pct95.0": null,
"pct99.0": null,
"rb": null,
"sb": null,
"startedT": 500,
"statut": null,
"transaction": "internal"
},

enter image description here

summary report: summary + 20166 in 00:00:18 = 1115.6/s Avg: 165 Min: 0 Max: 5300 Err: 0 (0.00%) Active: 500 Started: 500 Finished: 0 summary + 61507 in 00:00:30 = 2050.2/s Avg: 191 Min: 0 Max: 4499 Err: 0 (0.00%) Active: 500 Started: 500 Finished: 0 summary = 81673 in 00:00:48 = 1698.8/s Avg: 185 Min: 0 Max: 5300 Err: 0 (0.00%) summary + 4246 in 00:00:15 = 280.9/s Avg: 1570 Min: 0 Max: 18600 Err: 7 (0.16%) Active: 0 Started: 500 Finished: 500 summary = 85919 in 00:01:03 = 1359.6/s Avg: 253 Min: 0 Max: 18600 Err: 7 (0.01%) anything wrong with my jmx?

2

2 Answers

0
votes
  1. First of all don't expose your credentials to public
  2. Second, your .jmx test plan is missing </jmeterTestPlan> closing tag
  3. Your Backend Listener configuration looks good, I fail to see why the metrics are not stored, try increasing JMeter log level verbosity for the Backend Listener, it can be done by adding the next line to log4j2.xml file

    <Logger name="org.apache.jmeter.visualizers.backend.influxdb" level="debug"/>
    

    Once done check your jmeter.log file, it should contain lines like:

    HttpMetricsSender: Success, number of metrics written: x
    ...
    InfluxdbBackendListenerClient: Sending last metrics
    

    enter image description here

Assuming everything goes well you should see the data in the InfluxDB:

enter image description here

0
votes

thanks for your answer @Dmitri T, i found the cause of this problem, that this jmx works in my local computer, while could not write complete data into influxDB in pod(excute jmx in non-ui mode), everything went well after i changed the structure of hashtree in jmx, the backendlistner should in the subtree of threadgrouptree. But the reason of problem in the formal situation is still unknown