[collectd] JVM statistics collection?

Justo Alonso justo.alonso at gmail.com
Wed Oct 15 13:31:26 CEST 2008


Hi !
   at the end ... I have a operational jmx plugin to collect jvm
statistics. Please, someone can check it ??

   I use snmp plugin to cut and paste, thanks Florian .. ;-)

How it work.
  compile:
       I added a -with-java to configure script, to add jmx support
add: --with-java=JAVA_HOME
  Configure:
      configure jvm options (classpath and options), create data list,
create instance list
  Init:
      setup JNI link to Java VM.
      Foreach instance, create a connector of class defined in
instance options and pass instance parameters to the object.
      Foreach data in instance (collect parameter), add this data to
this instance with data parameters.
      Create threads to read data
  Read (in thread):
      Foreach data in instance, call java method collect(dataname) on
instance->connector object. This return a java.lang.String array
      Foreach string, parse it and dispatch value of the data->type


TODO
- Make new data class to get stats (tomcat related, garbage collector, etc...)
- Check memory-leaks
- Add support for JMXCollectdRMIConnector for use user/password
- Add support for JMXCollectdRMIConnector for local process
- Add control error
- Revise configure to check java VM and get includes and libs

comments please !
j

On Fri, Sep 26, 2008 at 5:40 PM, Florian Forster <octo at verplant.org> wrote:
> Hi Justo,
>
> On Fri, Sep 26, 2008 at 02:20:35PM +0200, Justo Alonso wrote:
>> At this moment, I have problems to detect the java virtual machine and
>> all includes and libs in the configure.in file .... the include and
>> libs directory depends on platform and type of virtual machine
>> ($JAVA_HOME/jre/lib/i386/client/libjvm.so or
>> $JAVA_HOME/jre/lib/i386/server/libjvm.so for libs and
>> $JAVA_HOME/jre/include/jni.h and $JAVA_HOME/jre/include/linux/jni_md.h).
>> Anyone can help me ??
>
> I'll gladly help, but I have no clue about Java stuff, so you may need
> to help me there ;)
>
> If present, we use a *-config script or `pkg-config' to determine the
> location, flags and libs for a library. The `CURL' library provides
> both, for example:
> -- 8< --
>  octo at huhu:~ $ curl-config --libs
>  -L/usr/lib -lcurl -L/usr/lib -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lkrb5support -lresolv -lidn -ldl -lgnutls -lz
>  octo at huhu:~ $ pkg-config --libs libcurl
>  -lcurl -lgssapi_krb5 -lkrb5 -lk5crypto -lcom_err -lkrb5support -lresolv -lidn -ldl -lgnutls -lz
> -- >8 --
>
> The first step would be to find out if such a script or pkg-config file
> exists for the Java interface you're using. Checking for such files can
> possibly done like this:
>  $ find $JAVA_HOME -name '*-config' -or -name '*.pc'
>
> To check for the existence of the library, I'd need the name of one
> `symbol' that's exported by the library. A `symbol' is basically every
> function that's implemented in the library. Just pick *the central
> function* the library provides, that'll do..
>
> Regards,
> -octo
> --
> Florian octo Forster
> Hacker in training
> GnuPG: 0x91523C3D
> http://verplant.org/
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
>
> iD8DBQFI3QJnHdggu3Q05IYRAp6IAJ9LAHYyLGu5O66meDU5CDnSMNTWDACeLUcj
> m3XbIBAWZS87BhVRWbooS0g=
> =NaJ3
> -----END PGP SIGNATURE-----
>
>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: collectd-4.5.0-jmx.patch
Type: text/x-patch
Size: 60382 bytes
Desc: not available
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20081015/9df97c77/attachment-0001.bin 


More information about the collectd mailing list