[collectd] Problems with Collectd's GenericJMX and Double Quotes

martin martin at uncommonsense-uk.com
Mon Nov 12 16:43:41 CET 2012


Hi all I need some help from your goodselves in the Collectd community. 

I've got a strange one here and I'm having trouble trying to sorting it, I've configured collectd with the GenericJMX plugin and I've got some of the metrics being collected under collectd.myvm1.* e.g.


collectd.myvm1.GenericJMX-memory.jmx_memory-heap-used


However a couple of entries appear under "collectd.myvm1.* e.g.


"collectd.myvm1.GenericJMX-request_processor-ajp-bio-8009\".
"collectd.myvm1.GenericJMX-request_processor-http-bio-8080\".


So I get two collectd top levels one clean and one starting with a double quote e.g. collectd.myvm1.* and "collectd.myvm1.*


I had some issues initially with the ajp-bio and http-bio being surrounded by escaped double quotes but faxm0dem on #collectd helped me out so I got rid those but I can't figure out how to lose the final two surrounding the collectd string. 


Here's my configuration:


===================Start Here====================
LoadPlugin "java"


LoadPlugin "match_regex"
LoadPlugin "target_replace"
<Chain PreCache>
  <Rule unquote>
    <Match regex>
      Plugin "^GenericJMX$"
    </Match>
    <Target replace>
      Plugin "\"" ""
    </Target>
  </Rule>
</Chain>


<Plugin "java">


  JVMArg "-verbose:jni"
  JVMARG "-Djava.class.path=/usr/share/collectd5/java/generic-jmx.jar:/usr/share/collectd5/java/collectd-api.jar"
  LoadPlugin "org.collectd.java.GenericJMX"


  <Plugin "GenericJMX">
    ################
    # MBean blocks #
    ################
    # Number of classes being loaded.
    <MBean "classes">
      ObjectName "java.lang:type=ClassLoading"
      #InstancePrefix ""
      #InstanceFrom ""


      <Value>
        Type "gauge"
        InstancePrefix "loaded_classes"
        #InstanceFrom ""
        Table false
        Attribute "LoadedClassCount"
      </Value>
    </MBean>


    # Time spent by the JVM compiling or optimizing.
    <MBean "compilation">
      ObjectName "java.lang:type=Compilation"
      #InstancePrefix ""
      #InstanceFrom ""


      <Value>
        Type "total_time_in_ms"
        InstancePrefix "compilation_time"
        #InstanceFrom ""
        Table false
        Attribute "TotalCompilationTime"
      </Value>
    </MBean>


    # Garbage collector information
    <MBean "garbage_collector">
      ObjectName "java.lang:type=GarbageCollector,*"
      InstancePrefix "gc-"
      InstanceFrom "name"


      <Value>
        Type "invocations"
        #InstancePrefix ""
        #InstanceFrom ""
        Table false
        Attribute "CollectionCount"
      </Value>


      <Value>
        Type "total_time_in_ms"
        InstancePrefix "collection_time"
        #InstanceFrom ""
        Table false
        Attribute "CollectionTime"
      </Value>


#      # Not that useful, therefore commented out.
#      <Value>
#        Type "threads"
#        #InstancePrefix ""
#        #InstanceFrom ""
#        Table false
#        # Demonstration how to access composite types
#        Attribute "LastGcInfo.GcThreadCount"
#      </Value>
    </MBean>


    ######################################
    # Define the "jmx_memory" type as:   #
    #   jmx_memory  value:GAUGE:0:U      #
    # See types.db(5) for details.       #
    ######################################


    # Generic heap/nonheap memory usage.
    <MBean "memory">
      ObjectName "java.lang:type=Memory"
      #InstanceFrom ""
      InstancePrefix "memory"


      # Creates four values: committed, init, max, used
      <Value>
        Type "jmx_memory"
        #InstancePrefix ""
        #InstanceFrom ""
        Table true
        Attribute "HeapMemoryUsage"
        InstancePrefix "heap-"
      </Value>


      # Creates four values: committed, init, max, used
      <Value>
        Type "jmx_memory"
        #InstancePrefix ""
        #InstanceFrom ""
        Table true
        Attribute "NonHeapMemoryUsage"
        InstancePrefix "nonheap-"
      </Value>
    </MBean>


    # Memory usage by memory pool.
    <MBean "memory_pool">
      ObjectName "java.lang:type=MemoryPool,*"
      InstancePrefix "memory_pool-"
      InstanceFrom "name"


      <Value>
        Type "jmx_memory"
        #InstancePrefix ""
        #InstanceFrom ""
        Table true
        Attribute "Usage"
      </Value>
    </MBean>


    ### MBeans by Catalina / Tomcat ###
    # The global request processor (summary for each request processor)
    <MBean "catalina/global_request_processor">
      ObjectName "Catalina:type=GlobalRequestProcessor,*"
      InstancePrefix "request_processor-"
      InstanceFrom "name"


      <Value>
        Type "io_octets"
        InstancePrefix "global"
        #InstanceFrom ""
        Table false
        Attribute "bytesReceived"
        Attribute "bytesSent"
      </Value>


      <Value>
        Type "total_requests"
        InstancePrefix "global"
        #InstanceFrom ""
        Table false
        Attribute "requestCount"
      </Value>


      <Value>
        Type "total_time_in_ms"
        InstancePrefix "global-processing"
        #InstanceFrom ""
        Table false
        Attribute "processingTime"
      </Value>
    </MBean>


    # Details for each  request processor
    <MBean "catalina/detailed_request_processor">
      ObjectName "Catalina:type=RequestProcessor,*"
      InstancePrefix "request_processor-"
      InstanceFrom "worker"


      <Value>
        Type "io_octets"
        #InstancePrefix ""
        InstanceFrom "name"
        Table false
        Attribute "bytesReceived"
        Attribute "bytesSent"
      </Value>


      <Value>
        Type "total_requests"
        #InstancePrefix ""
        InstanceFrom "name"
        Table false
        Attribute "requestCount"
      </Value>


      <Value>
        Type "total_time_in_ms"
        InstancePrefix "processing-"
        InstanceFrom "name"
        Table false
        Attribute "processingTime"
      </Value>
    </MBean>


    # Thread pool
    <MBean "catalina/thread_pool">
      ObjectName "Catalina:type=ThreadPool,*"
      InstancePrefix "request_processor-"
      InstanceFrom "name"


      <Value>
        Type "threads"
        InstancePrefix "total"
        #InstanceFrom ""
        Table false
        Attribute "currentThreadCount"
      </Value>


      <Value>
        Type "threads"
        InstancePrefix "running"
        #InstanceFrom ""
        Table false
        Attribute "currentThreadsBusy"
      </Value>
    </MBean>


    #####################
    # Connection blocks #
    #####################
    <Connection>
      ServiceURL "service:jmx:rmi:///jndi/rmi://localhost:8686/jmxrmi"
      User "jmxmonitoruser"
      Password "mypassword"
      Host "myhost"
      Collect "classes"
      Collect "compilation"
      Collect "garbage_collector"
      Collect "memory"
      Collect "memory_pool"
      Collect "catalina/global_request_processor"
      Collect "catalina/detailed_request_processor"
      Collect "catalina/thread_pool"
    </Connection>
  </Plugin>
</Plugin>

=================================================


Cheers


-Martin
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.verplant.org/pipermail/collectd/attachments/20121112/ab604f05/attachment.html>


More information about the collectd mailing list