Merge pull request #3339 from jkohen/patch-1
[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         InstancePrefix "loaded_classes"
40         #InstanceFrom ""
41         Table false
42         Attribute "LoadedClassCount"
43       </Value>
44     </MBean>
45
46     # Time spent by the JVM compiling or optimizing.
47     <MBean "compilation">
48       ObjectName "java.lang:type=Compilation"
49       #InstancePrefix ""
50       #InstanceFrom ""
51
52       <Value>
53         Type "total_time_in_ms"
54         InstancePrefix "compilation_time"
55         #InstanceFrom ""
56         Table false
57         Attribute "TotalCompilationTime"
58       </Value>
59     </MBean>
60
61     # Garbage collector information
62     <MBean "garbage_collector">
63       ObjectName "java.lang:type=GarbageCollector,*"
64       InstancePrefix "gc-"
65       InstanceFrom "name"
66
67       <Value>
68         Type "invocations"
69         #InstancePrefix ""
70         #InstanceFrom ""
71         Table false
72         Attribute "CollectionCount"
73       </Value>
74
75       <Value>
76         Type "total_time_in_ms"
77         InstancePrefix "collection_time"
78         #InstanceFrom ""
79         Table false
80         Attribute "CollectionTime"
81       </Value>
82
83 #      # Not that useful, therefore commented out.
84 #      <Value>
85 #        Type "threads"
86 #        #InstancePrefix ""
87 #        #InstanceFrom ""
88 #        Table false
89 #        # Demonstration how to access composite types
90 #        Attribute "LastGcInfo.GcThreadCount"
91 #      </Value>
92     </MBean>
93
94     ######################################
95     # Define the "jmx_memory" type as:   #
96     #   jmx_memory  value:GAUGE:0:U      #
97     # See types.db(5) for details.       #
98     ######################################
99
100     # Generic heap/nonheap memory usage.
101     <MBean "memory">
102       ObjectName "java.lang:type=Memory"
103       #InstanceFrom ""
104       InstancePrefix "memory"
105
106       # Creates four values: committed, init, max, used
107       <Value>
108         Type "jmx_memory"
109         #InstancePrefix ""
110         #InstanceFrom ""
111         Table true
112         Attribute "HeapMemoryUsage"
113         InstancePrefix "heap-"
114       </Value>
115
116       # Creates four values: committed, init, max, used
117       <Value>
118         Type "jmx_memory"
119         #InstancePrefix ""
120         #InstanceFrom ""
121         Table true
122         Attribute "NonHeapMemoryUsage"
123         InstancePrefix "nonheap-"
124       </Value>
125     </MBean>
126
127     # Memory usage by memory pool.
128     <MBean "memory_pool">
129       ObjectName "java.lang:type=MemoryPool,*"
130       InstancePrefix "memory_pool-"
131       InstanceFrom "name"
132
133       <Value>
134         Type "jmx_memory"
135         #InstancePrefix ""
136         #InstanceFrom ""
137         Table true
138         Attribute "Usage"
139       </Value>
140     </MBean>
141
142     ### MBeans by Catalina / Tomcat ###
143     # The global request processor (summary for each request processor)
144     <MBean "catalina/global_request_processor">
145       ObjectName "Catalina:type=GlobalRequestProcessor,*"
146       InstancePrefix "request_processor-"
147       InstanceFrom "name"
148
149       <Value>
150         Type "io_octets"
151         InstancePrefix "global"
152         #InstanceFrom ""
153         Table false
154         Attribute "bytesReceived"
155         Attribute "bytesSent"
156       </Value>
157
158       <Value>
159         Type "total_requests"
160         InstancePrefix "global"
161         #InstanceFrom ""
162         Table false
163         Attribute "requestCount"
164       </Value>
165
166       <Value>
167         Type "total_time_in_ms"
168         InstancePrefix "global-processing"
169         #InstanceFrom ""
170         Table false
171         Attribute "processingTime"
172       </Value>
173     </MBean>
174
175     # Details for each  request processor
176     <MBean "catalina/detailed_request_processor">
177       ObjectName "Catalina:type=RequestProcessor,*"
178       InstancePrefix "request_processor-"
179       InstanceFrom "worker"
180
181       <Value>
182         Type "io_octets"
183         #InstancePrefix ""
184         InstanceFrom "name"
185         Table false
186         Attribute "bytesReceived"
187         Attribute "bytesSent"
188       </Value>
189
190       <Value>
191         Type "total_requests"
192         #InstancePrefix ""
193         InstanceFrom "name"
194         Table false
195         Attribute "requestCount"
196       </Value>
197
198       <Value>
199         Type "total_time_in_ms"
200         InstancePrefix "processing-"
201         InstanceFrom "name"
202         Table false
203         Attribute "processingTime"
204       </Value>
205     </MBean>
206
207     # Thread pool
208     <MBean "catalina/thread_pool">
209       ObjectName "Catalina:type=ThreadPool,*"
210       InstancePrefix "request_processor-"
211       InstanceFrom "name"
212
213       <Value>
214         Type "threads"
215         InstancePrefix "total"
216         #InstanceFrom ""
217         Table false
218         Attribute "currentThreadCount"
219       </Value>
220
221       <Value>
222         Type "threads"
223         InstancePrefix "running"
224         #InstanceFrom ""
225         Table false
226         Attribute "currentThreadsBusy"
227       </Value>
228     </MBean>
229
230     #####################
231     # Connection blocks #
232     #####################
233     <Connection>
234       ServiceURL "service:jmx:rmi:///jndi/rmi://localhost:17264/jmxrmi"
235       User "monitorRole"
236       Password "queeZie1"
237       Host "localhost"
238       Collect "classes"
239       Collect "compilation"
240       Collect "garbage_collector"
241       Collect "memory"
242       Collect "memory_pool"
243     </Connection>
244   </Plugin>
245 </Plugin>