contrib/GenericJMX.conf: Added a sample config file for the GenericJMX plugin.
[collectd.git] / contrib / GenericJMX.conf
1 # contrib/GenericJMX.conf
2 # -----------------------
3 #
4 # This is an example config file for the ‘GenericJMX’ plugin, a plugin written
5 # in Java to receive values via the “Java Management Extensions” (JMX). The
6 # plugin can be found in the
7 #   bindings/java/org/collectd/java/
8 # directory of the source distribution.
9 #
10 # This sample config defines a couple of <MBean /> blocks which query MBeans
11 # provided by the JVM itself, i. e. which should be available for all Java
12 # processes. The following MBean blocks are defined:
13 #
14 #   +-------------------+------------------------------------------------+
15 #   ! Name              ! Description                                    !
16 #   +-------------------+------------------------------------------------+
17 #   ! classes           ! Number of classes being loaded.                !
18 #   ! compilation       ! Time spent by the JVM compiling or optimizing. !
19 #   ! garbage_collector ! Number of garbage collections and time spent.  !
20 #   ! memory            ! Generic heap/nonheap memory usage.             !
21 #   ! memory_pool       ! Memory usage by memory pool.                   !
22 #   +-------------------+------------------------------------------------+
23 #
24 <Plugin "java">
25   LoadPlugin "org.collectd.java.GenericJMX"
26
27   <Plugin "GenericJMX">
28     ################
29     # MBean blocks #
30     ################
31     # Number of classes being loaded.
32     <MBean "classes">
33       ObjectName "java.lang:type=ClassLoading"
34       #InstancePrefix ""
35       #InstanceFrom ""
36
37       <Value>
38         Type "gauge"
39         Table false
40         Attribute "LoadedClassCount"
41         InstancePrefix "loaded_classes"
42       </Value>
43     </MBean>
44
45     # Time spent by the JVM compiling or optimizing.
46     <MBean "compilation">
47       ObjectName "java.lang:type=Compilation"
48       #InstancePrefix ""
49       #InstanceFrom ""
50
51       <Value>
52         Type "total_time_in_ms"
53         Table false
54         Attribute "TotalCompilationTime"
55         InstancePrefix "compilation_time"
56       </Value>
57     </MBean>
58
59     # Garbage collector information
60     <MBean "garbage_collector">
61       # Plugin instance:
62       InstancePrefix "gc-"
63       InstanceFrom "name"
64       ObjectName "java.lang:type=GarbageCollector,name=*"
65
66       <Value>
67         Type "invocations"
68         Table false
69         Attribute "CollectionCount"
70         # Type instance:
71         #InstancePrefix ""
72       </Value>
73
74       <Value>
75         Type "total_time_in_ms"
76         Table false
77         Attribute "CollectionTime"
78         # Type instance:
79         InstancePrefix "collection_time"
80       </Value>
81
82 #      # Not that useful, therefore commented out.
83 #      <Value>
84 #        Type "threads"
85 #        Table false
86 #        # Demonstration how to access composite types
87 #        Attribute "LastGcInfo.GcThreadCount"
88 #        # Type instance:
89 #        #InstancePrefix ""
90 #      </Value>
91     </MBean>
92
93     # Generic heap/nonheap memory usage.
94     <MBean "memory">
95       ObjectName "java.lang:type=Memory"
96       #InstanceFrom ""
97       InstancePrefix "memory"
98
99       # Creates four values: committed, init, max, used
100       <Value>
101         Type "memory"
102         Table true
103         Attribute "HeapMemoryUsage"
104         # Type instance:
105         InstancePrefix "heap-"
106       </Value>
107
108       # Creates four values: committed, init, max, used
109       <Value>
110         Type "memory"
111         Table true
112         Attribute "NonHeapMemoryUsage"
113         # Type instance:
114         InstancePrefix "nonheap-"
115       </Value>
116     </MBean>
117
118     # Memory usage by memory pool.
119     <MBean "memory_pool">
120       ObjectName "java.lang:type=MemoryPool,name=*"
121       InstancePrefix "memory_pool-"
122       InstanceFrom "name"
123
124       <Value>
125         Type "memory"
126         Table true
127         Attribute "Usage"
128         #InstancePrefix ""
129       </Value>
130     </MBean>
131
132     #####################
133     # Connection blocks #
134     #####################
135     <Connection>
136       Host "localhost"
137       ServiceURL "service:jmx:rmi:///jndi/rmi://localhost:17264/jmxrmi"
138       Collect "classes"
139       Collect "compilation"
140       Collect "garbage_collector"
141       Collect "memory"
142       Collect "memory_pool"
143     </Connection>
144   </Plugin>
145 </Plugin>