Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JMX collector #364

Closed
panda87 opened this issue May 3, 2016 · 44 comments
Closed

JMX collector #364

panda87 opened this issue May 3, 2016 · 44 comments
Labels
area/collectors Everything related to data collection feature request New features help wanted

Comments

@panda87
Copy link

panda87 commented May 3, 2016

JVM based application are widely used so be able to monitor their stats can be very useful

@ktsaou
Copy link
Member

ktsaou commented May 3, 2016

If someone can provide the basics (i.e. connect to JVM, get the metrics of interest, etc), I can turn it into a netdata plugin. It can be written in any language (java included).

@jasonwbarnett
Copy link
Contributor

A cheap thing might be to just copy the overall design that scout app uses and just port it to netdata.

@ktsaou
Copy link
Member

ktsaou commented Jun 22, 2016

@paulfantom this seems python too...

@paulfantom
Copy link
Contributor

@ktsaou already added to my list. Right after HAProxy and ElasticSearch.

@ktsaou
Copy link
Member

ktsaou commented Jun 22, 2016

perfect! Please add redis too..

@paulfantom
Copy link
Contributor

Ok, added.

@paulfantom
Copy link
Contributor

Back to this.

Basically: JMX + python = No-go
But there is a solution to this (adopted for example by telegraf ). It is called jolokia and it provides JMX-HTTP bridge and is agent based.

Also I don't think this module can have autodetection, it will need to be configured by user.

I need to know if I can start working on jolokia module or maybe someone have better approach?

@ktsaou
Copy link
Member

ktsaou commented Aug 2, 2016

So JMX can be directly accessed by what? java?

@paulfantom
Copy link
Contributor

There is something that is called jpype which should act as a python-java bridge. But I cannot get it working.

JMX is written in such way that it is very easy to be accessed by java, but it is almost impossible to be accessed by anything else. At least that is what I found.

@wojciechszela
Copy link

I second Jolokia. We have our own in-house metrics collector made in Scala (JVM), developed before telegraf was a thing, and we do use Jolokia instead of JMX. It's very easy to add Jolokia to any JVM based project (it's a JAR drop-in) and extra benefit is that it open tons of options in terms of metrics collections, monitoring, alerting... I doubt any JVM admin would object in using Jolokia.

@jasonwbarnett
Copy link
Contributor

jasonwbarnett commented Aug 2, 2016

never seen or heard of Jolokia, but conceptually on board with this sort of thing. Seems like a great option.

Of course there are always alternatives that can be entertained down the road.

@toddiuszho
Copy link

If the Jolokia agents have discovery enabled, we can have auto-discovery.

@sanketplus
Copy link

Found something much simpler compared to Jolokia. JMXProxy

Just get the jar running anywhere and query it with host and JMX port for said Java process and get JSON full of metrics.

@johntdyer
Copy link

Big fan of Jolokia !

@simonnagl
Copy link

simonnagl commented Feb 22, 2017

I took a look at this too...

Yes, it would be possible to use Jolokia / JMXProxy. But I do not see the need adding an layer. When using such a program the data flow would be
Java Application -> Jolokia -> Netdata Plugin -> netdata

It is possible to write an custom JMX client which connects to a JVM and works as a netdata plugin.
Java Application -> Netdata JMX Client (plugin) -> netdata.

This may be faster but requires adding a java plugin to netdata.

Edit

