Code

Revert "Revert "Merge tag 'upstream/5.5.0'""
[pkg-collectd.git] / src / collectd-java.5
1 .\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28)
2 .\"
3 .\" Standard preamble:
4 .\" ========================================================================
5 .de Sp \" Vertical space (when we can't use .PP)
6 .if t .sp .5v
7 .if n .sp
8 ..
9 .de Vb \" Begin verbatim text
10 .ft CW
11 .nf
12 .ne \\$1
13 ..
14 .de Ve \" End verbatim text
15 .ft R
16 .fi
17 ..
18 .\" Set up some character translations and predefined strings.  \*(-- will
19 .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
20 .\" double quote, and \*(R" will give a right double quote.  \*(C+ will
21 .\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
22 .\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
23 .\" nothing in troff, for use with C<>.
24 .tr \(*W-
25 .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
26 .ie n \{\
27 .    ds -- \(*W-
28 .    ds PI pi
29 .    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
30 .    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
31 .    ds L" ""
32 .    ds R" ""
33 .    ds C` ""
34 .    ds C' ""
35 'br\}
36 .el\{\
37 .    ds -- \|\(em\|
38 .    ds PI \(*p
39 .    ds L" ``
40 .    ds R" ''
41 .    ds C`
42 .    ds C'
43 'br\}
44 .\"
45 .\" Escape single quotes in literal strings from groff's Unicode transform.
46 .ie \n(.g .ds Aq \(aq
47 .el       .ds Aq '
48 .\"
49 .\" If the F register is turned on, we'll generate index entries on stderr for
50 .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index
51 .\" entries marked with X<> in POD.  Of course, you'll have to process the
52 .\" output yourself in some meaningful fashion.
53 .\"
54 .\" Avoid warning from groff about undefined register 'F'.
55 .de IX
56 ..
57 .nr rF 0
58 .if \n(.g .if rF .nr rF 1
59 .if (\n(rF:(\n(.g==0)) \{
60 .    if \nF \{
61 .        de IX
62 .        tm Index:\\$1\t\\n%\t"\\$2"
63 ..
64 .        if !\nF==2 \{
65 .            nr % 0
66 .            nr F 2
67 .        \}
68 .    \}
69 .\}
70 .rr rF
71 .\"
72 .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
73 .\" Fear.  Run.  Save yourself.  No user-serviceable parts.
74 .    \" fudge factors for nroff and troff
75 .if n \{\
76 .    ds #H 0
77 .    ds #V .8m
78 .    ds #F .3m
79 .    ds #[ \f1
80 .    ds #] \fP
81 .\}
82 .if t \{\
83 .    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
84 .    ds #V .6m
85 .    ds #F 0
86 .    ds #[ \&
87 .    ds #] \&
88 .\}
89 .    \" simple accents for nroff and troff
90 .if n \{\
91 .    ds ' \&
92 .    ds ` \&
93 .    ds ^ \&
94 .    ds , \&
95 .    ds ~ ~
96 .    ds /
97 .\}
98 .if t \{\
99 .    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
100 .    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
101 .    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
102 .    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
103 .    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
104 .    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
105 .\}
106 .    \" troff and (daisy-wheel) nroff accents
107 .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
108 .ds 8 \h'\*(#H'\(*b\h'-\*(#H'
109 .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
110 .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
111 .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
112 .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
113 .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
114 .ds ae a\h'-(\w'a'u*4/10)'e
115 .ds Ae A\h'-(\w'A'u*4/10)'E
116 .    \" corrections for vroff
117 .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
118 .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
119 .    \" for low resolution devices (crt and lpr)
120 .if \n(.H>23 .if \n(.V>19 \
121 \{\
122 .    ds : e
123 .    ds 8 ss
124 .    ds o a
125 .    ds d- d\h'-1'\(ga
126 .    ds D- D\h'-1'\(hy
127 .    ds th \o'bp'
128 .    ds Th \o'LP'
129 .    ds ae ae
130 .    ds Ae AE
131 .\}
132 .rm #[ #] #H #V #F C
133 .\" ========================================================================
134 .\"
135 .IX Title "COLLECTD-JAVA 5"
136 .TH COLLECTD-JAVA 5 "2015-03-10" "5.4.1.805.g42e4d6c" "collectd"
137 .\" For nroff, turn off justification.  Always turn off hyphenation; it makes
138 .\" way too many mistakes in technical documents.
139 .if n .ad l
140 .nh
141 .SH "NAME"
142 collectd\-java \- Documentation of collectd's "java plugin"
143 .SH "SYNOPSIS"
144 .IX Header "SYNOPSIS"
145 .Vb 4
146 \& LoadPlugin "java"
147 \& <Plugin "java">
148 \&   JVMArg "\-verbose:jni"
149 \&   JVMArg "\-Djava.class.path=/opt/collectd/lib/collectd/bindings/java"
150 \&   
151 \&   LoadPlugin "org.collectd.java.Foobar"
152 \&   <Plugin "org.collectd.java.Foobar">
153 \&     # To be parsed by the plugin
154 \&   </Plugin>
155 \& </Plugin>
156 .Ve
157 .SH "DESCRIPTION"
158 .IX Header "DESCRIPTION"
159 The \fIJava\fR plugin embeds a \fIJava Virtual Machine\fR (\s-1JVM\s0) into \fIcollectd\fR and
160 provides a Java interface to part of collectd's \s-1API.\s0 This makes it possible to
161 write additions to the daemon in Java.
162 .PP
163 This plugin is similar in nature to, but shares no code with, the \fIPerl\fR
164 plugin by Sebastian Harl, see \fIcollectd\-perl\fR\|(5) for details.
165 .SH "CONFIGURATION"
166 .IX Header "CONFIGURATION"
167 A short outline of this plugin's configuration can be seen in \*(L"\s-1SYNOPSIS\*(R"\s0
168 above. For a complete list of all configuration options and their semantics
169 please read "Plugin \f(CW\*(C`java\*(C'\fR" in \fIcollectd.conf\fR\|(5).
170 .SH "OVERVIEW"
171 .IX Header "OVERVIEW"
172 When writing additions for collectd in Java, the underlying C base is mostly
173 hidden from you. All complex data types are converted to their Java counterparts
174 before they're passed to your functions. These Java classes reside in the
175 \&\fIorg.collectd.api\fR namespace.
176 .PP
177 The \fIJava\fR plugin will create one object of each class configured with the
178 \&\fBLoadPlugin\fR option. The constructor of this class can then register \*(L"callback
179 methods\*(R", i.\ e. methods that will be called by the daemon when
180 appropriate.
181 .PP
182 The available classes are:
183 .IP "\fBorg.collectd.api.Collectd\fR" 4
184 .IX Item "org.collectd.api.Collectd"
185 All \s-1API\s0 functions exported to Java are implemented as static functions of this
186 class. See \*(L"\s-1EXPORTED API FUNCTIONS\*(R"\s0 below.
187 .IP "\fBorg.collectd.api.OConfigValue\fR" 4
188 .IX Item "org.collectd.api.OConfigValue"
189 Corresponds to \f(CW\*(C`oconfig_value_t\*(C'\fR, defined in \fIsrc/liboconfig/oconfig.h\fR.
190 .IP "\fBorg.collectd.api.OConfigItem\fR" 4
191 .IX Item "org.collectd.api.OConfigItem"
192 Corresponds to \f(CW\*(C`oconfig_item_t\*(C'\fR, defined in \fIsrc/liboconfig/oconfig.h\fR.
193 .IP "\fBorg.collectd.api.DataSource\fR" 4
194 .IX Item "org.collectd.api.DataSource"
195 Corresponds to \f(CW\*(C`data_source_t\*(C'\fR, defined in \fIsrc/plugin.h\fR.
196 .IP "\fBorg.collectd.api.DataSet\fR" 4
197 .IX Item "org.collectd.api.DataSet"
198 Corresponds to \f(CW\*(C`data_set_t\*(C'\fR, defined in \fIsrc/plugin.h\fR.
199 .IP "\fBorg.collectd.api.ValueList\fR" 4
200 .IX Item "org.collectd.api.ValueList"
201 Corresponds to \f(CW\*(C`value_list_t\*(C'\fR, defined in \fIsrc/plugin.h\fR.
202 .IP "\fBorg.collectd.api.Notification\fR" 4
203 .IX Item "org.collectd.api.Notification"
204 Corresponds to \f(CW\*(C`notification_t\*(C'\fR, defined in \fIsrc/plugin.h\fR.
205 .PP
206 In the remainder of this document, we'll use the short form of these names, for
207 example \fBValueList\fR. In order to be able to use these abbreviated names, you
208 need to \fBimport\fR the classes.
209 .SH "EXPORTED API FUNCTIONS"
210 .IX Header "EXPORTED API FUNCTIONS"
211 All collectd \s-1API\s0 functions that are available to Java plugins are implemented
212 as \fIpublic\ static\fR functions of the \fBCollectd\fR class. This makes
213 calling these functions pretty straight forward. For example, to send an error
214 message to the daemon, you'd do something like this:
215 .PP
216 .Vb 1
217 \&  Collectd.logError ("That wasn\*(Aqt chicken!");
218 .Ve
219 .PP
220 The following are the currently exported functions.
221 .SS "registerConfig"
222 .IX Subsection "registerConfig"
223 Signature: \fIint\fR \fBregisterConfig\fR (\fIString\fR name,
224 \&\fICollectdConfigInterface\fR object);
225 .PP
226 Registers the \fBconfig\fR function of \fIobject\fR with the daemon.
227 .PP
228 Returns zero upon success and non-zero when an error occurred.
229 .PP
230 See \*(L"config callback\*(R" below.
231 .SS "registerInit"
232 .IX Subsection "registerInit"
233 Signature: \fIint\fR \fBregisterInit\fR (\fIString\fR name,
234 \&\fICollectdInitInterface\fR object);
235 .PP
236 Registers the \fBinit\fR function of \fIobject\fR with the daemon.
237 .PP
238 Returns zero upon success and non-zero when an error occurred.
239 .PP
240 See \*(L"init callback\*(R" below.
241 .SS "registerRead"
242 .IX Subsection "registerRead"
243 Signature: \fIint\fR \fBregisterRead\fR (\fIString\fR name,
244 \&\fICollectdReadInterface\fR object)
245 .PP
246 Registers the \fBread\fR function of \fIobject\fR with the daemon.
247 .PP
248 Returns zero upon success and non-zero when an error occurred.
249 .PP
250 See \*(L"read callback\*(R" below.
251 .SS "registerWrite"
252 .IX Subsection "registerWrite"
253 Signature: \fIint\fR \fBregisterWrite\fR (\fIString\fR name,
254 \&\fICollectdWriteInterface\fR object)
255 .PP
256 Registers the \fBwrite\fR function of \fIobject\fR with the daemon.
257 .PP
258 Returns zero upon success and non-zero when an error occurred.
259 .PP
260 See \*(L"write callback\*(R" below.
261 .SS "registerFlush"
262 .IX Subsection "registerFlush"
263 Signature: \fIint\fR \fBregisterFlush\fR (\fIString\fR name,
264 \&\fICollectdFlushInterface\fR object)
265 .PP
266 Registers the \fBflush\fR function of \fIobject\fR with the daemon.
267 .PP
268 Returns zero upon success and non-zero when an error occurred.
269 .PP
270 See \*(L"flush callback\*(R" below.
271 .SS "registerShutdown"
272 .IX Subsection "registerShutdown"
273 Signature: \fIint\fR \fBregisterShutdown\fR (\fIString\fR name,
274 \&\fICollectdShutdownInterface\fR object);
275 .PP
276 Registers the \fBshutdown\fR function of \fIobject\fR with the daemon.
277 .PP
278 Returns zero upon success and non-zero when an error occurred.
279 .PP
280 See \*(L"shutdown callback\*(R" below.
281 .SS "registerLog"
282 .IX Subsection "registerLog"
283 Signature: \fIint\fR \fBregisterLog\fR (\fIString\fR name,
284 \&\fICollectdLogInterface\fR object);
285 .PP
286 Registers the \fBlog\fR function of \fIobject\fR with the daemon.
287 .PP
288 Returns zero upon success and non-zero when an error occurred.
289 .PP
290 See \*(L"log callback\*(R" below.
291 .SS "registerNotification"
292 .IX Subsection "registerNotification"
293 Signature: \fIint\fR \fBregisterNotification\fR (\fIString\fR name,
294 \&\fICollectdNotificationInterface\fR object);
295 .PP
296 Registers the \fBnotification\fR function of \fIobject\fR with the daemon.
297 .PP
298 Returns zero upon success and non-zero when an error occurred.
299 .PP
300 See \*(L"notification callback\*(R" below.
301 .SS "registerMatch"
302 .IX Subsection "registerMatch"
303 Signature: \fIint\fR \fBregisterMatch\fR (\fIString\fR name,
304 \&\fICollectdMatchFactoryInterface\fR object);
305 .PP
306 Registers the \fBcreateMatch\fR function of \fIobject\fR with the daemon.
307 .PP
308 Returns zero upon success and non-zero when an error occurred.
309 .PP
310 See \*(L"match callback\*(R" below.
311 .SS "registerTarget"
312 .IX Subsection "registerTarget"
313 Signature: \fIint\fR \fBregisterTarget\fR (\fIString\fR name,
314 \&\fICollectdTargetFactoryInterface\fR object);
315 .PP
316 Registers the \fBcreateTarget\fR function of \fIobject\fR with the daemon.
317 .PP
318 Returns zero upon success and non-zero when an error occurred.
319 .PP
320 See \*(L"target callback\*(R" below.
321 .SS "dispatchValues"
322 .IX Subsection "dispatchValues"
323 Signature: \fIint\fR \fBdispatchValues\fR (\fIValueList\fR)
324 .PP
325 Passes the values represented by the \fBValueList\fR object to the
326 \&\f(CW\*(C`plugin_dispatch_values\*(C'\fR function of the daemon. The \*(L"data set\*(R" (or list of
327 \&\*(L"data sources\*(R") associated with the object are ignored, because
328 \&\f(CW\*(C`plugin_dispatch_values\*(C'\fR will automatically lookup the required data set. It
329 is therefore absolutely okay to leave this blank.
330 .PP
331 Returns zero upon success or non-zero upon failure.
332 .SS "getDS"
333 .IX Subsection "getDS"
334 Signature: \fIDataSet\fR \fBgetDS\fR (\fIString\fR)
335 .PP
336 Returns the appropriate \fItype\fR or \fBnull\fR if the type is not defined.
337 .SS "logError"
338 .IX Subsection "logError"
339 Signature: \fIvoid\fR \fBlogError\fR (\fIString\fR)
340 .PP
341 Sends a log message with severity \fB\s-1ERROR\s0\fR to the daemon.
342 .SS "logWarning"
343 .IX Subsection "logWarning"
344 Signature: \fIvoid\fR \fBlogWarning\fR (\fIString\fR)
345 .PP
346 Sends a log message with severity \fB\s-1WARNING\s0\fR to the daemon.
347 .SS "logNotice"
348 .IX Subsection "logNotice"
349 Signature: \fIvoid\fR \fBlogNotice\fR (\fIString\fR)
350 .PP
351 Sends a log message with severity \fB\s-1NOTICE\s0\fR to the daemon.
352 .SS "logInfo"
353 .IX Subsection "logInfo"
354 Signature: \fIvoid\fR \fBlogInfo\fR (\fIString\fR)
355 .PP
356 Sends a log message with severity \fB\s-1INFO\s0\fR to the daemon.
357 .SS "logDebug"
358 .IX Subsection "logDebug"
359 Signature: \fIvoid\fR \fBlogDebug\fR (\fIString\fR)
360 .PP
361 Sends a log message with severity \fB\s-1DEBUG\s0\fR to the daemon.
362 .SH "REGISTERING CALLBACKS"
363 .IX Header "REGISTERING CALLBACKS"
364 When starting up, collectd creates an object of each configured class. The
365 constructor of this class should then register \*(L"callbacks\*(R" with the daemon,
366 using the appropriate static functions in \fBCollectd\fR,
367 see \*(L"\s-1EXPORTED API FUNCTIONS\*(R"\s0 above. To register a callback, the object being
368 passed to one of the register functions must implement an appropriate
369 interface, which are all in the \fBorg.collectd.api\fR namespace.
370 .PP
371 A constructor may register any number of these callbacks, even none. An object
372 without callback methods is never actively called by collectd, but may still
373 call the exported \s-1API\s0 functions. One could, for example, start a new thread in
374 the constructor and dispatch (submit to the daemon) values asynchronously,
375 whenever one is available.
376 .PP
377 Each callback method is now explained in more detail:
378 .SS "config callback"
379 .IX Subsection "config callback"
380 Interface: \fBorg.collectd.api.CollectdConfigInterface\fR
381 .PP
382 Signature: \fIint\fR \fBconfig\fR (\fIOConfigItem\fR ci)
383 .PP
384 This method is passed a \fBOConfigItem\fR object, if both, method and
385 configuration, are available. \fBOConfigItem\fR is the root of a tree representing
386 the configuration for this plugin. The root itself is the representation of the
387 \&\fB<Plugin\ />\fR block, so in next to all cases the children of the
388 root are the first interesting objects.
389 .PP
390 To signal success, this method has to return zero. Anything else will be
391 considered an error condition and the plugin will be disabled entirely.
392 .PP
393 See \*(L"registerConfig\*(R" above.
394 .SS "init callback"
395 .IX Subsection "init callback"
396 Interface: \fBorg.collectd.api.CollectdInitInterface\fR
397 .PP
398 Signature: \fIint\fR \fBinit\fR ()
399 .PP
400 This method is called after the configuration has been handled. It is
401 supposed to set up the plugin. e.\ g. start threads, open connections, or
402 check if can do anything useful at all.
403 .PP
404 To signal success, this method has to return zero. Anything else will be
405 considered an error condition and the plugin will be disabled entirely.
406 .PP
407 See \*(L"registerInit\*(R" above.
408 .SS "read callback"
409 .IX Subsection "read callback"
410 Interface: \fBorg.collectd.api.CollectdReadInterface\fR
411 .PP
412 Signature: \fIint\fR \fBread\fR ()
413 .PP
414 This method is called periodically and is supposed to gather statistics in
415 whatever fashion. These statistics are represented as a \fBValueList\fR object and
416 sent to the daemon using dispatchValues.
417 .PP
418 To signal success, this method has to return zero. Anything else will be
419 considered an error condition and cause an appropriate message to be logged.
420 Currently, returning non-zero does not have any other effects. In particular,
421 Java \*(L"read\*(R"\-methods are not suspended for increasing intervals like C
422 \&\*(L"read\*(R"\-functions.
423 .PP
424 See \*(L"registerRead\*(R" above.
425 .SS "write callback"
426 .IX Subsection "write callback"
427 Interface: \fBorg.collectd.api.CollectdWriteInterface\fR
428 .PP
429 Signature: \fIint\fR \fBwrite\fR (\fIValueList\fR vl)
430 .PP
431 This method is called whenever a value is dispatched to the daemon. The
432 corresponding C \*(L"write\*(R"\-functions are passed a \f(CW\*(C`data_set_t\*(C'\fR, so they can
433 decide which values are absolute values (gauge) and which are counter values.
434 To get the corresponding \f(CW\*(C`List<DataSource>\*(C'\fR, call the \fBgetDataSource\fR
435 method of the \fBValueList\fR object.
436 .PP
437 To signal success, this method has to return zero. Anything else will be
438 considered an error condition and cause an appropriate message to be logged.
439 .PP
440 See \*(L"registerWrite\*(R" above.
441 .SS "flush callback"
442 .IX Subsection "flush callback"
443 Interface: \fBorg.collectd.api.CollectdFlushInterface\fR
444 .PP
445 Signature: \fIint\fR \fBflush\fR (\fIint\fR timeout, \fIString\fR identifier)
446 .PP
447 This method is called when the daemon received a flush command. This can either
448 be done using the \f(CW\*(C`USR1\*(C'\fR signal (see \fIcollectd\fR\|(1)) or using the \fIunixsock\fR
449 plugin (see \fIcollectd\-unixsock\fR\|(5)).
450 .PP
451 If \fItimeout\fR is greater than zero, only values older than this number of
452 seconds should be flushed. To signal that all values should be flushed
453 regardless of age, this argument is set to a negative number.
454 .PP
455 The \fIidentifier\fR specifies which value should be flushed. If it is not
456 possible to flush one specific value, flush all values. To signal that all
457 values should be flushed, this argument is set to \fInull\fR.
458 .PP
459 To signal success, this method has to return zero. Anything else will be
460 considered an error condition and cause an appropriate message to be logged.
461 .PP
462 See \*(L"registerFlush\*(R" above.
463 .SS "shutdown callback"
464 .IX Subsection "shutdown callback"
465 Interface: \fBorg.collectd.api.CollectdShutdownInterface\fR
466 .PP
467 Signature: \fIint\fR \fBshutdown\fR ()
468 .PP
469 This method is called when the daemon is shutting down. You should not rely on
470 the destructor to clean up behind the object but use this function instead.
471 .PP
472 To signal success, this method has to return zero. Anything else will be
473 considered an error condition and cause an appropriate message to be logged.
474 .PP
475 See \*(L"registerShutdown\*(R" above.
476 .SS "log callback"
477 .IX Subsection "log callback"
478 Interface: \fBorg.collectd.api.CollectdLogInterface\fR
479 .PP
480 Signature: \fIvoid\fR \fBlog\fR (\fIint\fR severity, \fIString\fR message)
481 .PP
482 This callback can be used to receive log messages from the daemon.
483 .PP
484 The argument \fIseverity\fR is one of:
485 .IP "\(bu" 4
486 org.collectd.api.Collectd.LOG_ERR
487 .IP "\(bu" 4
488 org.collectd.api.Collectd.LOG_WARNING
489 .IP "\(bu" 4
490 org.collectd.api.Collectd.LOG_NOTICE
491 .IP "\(bu" 4
492 org.collectd.api.Collectd.LOG_INFO
493 .IP "\(bu" 4
494 org.collectd.api.Collectd.LOG_DEBUG
495 .PP
496 The function does not return any value.
497 .PP
498 See \*(L"registerLog\*(R" above.
499 .SS "notification callback"
500 .IX Subsection "notification callback"
501 Interface: \fBorg.collectd.api.CollectdNotificationInterface\fR
502 .PP
503 Signature: \fIint\fR \fBnotification\fR (\fINotification\fR n)
504 .PP
505 This callback can be used to receive notifications from the daemon.
506 .PP
507 To signal success, this method has to return zero. Anything else will be
508 considered an error condition and cause an appropriate message to be logged.
509 .PP
510 See \*(L"registerNotification\*(R" above.
511 .SS "match callback"
512 .IX Subsection "match callback"
513 The match (and target, see \*(L"target callback\*(R" below) callbacks work a bit
514 different from the other callbacks above: You don't register a match callback
515 with the daemon directly, but you register a function which, when called,
516 creates an appropriate object. The object creating the \*(L"match\*(R" objects is
517 called \*(L"match factory\*(R".
518 .PP
519 See \*(L"registerMatch\*(R" above.
520 .PP
521 \fIFactory object\fR
522 .IX Subsection "Factory object"
523 .PP
524 Interface: \fBorg.collectd.api.CollectdMatchFactoryInterface\fR
525 .PP
526 Signature: \fICollectdMatchInterface\fR \fBcreateMatch\fR
527 (\fIOConfigItem\fR ci);
528 .PP
529 Called by the daemon to create \*(L"match\*(R" objects.
530 .PP
531 Returns: A new object which implements the \fBCollectdMatchInterface\fR interface.
532 .PP
533 \fIMatch object\fR
534 .IX Subsection "Match object"
535 .PP
536 Interface: \fBorg.collectd.api.CollectdMatchInterface\fR
537 .PP
538 Signature: \fIint\fR \fBmatch\fR (\fIDataSet\fR ds, \fIValueList\fR vl);
539 .PP
540 Called when processing a chain to determine whether or not a \fIValueList\fR
541 matches. How values are matches is up to the implementing class.
542 .PP
543 Has to return one of:
544 .IP "\(bu" 4
545 \&\fBCollectd.FC_MATCH_NO_MATCH\fR
546 .IP "\(bu" 4
547 \&\fBCollectd.FC_MATCH_MATCHES\fR
548 .SS "target callback"
549 .IX Subsection "target callback"
550 The target (and match, see \*(L"match callback\*(R" above) callbacks work a bit
551 different from the other callbacks above: You don't register a target callback
552 with the daemon directly, but you register a function which, when called,
553 creates an appropriate object. The object creating the \*(L"target\*(R" objects is
554 called \*(L"target factory\*(R".
555 .PP
556 See \*(L"registerTarget\*(R" above.
557 .PP
558 \fIFactory object\fR
559 .IX Subsection "Factory object"
560 .PP
561 Interface: \fBorg.collectd.api.CollectdTargetFactoryInterface\fR
562 .PP
563 Signature: \fICollectdTargetInterface\fR \fBcreateTarget\fR
564 (\fIOConfigItem\fR ci);
565 .PP
566 Called by the daemon to create \*(L"target\*(R" objects.
567 .PP
568 Returns: A new object which implements the \fBCollectdTargetInterface\fR
569 interface.
570 .PP
571 \fITarget object\fR
572 .IX Subsection "Target object"
573 .PP
574 Interface: \fBorg.collectd.api.CollectdTargetInterface\fR
575 .PP
576 Signature: \fIint\fR \fBinvoke\fR (\fIDataSet\fR ds, \fIValueList\fR vl);
577 .PP
578 Called when processing a chain to perform some action. The action performed is
579 up to the implementing class.
580 .PP
581 Has to return one of:
582 .IP "\(bu" 4
583 \&\fBCollectd.FC_TARGET_CONTINUE\fR
584 .IP "\(bu" 4
585 \&\fBCollectd.FC_TARGET_STOP\fR
586 .IP "\(bu" 4
587 \&\fBCollectd.FC_TARGET_RETURN\fR
588 .SH "EXAMPLE"
589 .IX Header "EXAMPLE"
590 This short example demonstrates how to register a read callback with the
591 daemon:
592 .PP
593 .Vb 2
594 \&  import org.collectd.api.Collectd;
595 \&  import org.collectd.api.ValueList;
596 \&  
597 \&  import org.collectd.api.CollectdReadInterface;
598 \&  
599 \&  public class Foobar implements CollectdReadInterface
600 \&  {
601 \&    public Foobar ()
602 \&    {
603 \&      Collectd.registerRead ("Foobar", this);
604 \&    }
605 \&    
606 \&    public int read ()
607 \&    {
608 \&      ValueList vl;
609 \&      
610 \&      /* Do something... */
611 \&      
612 \&      Collectd.dispatchValues (vl);
613 \&    }
614 \&  }
615 .Ve
616 .SH "PLUGINS"
617 .IX Header "PLUGINS"
618 The following plugins are implemented in \fIJava\fR. Both, the \fBLoadPlugin\fR
619 option and the \fBPlugin\fR block must be inside the
620 \&\fB<Plugin\ java>\fR block (see above).
621 .SS "GenericJMX plugin"
622 .IX Subsection "GenericJMX plugin"
623 The GenericJMX plugin reads \fIManaged Beans\fR (MBeans) from an \fIMBeanServer\fR
624 using \s-1JMX. JMX\s0 is a generic framework to provide and query various management
625 information. The interface is used by Java processes to provide internal
626 statistics as well as by the \fIJava Virtual Machine\fR (\s-1JVM\s0) to provide
627 information about the memory used, threads and so on.
628 .PP
629 The configuration of the \fIGenericJMX plugin\fR consists of two blocks: \fIMBean\fR
630 blocks that define a mapping of MBean attributes to the XtypesX used by
631 \&\fIcollectd\fR, and \fIConnection\fR blocks which define the parameters needed to
632 connect to an \fIMBeanServer\fR and what data to collect. The configuration of the
633 \&\fI\s-1SNMP\s0 plugin\fR is similar in nature, in case you know it.
634 .PP
635 \fIMBean blocks\fR
636 .IX Subsection "MBean blocks"
637 .PP
638 \&\fIMBean\fR blocks specify what data is retrieved from \fIMBeans\fR and how that data
639 is mapped on the \fIcollectd\fR data types. The block requires one string
640 argument, a name. This name is used in the \fIConnection\fR blocks (see below) to
641 refer to a specific \fIMBean\fR block. Therefore, the names must be unique.
642 .PP
643 The following options are recognized within \fIMBean\fR blocks:
644 .IP "\fBObjectName\fR \fIpattern\fR" 4
645 .IX Item "ObjectName pattern"
646 Sets the pattern which is used to retrieve \fIMBeans\fR from the \fIMBeanServer\fR.
647 If more than one MBean is returned you should use the \fBInstanceFrom\fR option
648 (see below) to make the identifiers unique.
649 .Sp
650 See also:
651 <http://java.sun.com/javase/6/docs/api/javax/management/ObjectName.html>
652 .IP "\fBInstancePrefix\fR \fIprefix\fR" 4
653 .IX Item "InstancePrefix prefix"
654 Prefixes the generated \fIplugin instance\fR with \fIprefix\fR. \fI(optional)\fR
655 .IP "\fBInstanceFrom\fR \fIproperty\fR" 4
656 .IX Item "InstanceFrom property"
657 The \fIobject names\fR used by \s-1JMX\s0 to identify \fIMBeans\fR include so called
658 \&\fIXpropertiesX\fR which are basically key-value-pairs. If the given object name
659 is not unique and multiple MBeans are returned, the values of those properties
660 usually differ. You can use this option to build the \fIplugin instance\fR from
661 the appropriate property values. This option is optional and may be repeated to
662 generate the \fIplugin instance\fR from multiple property values.
663 .IP "\fB<value />\fR blocks" 4
664 .IX Item "<value /> blocks"
665 The \fIvalue\fR blocks map one or more attributes of an \fIMBean\fR to a value list
666 in \fIcollectd\fR. There must be at least one Value block within each \fIMBean\fR
667 block.
668 .RS 4
669 .IP "\fBType\fR type" 4
670 .IX Item "Type type"
671 Sets the data set used within \fIcollectd\fR to handle the values of the \fIMBean\fR
672 attribute.
673 .IP "\fBInstancePrefix\fR \fIprefix\fR" 4
674 .IX Item "InstancePrefix prefix"
675 Works like the option of the same name directly beneath the \fIMBean\fR block, but
676 sets the type instance instead. \fI(optional)\fR
677 .IP "\fBInstanceFrom\fR \fIprefix\fR" 4
678 .IX Item "InstanceFrom prefix"
679 Works like the option of the same name directly beneath the \fIMBean\fR block, but
680 sets the type instance instead. \fI(optional)\fR
681 .IP "\fBTable\fR \fBtrue\fR|\fBfalse\fR" 4
682 .IX Item "Table true|false"
683 Set this to true if the returned attribute is a \fIcomposite type\fR. If set to
684 true, the keys within the \fIcomposite type\fR is appended to the
685 \&\fItype instance\fR.
686 .IP "\fBAttribute\fR \fIpath\fR" 4
687 .IX Item "Attribute path"
688 Sets the name of the attribute from which to read the value. You can access the
689 keys of composite types by using a dot to concatenate the key name to the
690 attribute name. For example: Xattrib0.key42X. If \fBTable\fR is set to \fBtrue\fR
691 \&\fIpath\fR must point to a \fIcomposite type\fR, otherwise it must point to a numeric
692 type.
693 .RE
694 .RS 4
695 .RE
696 .PP
697 \fIConnection blocks\fR
698 .IX Subsection "Connection blocks"
699 .PP
700 Connection blocks specify \fIhow\fR to connect to an \fIMBeanServer\fR and what data
701 to retrieve. The following configuration options are available:
702 .IP "\fBHost\fR \fIname\fR" 4
703 .IX Item "Host name"
704 Host name used when dispatching the values to \fIcollectd\fR. The option sets this
705 field only, it is \fInot\fR used to connect to anything and doesn't need to be a
706 real, resolvable name.
707 .IP "\fBServiceURL\fR \fI\s-1URL\s0\fR" 4
708 .IX Item "ServiceURL URL"
709 Specifies how the \fIMBeanServer\fR can be reached. Any string accepted by the
710 \&\fIJMXServiceURL\fR is valid.
711 .Sp
712 See also:
713 <http://java.sun.com/javase/6/docs/api/javax/management/remote/JMXServiceURL.html>
714 .IP "\fBUser\fR \fIname\fR" 4
715 .IX Item "User name"
716 Use \fIname\fR to authenticate to the server. If not configured, XmonitorRoleX
717 will be used.
718 .IP "\fBPassword\fR \fIpassword\fR" 4
719 .IX Item "Password password"
720 Use \fIpassword\fR to authenticate to the server. If not given, unauthenticated
721 access is used.
722 .IP "\fBInstancePrefix\fR \fIprefix\fR" 4
723 .IX Item "InstancePrefix prefix"
724 Prefixes the generated \fIplugin instance\fR with \fIprefix\fR. If a second
725 \&\fIInstancePrefix\fR is specified in a referenced \fIMBean\fR block, the prefix
726 specified in the \fIConnection\fR block will appear at the beginning of the
727 \&\fIplugin instance\fR, the prefix specified in the \fIMBean\fR block will be appended
728 to it.
729 .IP "\fBCollect\fR \fImbean_block_name\fR" 4
730 .IX Item "Collect mbean_block_name"
731 Configures which of the \fIMBean\fR blocks to use with this connection. May be
732 repeated to collect multiple \fIMBeans\fR from this server.
733 .SH "SEE ALSO"
734 .IX Header "SEE ALSO"
735 \&\fIcollectd\fR\|(1),
736 \&\fIcollectd.conf\fR\|(5),
737 \&\fIcollectd\-perl\fR\|(5),
738 \&\fItypes.db\fR\|(5)
739 .SH "AUTHOR"
740 .IX Header "AUTHOR"
741 Florian Forster <octo\ at\ collectd.org>