# Jolokia Module No key error

**URL:** <https://discuss.elastic.co/t/jolokia-module-no-key-error/87979>\
**Category:** Beats\
**Tags:** metricbeat\
**Created:** [June 1, 2017, 8:06pm UTC](https://discuss.elastic.co/t/jolokia-module-no-key-error/87979 "2017-06-01T20:06:22Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![joshuaclark](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@joshuaclark](https://discuss.elastic.co/u/joshuaclark)\
**Post date:** [June 1, 2017, 8:06pm UTC](https://discuss.elastic.co/t/jolokia-module-no-key-error/87979/1 "2017-06-01T20:06:22Z")

</div>

Hi I'm trying to grab JVM metrics from

```auto
-mbean: 'mbean:type=FormatStatus,client=Client,format=Format,ftp=FtpId,FtpProtocol=sftp,FtpServer=server,FtpPort=22,dir=directory,filename=file.txt'
      attributes:
        - attr: LastError
          field: lasterror
          field_type: string
        - attr: LastFile
          field: lastfile
          field_type: string
        - attr: LastFileBlankLines
          field: lastfileblanklines
          field_type: integer
        - attr: LastFileError
          field: lastfileerror
          field_type: string
        - attr: LastFileFailedRecords
          field: lastfilefailedrecords
          field_type: integer
        - attr: LastFileLines
          field: lastfilelines
          field_type: integer
        - attr: LastFileLoadTimeMilliseconds
          field: lastfileloadtimemiliseconds
          field_type: integer
        - attr: LastFileLoadedRecords
          field: lastfileloadedrecords
          field_type: integer
        - attr: LastFileLoadedRecordsPerSecond
          field: lastfileloadedrecordspersecond
          field_type: integer
        - attr: Name
          field: name
          field_type: string
        - attr: Status
          field: status
          field_type: string

```

but it says no key found is there a way I can manually create the key? Does it mean that I need to add it to the template?

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [June 2, 2017, 2:07am UTC](https://discuss.elastic.co/t/jolokia-module-no-key-error/87979/2 "2017-06-02T02:07:18Z")

</div>

Can you run the Metricbeat 6.0.0 snapshot build with the `jolokia.jmx` debug selector enabled and post the log. I added some debug logging to the module that hasn't been released yet, so the [snapshot build](https://beats-nightlies.s3.amazonaws.com/index.html?prefix=metricbeat/) is required to get the extra info in the logs.

```auto
logging.level: debug
logging.selectors: ['jolokia.jmx`]

```

I'm pretty sure that key not found error indicates that one of the attributes you were expected did not exist in the response. You can have a look at the bean in JConsole to see its attributes.

---

<div class="post-metadata">

**Author:** ![joshuaclark](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@joshuaclark](https://discuss.elastic.co/u/joshuaclark)\
**Post date:** [June 2, 2017, 5:06pm UTC](https://discuss.elastic.co/t/jolokia-module-no-key-error/87979/3 "2017-06-02T17:06:39Z")

</div>

Here is the results in the log. I'm not getting the key error any more but after refreshing the fields list they still aren't showing. I did get to see 2 of the metrics that had errors and commented those out for now.

2017-06-02T12:55:37-04:00 DBG [jolokia.jmx] The response body from jolokia host localhost:7777 is: [{"timestamp":1496422537,"status":200,"request":{"mbean":"java.lang:type=Runtime","attribute":"Uptime","type":"read"},"value":{"Uptime":88637288}},{"timestamp":1496422537,"status":200,"request":{"mbean":"java.lang:type=Memory","type":"read"},"value":{"Verbose":false,"ObjectPendingFinalizationCount":0,"NonHeapMemoryUsage":{"max":136314880,"committed":30081024,"init":24576000,"used":29053128},"HeapMemoryUsage":{"max":492830720,"committed":492830720,"init":33554432,"used":319881352},"ObjectName":{"objectName":"java.lang:type=Memory"}}},{"timestamp":1496422537,"status":200,"request":{"mbean":"java.lang:type=OperatingSystem","attribute":"ProcessCpuLoad","type":"read"},"value":{"ProcessCpuLoad":0.0}},{"timestamp":1496422537,"status":200,"request":{"mbean":"java.lang:type=ClassLoading","attribute":["LoadedClassCount","TotalLoadedClassCount"],"type":"read"},"value":{"LoadedClassCount":3843,"TotalLoadedClassCount":4108}},{"timestamp":1496422537,"status":200,"request":{"mbean":"java.lang:type=Threading","attribute":["DaemonThreadCount","PeakThreadCount","ThreadCount"],"type":"read"},"value":{"PeakThreadCount":38,"DaemonThreadCount":21,"ThreadCount":31}},{"timestamp":1496422537,"status":200,"request":{"mbean":"com.west.wic.campLoad:type=ServerStatus","attribute":["Status","Version"],"type":"read"},"value":{"Status":"Running","Version":"4.1.9 (20170331-0910 - radupa)"}},{"timestamp":1496422537,"status":200,"request":{"mbean":"com.west.wic.campLoad:FtpPort=22,FtpProtocol=sftp,FtpServer=127.0.0.1,client=client,dir=_data\_client\_Seasonal\_Allergy\_inputs\_Processed,filename=ALLERGY\_REFILL_\_.MERGED.DUPLICATES,format=seasonalallergy,ftp=FtpId12,type=FormatStatus","attribute":["LastError","LastFile","LastFileBlankLines","LastFileError","LastFileFailedRecords","LastFileLines","LastFileLoadedRecords","Name","Status"],"type":"read"},"value":{"Name":"client - seasonalallergy","Status":"ready","LastFile":null,"LastFileLoadedRecords":0,"LastFileFailedRecords":0,"LastFileLines":0,"LastError":null,"LastFileBlankLines":0,"LastFileError":null}}]

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [June 2, 2017, 5:23pm UTC](https://discuss.elastic.co/t/jolokia-module-no-key-error/87979/4 "2017-06-02T17:23:48Z")

</div>

I formatted the response JSON to make it easier to read.

```auto
[
  {
    "timestamp": 1496422537,
    "status": 200,
    "request": {
      "mbean": "java.lang:type=Runtime",
      "attribute": "Uptime",
      "type": "read"
    },
    "value": {
      "Uptime": 88637288
    }
  },
  {
    "timestamp": 1496422537,
    "status": 200,
    "request": {
      "mbean": "java.lang:type=Memory",
      "type": "read"
    },
    "value": {
      "Verbose": false,
      "ObjectPendingFinalizationCount": 0,
      "NonHeapMemoryUsage": {
        "max": 136314880,
        "committed": 30081024,
        "init": 24576000,
        "used": 29053128
      },
      "HeapMemoryUsage": {
        "max": 492830720,
        "committed": 492830720,
        "init": 33554432,
        "used": 319881352
      },
      "ObjectName": {
        "objectName": "java.lang:type=Memory"
      }
    }
  },
  {
    "timestamp": 1496422537,
    "status": 200,
    "request": {
      "mbean": "java.lang:type=OperatingSystem",
      "attribute": "ProcessCpuLoad",
      "type": "read"
    },
    "value": {
      "ProcessCpuLoad": 0
    }
  },
  {
    "timestamp": 1496422537,
    "status": 200,
    "request": {
      "mbean": "java.lang:type=ClassLoading",
      "attribute": [
        "LoadedClassCount",
        "TotalLoadedClassCount"
      ],
      "type": "read"
    },
    "value": {
      "LoadedClassCount": 3843,
      "TotalLoadedClassCount": 4108
    }
  },
  {
    "timestamp": 1496422537,
    "status": 200,
    "request": {
      "mbean": "java.lang:type=Threading",
      "attribute": [
        "DaemonThreadCount",
        "PeakThreadCount",
        "ThreadCount"
      ],
      "type": "read"
    },
    "value": {
      "PeakThreadCount": 38,
      "DaemonThreadCount": 21,
      "ThreadCount": 31
    }
  },
  {
    "timestamp": 1496422537,
    "status": 200,
    "request": {
      "mbean": "com.west.wic.campLoad:type=ServerStatus",
      "attribute": [
        "Status",
        "Version"
      ],
      "type": "read"
    },
    "value": {
      "Status": "Running",
      "Version": "4.1.9 (20170331-0910 - radupa)"
    }
  },
  {
    "timestamp": 1496422537,
    "status": 200,
    "request": {
      "mbean": "com.west.wic.campLoad:FtpPort=22,FtpProtocol=sftp,FtpServer=127.0.0.1,client=client,dir=dataclient_Seasonal_Allergy_inputs_Processed,filename=ALLERGY_REFILL__.MER,
      "attribute": [
        "LastError",
        "LastFile",
        "LastFileBlankLines",
        "LastFileError",
        "LastFileFailedRecords",
        "LastFileLines",
        "LastFileLoadedRecords",
        "Name",
        "Status"
      ],
      "type": "read"
    },
    "value": {
      "Name": "client - seasonalallergy",
      "Status": "ready",
      "LastFile": null,
      "LastFileLoadedRecords": 0,
      "LastFileFailedRecords": 0,
      "LastFileLines": 0,
      "LastError": null,
      "LastFileBlankLines": 0,
      "LastFileError": null
    }
  }

```

---

<div class="post-metadata">

**Author:** ![joshuaclark](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@joshuaclark](https://discuss.elastic.co/u/joshuaclark)\
**Post date:** [June 2, 2017, 5:33pm UTC](https://discuss.elastic.co/t/jolokia-module-no-key-error/87979/5 "2017-06-02T17:33:42Z")

</div>

I did get 500 or so new fields with the new version of metricbeat. 1 of which conflicts haproxy.stat.check.health.last which was set to number but is now set to string. But I don't think that would be preventing the fields. I was wrong the message is showing this still

{ "message": "6 errors: metric key '' not found in response; metric key '' not found in response; metric key '' not found in response; metric key '' not found in response; metric key '' not found in response; metric key '' not found in response" }

---

<div class="post-metadata">

**Author:** ![andrewkroh](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/andrewkroh/32/3784_2.png) [@andrewkroh](https://discuss.elastic.co/u/andrewkroh)\
**Post date:** [June 2, 2017, 5:52pm UTC](https://discuss.elastic.co/t/jolokia-module-no-key-error/87979/6 "2017-06-02T17:52:45Z")

</div>

> [@joshuaclark](#):
>
> Would it be an issue with the null values?

I think null values are explicitly dropped from the object before being output by the Beat. So if it's the fields with null values that are missing then this would explain it.

---

<div class="post-metadata">

**Author:** ![joshuaclark](https://avatars.discourse-cdn.com/v4/letter/j/5daacb/32.png) [@joshuaclark](https://discuss.elastic.co/u/joshuaclark)\
**Post date:** [June 2, 2017, 6:08pm UTC](https://discuss.elastic.co/t/jolokia-module-no-key-error/87979/7 "2017-06-02T18:08:18Z")

</div>

I commented those out but no change.

2017-06-02T14:04:12-04:00 DBG [jolokia.jmx] The response body from jolokia host localhost:7777 is: [{"timestamp":1496426652,"status":200,"request":{"mbean":"java.lang:type=Runtime","attribute":"Uptime","type":"read"},"value":{"Uptime":92752901}},{"timestamp":1496426652,"status":200,"request":{"mbean":"java.lang:type=Memory","type":"read"},"value":{"Verbose":false,"ObjectPendingFinalizationCount":0,"NonHeapMemoryUsage":{"max":136314880,"committed":30212096,"init":24576000,"used":29155816},"HeapMemoryUsage":{"max":493355008,"committed":493355008,"init":33554432,"used":294691288},"ObjectName":{"objectName":"java.lang:type=Memory"}}},{"timestamp":1496426652,"status":200,"request":{"mbean":"java.lang:type=OperatingSystem","attribute":"ProcessCpuLoad","type":"read"},"value":{"ProcessCpuLoad":0.0}},{"timestamp":1496426652,"status":200,"request":{"mbean":"java.lang:type=ClassLoading","attribute":["LoadedClassCount","TotalLoadedClassCount"],"type":"read"},"value":{"LoadedClassCount":3843,"TotalLoadedClassCount":4108}},{"timestamp":1496426652,"status":200,"request":{"mbean":"java.lang:type=Threading","attribute":["DaemonThreadCount","PeakThreadCount","ThreadCount"],"type":"read"},"value":{"PeakThreadCount":38,"DaemonThreadCount":21,"ThreadCount":31}},{"timestamp":1496426652,"status":200,"request":{"mbean":"com.west.wic.campLoad:type=ServerStatus","attribute":["Status","Version"],"type":"read"},"value":{"Status":"Running","Version":"4.1.9 (20170331-0910 - radupa)"}},{"timestamp":1496426652,"status":200,"request":{"mbean":"com.west.wic.campLoad:FtpPort=22,FtpProtocol=sftp,FtpServer=127.0.0.1,client=client,dir=_data\_client\_Seasonal\_Allergy\_inputs\_Processed,filename=ALLERGY\_REFILL_\_.MERGED.DUPLICATES,format=seasonalallergy,ftp=FtpId12,type=FormatStatus","attribute":["LastFileBlankLines","LastFileFailedRecords","LastFileLines","LastFileLoadedRecords","Name","Status"],"type":"read"},"value":{"com.west.wic.campLoad:FtpPort=22,FtpProtocol=sftp,FtpServer=127.0.0.1,client=client,dir=_data\_client\_Seasonal\_Allergy\_inputs\_Processed,filename=ALLERGY\_REFILL_\_.MERGED.DUPLICATES,format=seasonalallergy,ftp=FtpId12,type=FormatStatus":{"Name":"client - seasonalallergy","Status":"ready","LastFileLoadedRecords":0,"LastFileFailedRecords":0,"LastFileLines":0,"LastFileBlankLines":0}}}]

it's missing all of these fields:  
"Name": "client - seasonalallergy",  
"Status": "ready",  
"LastFile": null,  
"LastFileLoadedRecords": 0,  
"LastFileFailedRecords": 0,  
"LastFileLines": 0,  
"LastError": null,  
"LastFileBlankLines": 0,  
"LastFileError": null

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [June 30, 2017, 6:08pm UTC](https://discuss.elastic.co/t/jolokia-module-no-key-error/87979/8 "2017-06-30T18:08:46Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