A tutorial how to create a client (http://docs.oracle.com/javase/tutorial/jmx/remote/custom.html)

@hereTac
Copy link

hereTac commented Mar 16, 2017

hope anybody's work about monitor jvm on netdata.

@ktsaou
Copy link
Member

ktsaou commented Mar 16, 2017

I am not (sorry). If anyone is working on this, please let us know of your progress.

I would also love to have this plugin. Keep in mind it can be written in any language (including java). We just need someone willing to spend some time to model the basics. If we have the basic structure, I think a lot of people will step in (including me).

@simonnagl
Copy link

I am currently working on a Netdata Java Plugin Daemon and I added an initial JMX Plugin.
There are many things to do...

https://github.com/simonnagl/netdata-plugin-java-daemon

@ktsaou
Copy link
Member

ktsaou commented Jul 10, 2017

@simonnagl wow!
Is it working? If you manage to make it publish at least one chart, more people (including me) could step in and start adding things.
Since it is a deamon, how does it connect to netdata?

@simonnagl
Copy link

simonnagl commented Jul 10, 2017

Yes, this is working. It publishes one chart to netdata, monitoring the loaded java classes of the deamon itself. More configuration can be added to collect other Simple Managed Beans getters which return Long or Integer.
The daemon is a Netdata External Plugin which can be started by netdata and which sends metrics to STDOUT and log messages to STDERR.

@archenroot
Copy link

I will give it a try as I am installing today NetData

@simonnagl
Copy link

Great, if you need help or somethings not working just ask. Remember I not yet released 1.0.0 so it can be considered beta.

@waykar-prashant
Copy link

I configured the netdata app to use the java jmx plugin. Not sure how it is supposed to behave and how do i see the charts?
Please suggest

@simonnagl
Copy link

Have you done those steps?

git clone https://github.com/simonnagl/netdata-plugin-java-daemon.git
cd netdata-plugin-java-daemon
mvn package
cp src/main/sh/java.d.plugin /your/netdata/plugin/dir # Most likely /usr/libexec/netdata/plugins.d/
cp -r config/* /your/netdata/config/dir # Most likely /etc/netdata
cp target/java-daemon-0.1.0-SNAPSHOT.jar /tmp

After a restart of netdata you should as least see the metrics of the plugin itself. (Section jmx)
To collect other java processes you need to edit imx.conf. This is not very well tested.

As more users are interested in trying this plugin I will write a proper installer which works like ./netdata-installer.sh. One command that sets up everything. I'll post here when it is done.

@waykar-prashant
Copy link

/opt/netdata/netdata-configs/java.d/java.d
/opt/netdata/netdata-configs/java.d/jmx.conf
/opt/netdata/netdata-plugins/java.d/java.d.plugin
Are these correct?

@simonnagl
Copy link

How did you install metadata? sudo ./netdata-installer.sh without any arguments?

Then the files you mentioned should go there:

/etc/netdata/jmx.conf
/etc/netdata/java.d/java.d.plugin

@simonnagl
Copy link

The project now has an auto installer. It needs to be run with the same privilege and config options as the netdata installer.

sudo ./netdata-plugin-java-daemon-installer.sh

It would be very helpful if someone could give feedback if he sees charts after running the installer.
Thank you!

@simonnagl
Copy link

@h0lzi Thank you for the feedback again. You are absolutely right. I put your two points into separated issues. (#3046 and #3047)

@mmohrwinkel
Copy link

Hi @simonnagl , I found the dead link on the page https://github.com/simonnagl/netdata-plugin-java-daemon under Configuration. There is a link "JmxPluginConfiguration" in the table under "Schema" and it 404s.

#2808 sounds very promising, I'll try it out as soon as it is ready and give you feedback!

@simonnagl
Copy link

Hi @mmohrwinkel. This link will be dead until #2808 got merged.

@paulfantom paulfantom added feature request New features and removed plugin request labels Sep 22, 2018
@paulfantom paulfantom removed their assignment Nov 18, 2018
@paulfantom paulfantom added the area/collectors Everything related to data collection label Nov 19, 2018
@cakrit cakrit added help wanted area/external and removed area/collectors Everything related to data collection labels Nov 21, 2018
@corporate-gadfly
Copy link

@simonnagl: Your solution for gathering JMX statistics spawns a side-by-side JVM which then connects with the target JVM.

What is the overhead of running an extra JVM vs. using the earlier proposed jolokia solution?

Thanks for your work, BTW.

@simonnagl
Copy link

Sorry for the late answer.
I was not able to measure it but I would say it depends.
jolokia needs an agent installed in the JVM (i.e. a application server) to do JMX for you. It can also be a proxy agent, which the is also a extra JVM.
If we assume that we monitor the "netdata way" which means only collecting local services I think using jolokia vs. a side-by-side JVM produces way the same overhead.

@cosmix
Copy link
Contributor

cosmix commented Oct 17, 2019

@ilyam8 kind reminder, please update this issue (and/or close it) when we're ready to proceed with a Golang-based module for JMX monitoring.

@simonnagl
Copy link

@cosmix ist there a plan to implement a golang-based module for JMX? Do you want to build this based on Jolokia?

@cosmix
Copy link
Contributor

cosmix commented Oct 19, 2019

@simonnagl hello, yes there is a plan to build a Golang-based collector for JMX. We are still exploring the potential solution space as to how to do it; most likely we won’t be requiring Jolokia.

@ki0
Copy link

ki0 commented Jul 2, 2020

Is this stopped? any updates?

@ilyam8
Copy link
Member

ilyam8 commented Aug 21, 2020

@ki0 no, there is no updates unfortunately.

@Thrameos
Copy link

@paulfantom I know this is belated, but what issue were you having with getting JPype running? As far as I am aware JPype should be able to talk to JMX. Though we currently can't extend a Java class it is possible to implement an interface. And simply calling Java methods should be no issue at all.

@paulfantom
Copy link
Contributor

@Thrameos sorry, I don't remember. My last take on this was over 4 years ago and I no longer use nor work on the project.

@ilyam8
Copy link
Member

ilyam8 commented Jul 8, 2021

Closing this feature request and moving it to our community forum for further discussion (link will be posted soon).

@ilyam8 ilyam8 closed this as completed Jul 8, 2021
@ilyam8 ilyam8 added area/collectors Everything related to data collection and removed area/external labels Apr 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/collectors Everything related to data collection feature request New features help wanted
Projects
No open projects
Development

Successfully merging a pull request may close this issue.