Skip to content

Instantly share code, notes, and snippets.

@faxm0dem
Created August 5, 2015 12:18
Show Gist options
  • Save faxm0dem/750d07f1d8dc57fbc4d7 to your computer and use it in GitHub Desktop.
Save faxm0dem/750d07f1d8dc57fbc4d7 to your computer and use it in GitHub Desktop.
collectd jmx example
<Plugin "java">
JVMARG "-Djava.class.path=/usr/share/collectd/java/collectd-api.jar:/usr/share/collectd/java/generic-jmx.jar"
LoadPlugin "org.collectd.java.GenericJMX"
<Plugin "GenericJMX">
<MBean "gc-count">
ObjectName "java.lang:type=GarbageCollector,*"
InstancePrefix "gc-"
InstanceFrom "name"
<Value>
Type "derive"
Table false
Attribute "CollectionCount"
InstancePrefix "count"
</Value>
</MBean>
<MBean "gc-time">
ObjectName "java.lang:type=GarbageCollector,*"
InstancePrefix "gc-"
InstanceFrom "name"
<Value>
Type "derive"
Table false
Attribute "CollectionTime"
InstancePrefix "time"
</Value>
</MBean>
<MBean "memory_pool">
ObjectName "java.lang:type=MemoryPool,*"
InstancePrefix "memory_pool-"
InstanceFrom "name"
<Value>
Type "memory"
Table true
Attribute "Usage"
</Value>
</MBean>
<MBean "memory-heap">
ObjectName "java.lang:type=Memory"
InstancePrefix "memory-heap"
<Value>
Type "memory"
Table true
Attribute "HeapMemoryUsage"
</Value>
</MBean>
<MBean "memory-nonheap">
ObjectName "java.lang:type=Memory"
InstancePrefix "memory-nonheap"
<Value>
Type "memory"
Table true
Attribute "NonHeapMemoryUsage"
</Value>
</MBean>
<MBean "thread">
ObjectName "java.lang:type=Threading"
InstancePrefix "threading"
<Value>
Type "gauge"
Table false
Attribute "ThreadCount"
InstancePrefix "count"
</Value>
</MBean>
<MBean "thread-daemon">
ObjectName "java.lang:type=Threading"
InstancePrefix "threading"
<Value>
Type "gauge"
Table false
Attribute "DaemonThreadCount"
InstancePrefix "count-daemon"
</Value>
</MBean>
<Connection>
ServiceURL "service:jmx:rmi:///jndi/rmi://localhost:17264/jmxrmi"
Collect "memory_pool"
Collect "memory-heap"
Collect "memory-nonheap"
Collect "gc-count"
Collect "gc-time"
Collect "thread"
Collect "thread-daemon"
</Connection>
</Plugin>
</Plugin>
@varh1i
Copy link

varh1i commented Mar 15, 2017

Awesome thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment