Skip to content
Cyrille Le Clerc edited this page Jun 4, 2013 · 8 revisions

EmbeddedJmxTrans configuration uses JSON and supports an Expression Language.

Configuration structure

Key configuration nodes are "queries" and "outputwriters" JSON nodes. "outputwriters" can be defined at the root level and at each query level.

{
 "queries": [
   ...
 ],
 "outputWriters": [
   ...
 ],
 "queryIntervalInSeconds": 15,
 "numQueryThreads": 1,
 "exportIntervalInSeconds": 30
}

Query configuration

Simple mono-valued attribute query

{
 "objectName": "java.lang:type=GarbageCollector,name=PS MarkSweep",
 "resultAlias": "jvm.gc.ps-marksweep",
 "attribute": "CollectionCount"
}

Multi mono-valued attributes attribute query

Compact style

{
 "objectName": "java.lang:type=GarbageCollector,name=PS MarkSweep",
 "resultAlias": "jvm.gc.ps-marksweep",
 "attributes": ["CollectionCount", "CollectionTime"]
}

Expanded style with attribute alias

{
 "objectName": "java.lang:type=GarbageCollector,name=PS MarkSweep",
 "resultAlias": "jvm.gc.ps-marksweep",
 "attributes": [
   {
     "name": "CollectionCount",
     "resultAlias": "collection-count"
   },
   {
     "name": "CollectionTime",
     "resultAlias": "collection-time"
   }
 ]
}

Mono composite/multi-valued attribute query

{
 "objectName": "java.lang:type=Memory",
 "resultAlias": "jvm.memory",
 "attribute":
   {
     "name": "HeapMemoryUsage",
     "keys": ["committed", "init", "max", "used"]
   }
}

Multi composite/multi-valued-attribute query

{
 "objectName": "java.lang:type=Memory",
 "resultAlias": "jvm.memory",
 "attributes": [
   {
     "name": "HeapMemoryUsage",
     "keys": ["committed", "init", "max", "used"]
   },
   {
     "name": "NonHeapMemoryUsage",
     "keys": ["committed", "init", "max", "used"]
   }
 ]
}

Output Writer Configuration

Graphite configuration

{
 "@class": "org.jmxtrans.embedded.output.GraphiteWriter",
 "settings": {
   "host": "${graphite.host:localhost}",
   "port": "${graphite.port:2003}"
 }
}

Note: this sample uses property placeholders with the {prop-name[:default-value]} syntax. See Expression Language.

EmbeddedJmxTrans expression language

EmbeddedJmxTrans uses an expression language based on property placeholders (e.g. "{graphite.host:2003}", ObjectName properties (e.g. "%name%") and basic functions (e.g. "#canonical_hostname#").

See Expression Language.

Detailed Sample

{
 "queries": [
   {
     "objectName": "cocktail:type=CocktailManager,name=CocktailManager",
     "resultAlias": "cocktail.cocktailmanager",
     "attribute": "AddedCommentCount"
   },
   {
     "objectName": "java.lang:type=GarbageCollector,name=PS MarkSweep",
     "resultAlias": "jvm.gc.ps-marksweep",
     "attributes": ["CollectionCount", "CollectionTime"]
   },
   {
     "objectName": "java.lang:type=GarbageCollector,name=PS Scavenge",
     "resultAlias": "jvm.gc.ps-scavenge",
     "attributes": ["CollectionCount", "CollectionTime"]
   },
   {
     "objectName": "java.lang:type=Memory",
     "resultAlias": "jvm.memory",
     "attributes": [
       {
         "name": "HeapMemoryUsage",
         "keys": ["committed", "init", "max", "used"]
       },
       {
         "name": "NonHeapMemoryUsage",
         "keys": ["committed", "init", "max", "used"]
       }
     ]
   },
   {
     "objectName": "java.lang:type=Threading",
     "resultAlias": "jvm.thread",
     "attributes": ["ThreadCount", "TotalStartedThreadCount", "DaemonThreadCount"]
   },
   {
     "objectName": "java.lang:type=Runtime",
     "resultAlias": "jvm.runtime",
     "attribute": "Uptime"
   },
   {
     "objectName": "java.lang:type=OperatingSystem",
     "resultAlias": "jvm.operatingsystem",
     "attributes": ["SystemLoadAverage", "ProcessCpuTime", "FreePhysicalMemorySize", "FreeSwapSpaceSize"]
   }
 ],
 "outputWriters": [
   {
     "@class": "org.jmxtrans.embedded.output.Slf4jWriter"
   },
   {
     "@class": "org.jmxtrans.embedded.output.GraphiteWriter",
     "settings": {
       "host": "${graphite.host:localhost}",
       "port": "${graphite.port:2003}"
     }
   }
 ],
 "queryIntervalInSeconds": 15,
 "numQueryThreads": 1,
 "exportIntervalInSeconds": 30
}
Clone this wiki locally