Metricbeat - Error creating runner from config: failed to initialize condition

Attempting to fetch various bean data from Jboss instances by means of jolokia some works others fail though I can fetch them with curl, any hints appreciated on what/which condition is missing or faulty, TIA!

Getting errors like this

{"log.level":"error","@timestamp":"2022-10-26T01:50:26.555+0200","log.logger":"reload","log.origin":{"file.name":"cfgfile/list.go","file.line":99},"message":"Error creating runner from config: failed to initialize condition: missing or invalid condition","service.name":"metricbeat","ecs.version":"1.6.0"}

with a config like this:

- module: jolokia
  index: "%{[agent.name]}-%{[agent.version]}-jboss"
  namespace: "jboss.ws"
  metricsets: ["jmx"]
  processors:
    - drop_event:
        when:
            - has_fields: ['error.message']
    - add_fields:
        target: 'jolokia'
        fields:
          instance: "<instance name>"
  period: 1m
  hosts: [http://localhost:27380]
  path: "hawtio/jolokia/?ignoreErrors=true&canonicalNaming=false"
  username: "${JBOSS_USER}"
  password: "${JBOSS_PWD}"
  jmx.mappings:
    - mbean: "jboss.ws:context=*,endpoint=*"
      attributes:
        - attr: "ObjectName"
          field: "objectname"
        - attr: "TotalProcessingTime"
          field: "processingtime.total"
        - attr: "AverageProcessingTime"
          field: "processingtime.avg"
        - attr: "MaxProcessingTime"
          field: "processingtime.max"
        - attr: "MinProcessingTime"
          field: "processingtime.min"
        - attr: "FaultCount"
          field: "counts.fault"
        - attr: "RequestCount"
          field: "counts.request"
        - attr: "ResponseCount"
          field: "counts.response"

fetch bean data from curl works fine using same credentials:

$ curl -u luser 'http://localhost:27380/hawtio/jolokia/read/jboss.ws:context=*,endpoint=*/*'
Enter host password for user 'luser':
{"request":{"mbean":"jboss.ws:context=*,endpoint=*","type":"read"},"value":{"jboss.ws:context=main-server,endpoint=KalenderUdrulEndpointImpl":{"Address":"http:\/\/jbossws.undefined.host:27380\/main-server\/KalenderUdrulEndpointImpl","TotalProcessingTime":0,"UpdateTime":0,"FaultCount":0,"MinProcessingTime":0,"AverageProcessingTime":0,"RequestCount":0,"ResponseCount":0,"RecordProcessors":[{"processHeaders":true,"processOperation":true,"processSourceHost":true,"processDestinationHost":true,"processDate":true,"name":"LogRecorder","processMessageType":true,"processEnvelope":true,"recording":false,"filters":[]},{"processHeaders":true,"processOperation":true,"processSourceHost":true,"processMessageType":true,"processEnvelope":true,"recording":false,"maxSize":50,"filters":[],"size":0,"processDestinationHost":true,"processDate":true,"name":"MemoryBufferRecorder","clientHosts":[]}],"MaxProcessingTime":0},"jboss.ws:context=main-server,endpoint=SmsSendingEndpointImpl":{"Address":"http:\/\/jbossws.undefined.host:27380\/main-server\/SmsSendingEndpointImpl","TotalProcessingTime":0,"UpdateTime":0,"FaultCount":0,"MinProcessingTime":0,"AverageProcessingTime":0,"RequestCount":0,"ResponseCount":0,"RecordProcessors":[{"processHeaders":true,"processOperation":true,"processSourceHost":true,"processDestinationHost":true,"processDate":true,"name":"LogRecorder","processMessageType":true,"processEnvelope":true,"recording":false,"filters":[]},{"processHeaders":true,"processOperation":true,"processSourceHost":true,"processMessageType":true,"processEnvelope":true,"recording":false,"maxSize":50,"filters":[],"size":0,"processDestinationHost":true,"processDate":true,"name":"MemoryBufferRecorder","clientHosts":[]}],"MaxProcessingTime":0},...

from same jolokia.yml this module config is working just fine and sending data:

- module: jolokia
  index: "%{[agent.name]}-%{[agent.version]}-jvm"
  namespace: "jvm"
  metricsets: ["jmx"]
  processors:
    - drop_event:
        when:
          has_fields: ['error.message']
    - add_fields:
        target: 'jolokia'
        fields:
          instance: "<instance name>"
  period: 1m
  hosts: [http://localhost:27380]
  path: "hawtio/jolokia/?ignoreErrors=true&canonicalNaming=false"
  username: "${JBOSS_USER}"
  password: "${JBOSS_PWD}"
  jmx.mappings:
    - mbean: "java.lang:name=*,type=GarbageCollector"
      attributes:
        - attr: Name
          field: gc.name
        - attr: CollectionTime
          field: gc.time
        - attr: CollectionCount
          field: gc.count
        - attr: LastGcInfo
          field: gc.last

Hi @stefws ,

i see there is " " quotes in the first config file and in the second config file i do not see " " for attr and field.
Can we try removing those quotes for - attr: and - field:

I think condition should be:
when:
equals:
somevalue

Thanks for pointing out the area, has_field shouldn't have a dash prefix '-' now it works it must have been too late in the day/night :slight_smile:

2 Likes

Long live the king and the Elastic team.

1 Like

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