From 4231dfb2186e7aae17a3d0bc25d915da0b5f9c9c Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 24 Feb 2009 11:24:38 +0100 Subject: [PATCH] collectd.conf(5), collectd-java(5): Updated the documentation for the Java plugin. --- src/collectd-java.pod | 359 ++++++++++++++++++++++++++++---------------------- src/collectd.conf.pod | 22 +++- 2 files changed, 219 insertions(+), 162 deletions(-) diff --git a/src/collectd-java.pod b/src/collectd-java.pod index 2c621353..f441c82a 100644 --- a/src/collectd-java.pod +++ b/src/collectd-java.pod @@ -37,10 +37,20 @@ hidden from you. All complex data types are converted to their Java counterparts before they're passed to your functions. These Java classes reside in the I namespace. +The I plugin will create one object of each class configured with the +B option. The constructor of this class can then register "callback +methods", i.Ee. methods that will be called by the daemon when +appropriate. + The available classes are: =over 4 +=item B + +All API functions exported to Java are implemented as static functions of this +class. See L<"EXPORTED API FUNCTIONS"> below. + =item B Corresponds to C, defined in F. @@ -71,16 +81,181 @@ In the remainder of this document, we'll use the short form of these names, for example B. In order to be able to use these abbreviated names, you need to B the classes. -The API functions that are available from Java are implemented as I -functions of the B class. -See L<"CALLING API FUNCTIONS"> below for details. +=head1 EXPORTED API FUNCTIONS + +All collectd API functions that are available to Java plugins are implemented +as Istatic> functions of the B class. This makes +calling these functions pretty straight forward. For example, to send an error +message to the daemon, you'd do something like this: + + Collectd.logError ("That wasn't chicken!"); + +The following are the currently exported functions. + +=head2 registerConfig + +Signature: I B (I name, +I object); + +Registers the B function of I with the daemon. + +Returns zero upon success and non-zero when an error occurred. + +See L<"config callback"> below. + +=head2 registerInit + +Signature: I B (I name, +I object); + +Registers the B function of I with the daemon. + +Returns zero upon success and non-zero when an error occurred. + +See L<"init callback"> below. + +=head2 registerRead + +Signature: I B (I name, +I object) + +Registers the B function of I with the daemon. + +Returns zero upon success and non-zero when an error occurred. + +See L<"read callback"> below. + +=head2 registerWrite + +Signature: I B (I name, +I object) + +Registers the B function of I with the daemon. + +Returns zero upon success and non-zero when an error occurred. + +See L<"write callback"> below. + +=head2 registerFlush + +Signature: I B (I name, +I object) + +Registers the B function of I with the daemon. + +Returns zero upon success and non-zero when an error occurred. + +See L<"flush callback"> below. + +=head2 registerShutdown + +Signature: I B (I name, +I object); + +Registers the B function of I with the daemon. + +Returns zero upon success and non-zero when an error occurred. + +See L<"shutdown callback"> below. + +=head2 registerLog + +Signature: I B (I name, +I object); + +Registers the B function of I with the daemon. + +Returns zero upon success and non-zero when an error occurred. + +See L<"log callback"> below. + +=head2 registerNotification + +Signature: I B (I name, +I object); + +Registers the B function of I with the daemon. + +Returns zero upon success and non-zero when an error occurred. + +See L<"notification callback"> below. + +=head2 registerMatch + +Signature: I B (I name, +I object); + +Registers the B function of I with the daemon. + +Returns zero upon success and non-zero when an error occurred. + +See L<"match callback"> below. + +=head2 registerTarget + +Signature: I B (I name, +I object); + +Registers the B function of I with the daemon. + +Returns zero upon success and non-zero when an error occurred. + +See L<"target callback"> below. + +=head2 dispatchValues + +Signature: I B (I) + +Passes the values represented by the B object to the +C function of the daemon. The "data set" (or list of +"data sources") associated with the object are ignored, because +C will automatically lookup the required data set. It +is therefore absolutely okay to leave this blank. + +Returns zero upon success or non-zero upon failure. + +=head2 getDS + +Signature: I B (I) + +Returns the appropriate I or B if the type is not defined. + +=head2 logError + +Signature: I B (I) + +Sends a log message with severity B to the daemon. + +=head2 logWarning + +Signature: I B (I) + +Sends a log message with severity B to the daemon. + +=head2 logNotice + +Signature: I B (I) + +Sends a log message with severity B to the daemon. + +=head2 logInfo + +Signature: I B (I) + +Sends a log message with severity B to the daemon. + +=head2 logDebug + +Signature: I B (I) + +Sends a log message with severity B to the daemon. =head1 REGISTERING CALLBACKS When starting up, collectd creates an object of each configured class. The constructor of this class should then register "callbacks" with the daemon, using the appropriate static functions in B, -see L<"CALLING API FUNCTIONS"> below. To register a callback, the object being +see L<"EXPORTED API FUNCTIONS"> above. To register a callback, the object being passed to one of the register functions must implement an appropriate interface, which are all in the B namespace. @@ -107,6 +282,8 @@ root are the first interesting objects. To signal success, this method has to return zero. Anything else will be considered an error condition and the plugin will be disabled entirely. +See L<"registerConfig"> above. + =head2 init callback Interface: B @@ -120,6 +297,8 @@ check if can do anything useful at all. To signal success, this method has to return zero. Anything else will be considered an error condition and the plugin will be disabled entirely. +See L<"registerInit"> above. + =head2 read callback Interface: B @@ -128,8 +307,7 @@ Signature: I B () This method is called periodically and is supposed to gather statistics in whatever fashion. These statistics are represented as a B object and -sent to the daemon using B, see L<"CALLING API FUNCTIONS"> -below. +sent to the daemon using L. To signal success, this method has to return zero. Anything else will be considered an error condition and cause an appropriate message to be logged. @@ -137,6 +315,8 @@ Currently, returning non-zero does not have any other effects. In particular, Java "read"-methods are not suspended for increasing intervals like C "read"-functions. +See L<"registerRead"> above. + =head2 write callback Interface: B @@ -152,6 +332,8 @@ method of the B object. To signal success, this method has to return zero. Anything else will be considered an error condition and cause an appropriate message to be logged. +See L<"registerWrite"> above. + =head2 flush callback Interface: B @@ -173,6 +355,8 @@ values should be flushed, this argument is set to I. To signal success, this method has to return zero. Anything else will be considered an error condition and cause an appropriate message to be logged. +See L<"registerFlush"> above. + =head2 shutdown callback Interface: B @@ -185,6 +369,8 @@ the destructor to clean up behind the object but use this function instead. To signal success, this method has to return zero. Anything else will be considered an error condition and cause an appropriate message to be logged. +See L<"registerShutdown"> above. + =head2 log callback Interface: B @@ -221,6 +407,8 @@ org.collectd.api.Collectd.LOG_DEBUG The function does not return any value. +See L<"registerLog"> above. + =head2 notification callback Interface: B @@ -232,6 +420,8 @@ This callback can be used to receive notifications from the daemon. To signal success, this method has to return zero. Anything else will be considered an error condition and cause an appropriate message to be logged. +See L<"registerNotification"> above. + =head2 match callback The match (and target, see L<"target callback"> below) callbacks work a bit @@ -240,6 +430,8 @@ with the daemon directly, but you register a function which, when called, creates an appropriate object. The object creating the "match" objects is called "match factory". +See L<"registerMatch"> above. + =head3 Factory object Interface: B @@ -282,6 +474,8 @@ with the daemon directly, but you register a function which, when called, creates an appropriate object. The object creating the "target" objects is called "target factory". +See L<"registerTarget"> above. + =head3 Factory object Interface: B @@ -321,7 +515,7 @@ B =back -=head2 Example +=head1 EXAMPLE This short example demonstrates how to register a read callback with the daemon: @@ -348,157 +542,6 @@ daemon: } } -=head1 CALLING API FUNCTIONS - -All collectd API functions that are available to Java plugins are implemented -as Istatic> functions of the B class. -This makes calling these functions pretty straight forward. - -The following are the currently exported functions. For information on the -interfaces used, please see L<"REGISTERING CALLBACKS"> above. - -=head2 registerConfig - -Signature: I B (I name, -I object); - -Registers the B function of I with the daemon. - -Returns zero upon success and non-zero when an error occurred. - -=head2 registerInit - -Signature: I B (I name, -I object); - -Registers the B function of I with the daemon. - -Returns zero upon success and non-zero when an error occurred. - -=head2 registerRead - -Signature: I B (I name, -I object) - -Registers the B function of I with the daemon. - -Returns zero upon success and non-zero when an error occurred. - -=head2 registerWrite - -Signature: I B (I name, -I object) - -Registers the B function of I with the daemon. - -Returns zero upon success and non-zero when an error occurred. - -=head2 registerFlush - -Signature: I B (I name, -I object) - -Registers the B function of I with the daemon. - -Returns zero upon success and non-zero when an error occurred. - -=head2 registerShutdown - -Signature: I B (I name, -I object); - -Registers the B function of I with the daemon. - -Returns zero upon success and non-zero when an error occurred. - -=head2 registerLog - -Signature: I B (I name, -I object); - -Registers the B function of I with the daemon. - -Returns zero upon success and non-zero when an error occurred. - -=head2 registerNotification - -Signature: I B (I name, -I object); - -Registers the B function of I with the daemon. - -Returns zero upon success and non-zero when an error occurred. - -=head2 registerMatch - -Signature: I B (I name, -I object); - -Registers the B function of I with the daemon. - -Returns zero upon success and non-zero when an error occurred. - -See L<"match callback"> above. - -=head2 registerTarget - -Signature: I B (I name, -I object); - -Registers the B function of I with the daemon. - -Returns zero upon success and non-zero when an error occurred. - -See L<"target callback"> above. - -=head2 dispatchValues - -Signature: I B (I) - -Passes the values represented by the B object to the -C function of the daemon. The "data set" (or list of -"data sources") associated with the object are ignored, because -C will automatically lookup the required data set. It -is therefore absolutely okay to leave this blank. - -Returns zero upon success or non-zero upon failure. - -=head2 getDS - -Signature: I B (I) - -Returns the appropriate I or B if the type is not defined. - -=head2 logError - -Signature: I B (I) - -Sends a log message with severity B to the daemon. - -=head2 logWarning - -Signature: I B (I) - -Sends a log message with severity B to the daemon. - -=head2 logNotice - -Signature: I B (I) - -Sends a log message with severity B to the daemon. - -=head2 logInfo - -Signature: I B (I) - -Sends a log message with severity B to the daemon. - -=head2 logDebug - -Signature: I B (I) - -Sends a log message with severity B to the daemon. - =head1 SEE ALSO L, diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index e8946287..1ab43607 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -1101,7 +1101,7 @@ Synopsis: -Available config options: +Available configuration options: =over 4 @@ -1111,6 +1111,10 @@ Argument that is to be passed to the I (JVM). This works exactly the way the arguments to the I binary on the command line work. Execute C--help> for details. +Please note that B these options must appear B (i.Ee. above) +any other options! When another option is found, the JVM will be started and +later options will have to be ignored! + =item B I Instantiates a new I object. The constructor of this object very @@ -1118,10 +1122,20 @@ likely then registers one or more callback methods with the server. See L for details. -=item B I +When the first such option is found, the virtual machine (JVM) is created. This +means that all B options must appear before (i.Ee. above) all +B options! + +=item B I + +The entire block is passed to the Java plugin as an +I object. -The entrie block is passed to the Java plugin as an -I object. See L. +For this to work, the plugin has to register a configuration callback first, +see L. This means, that the B block +must appear after the appropriate B block. Also note, that I +depends on the (Java) plugin registering the callback and is completely +independent from the I argument passed to B. =back -- 2.11.0