jmxtrans / jmxtrans

jmxtrans
MIT License
1.71k stars 503 forks source link

Object type with dot does not work #628

Open JaapD opened 6 years ago

JaapD commented 6 years ago

We have an JMX entry: xx.events. In that entry lives a jmxbean with the name "AsyncEventQueue.web" and attribute QueueSize.

In the jason config the following sniplet does not work:

      "obj" : "xx.events:type=AsyncEventQueue.web",
      "resultAlias": "eventqueue",
      "attr" : [ "QueueSize" ]

Is it not possible to have a dot in the name of an jmxbean? JConsole shows the attribute without any problem.

gquintana commented 6 years ago

What do you mean by "does not work"? Do you have an error in logs? Are you using allowDottedKeys setting?

JaapD commented 6 years ago

Nothing appears in Graphite, while other queries in the same configuration file get there output in Graphite. The logfiles have no errors for this outputWriter. Other queries have logging like: 2018-01-16 08:16:55,435 DEBUG [jmxtrans-query-1] model.Query - Executing queryName [Catalina:name="ajp-bio-8009",type=ThreadPool] from query [Query(objectName=Catalina:type=ThreadPool,name=*, keys=[], attr=[cur rentThreadCount, currentThreadsBusy], typeNames=[], resultAlias=connectors, useObjDomainAsKey=false, allowDottedKeys=false, useAllTypeNames=false, outputWriterInstances=[com.googlecode.jmxtrans.model.output.supp ort.ResultTransformerOutputWriter@2a889898])]

but not the AsyncEventQueue.web...

gquintana commented 6 years ago

@JaapD Can you share your configuration or part of it?

JaapD commented 6 years ago

This is the whole file:

{
  "servers" : [ {
    "port" : "2012",
    "host" : "localhost",
    "username" : "monitorRole",
    "password" : "paasbrood",
    "runPeriodSeconds" : 30,
    "queries" : [
    {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.GraphiteWriterFactory",
          "port" : 2003,
          "host" : "grafana.mgt.lan",
      "flushStrategy" : "timeBased",
      "flushDelayInSeconds" : "60",
          "typeNames" : [ "name" ],
          "rootPrefix":"jmx.pil.tmc34"
      } ],
      "obj" : "Catalina:type=ThreadPool,name=*",
      "resultAlias": "connectors",
      "attr" : [ "currentThreadCount", "currentThreadsBusy" ]
    },
    {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.GraphiteWriterFactory",
          "port" : 2003,
          "host" : "grafana.mgt.lan",
      "flushStrategy" : "timeBased",
      "flushDelayInSeconds" : "60",
          "typeNames" : [ "name" ],
          "rootPrefix":"jmx.pil.tmc34"
      } ],
      "obj" : "com.jamonapi.jmx:type=current,name=*",
      "resultAlias": "jamon",
      "attr" : [ "LastValue", "MaxActive", "Max" ]
    },
    {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.GraphiteWriterFactory",
          "port" : 2003,
          "host" : "grafana.mgt.lan",
      "flushStrategy" : "timeBased",
      "flushDelayInSeconds" : "60",
          "typeNames" : [ "name" ],
          "rootPrefix":"jmx.pil.tmc34"
      } ],
      "obj" : "java.lang:type=Threading",
      "resultAlias": "threads",
      "attr" : [ "DaemonThreadCount", "PeakThreadCount", "ThreadCount", "TotalStartedThreadCount" ]
    },
    {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.GraphiteWriterFactory",
          "port" : 2003,
          "host" : "grafana.mgt.lan",
      "flushStrategy" : "timeBased",
      "flushDelayInSeconds" : "60",
          "typeNames" : [ "name" ],
          "rootPrefix":"jmx.pil.tmc34"
      } ],
      "obj" : "solera.events:type=AsyncEventQueuefishWeb,name=*",
      "resultAlias": "eventqueue",
      "attr" : [ "QueueSize" ]
    },
    {
      "outputWriters" : [ {
        "@class" : "com.googlecode.jmxtrans.model.output.GraphiteWriterFactory",
          "port" : 2003,
          "host" : "grafana.mgt.lan",
      "flushStrategy" : "timeBased",
      "flushDelayInSeconds" : "60",
          "typeNames" : [ "name" ],
          "rootPrefix":"jmx.pil.tmc34"
      } ],
      "obj" : "java.lang:type=Memory",
      "resultAlias": "mem",
      "attr" : [ "FreeNonHeapMemoryUsage", "HeapMemoryUsage" ]
    } ],
    "numQueryThreads" : 2
  } ]
}
gehel commented 6 years ago

Side note: you could move the outputwriters definitions to the server and not duplicate them for each query.

JaapD commented 6 years ago

I tried, I hate duplication, but it did not work. Do you know where to find an example?