0
votes

I have this JSON:

{
  "totalMemory" : 12206567424,
  "totalProcessors" : 4,
  "version" : "0.4.1",
  "agent" : {
    "reconnectRetrySec" : 5,
    "agentName" : "1001",
    "checkRecovery" : false,
    "backPressure" : 10000,
    "throttler" : 100
  },
  "logPath" : "/eq/equalum/eqagent-0.4.1.0-SNAPSHOT/logs",
  "startTime" : 1494837249902,
  "status" : {
    "current" : "active",
    "currentMessage" : null,
    "previous" : "pending",
    "previousMessage" : "Recovery:Starting pipelines"
  },
  "autoStart" : false,
  "recovery" : {
    "agentName" : "1001",
    "partitionInfo" : { },
    "topicToInitialCapturePosition" : { }
  },
  "sources" : [ {
    "dataSource" : "oracle",
    "name" : "oracle_source",
    "captureType" : "directOverApi",
    "streams" : [ ],
    "idlePollingFreqMs" : 100,
    "status" : {
      "current" : "active",
      "currentMessage" : null,
      "previous" : "pending",
      "previousMessage" : "Trying to init storage"
    },
    "host" : "192.168.191.5",
    "metricsType" : { },
    "bulkSize" : 10000,
    "user" : "STACK",
    "password" : "********",
    "port" : 1521,
    "service" : "equalum",
    "heartbeatPeriodInMillis" : 1000,
    "lagObjective" : 1,
    "dataSource" : "oracle"
  } ],
  "upTime" : "157 min, 0 sec",
  "build" : "0-SNAPSHOT",
  "target" : {
    "targetType" : "equalum",
    "agentID" : 1001,
    "engineServers" : "192.168.56.100:9000",
    "kafkaOptions" : null,
    "eventsServers" : "192.168.56.100:9999",
    "jaasConfigurationPath" : null,
    "securityProtocol" : "PLAINTEXT",
    "stateMonitorTopic" : "_state_change",
    "targetType" : "equalum",
    "status" : {
      "current" : "active",
      "currentMessage" : null,
      "previous" : "pending",
      "previousMessage" : "Recovery:Starting pipelines"
    },
    "serializationFormat" : "avroBinary"
  }
}

I trying using Jmeter to extract out the value of agentID, how can I do that using Jmeter, what would be better ? using extractor or json extractor?

what I am trying to do is to extract agentID value in order to use it on another http request sample, but first I have to extract it from this request.

thanks!

1

1 Answers

1
votes

I believe using JSON Extractor is the best way to get this agentID value, the relevant JsonPath query will be as simple as $..agentID

Demo:

JMeter Json Extractor Demo

See the following reference material: