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

Add Jolokia proxy mode #473

Closed
panda87 opened this issue Jan 1, 2016 · 11 comments
Closed

Add Jolokia proxy mode #473

panda87 opened this issue Jan 1, 2016 · 11 comments

Comments

@panda87
Copy link

panda87 commented Jan 1, 2016

Hi

The Jolokia plugin that @saiello wrote is very good, but for some cases is not help like the following,
Jolokia has 2 options agent and proxy modes. The current plugin is build for the agent mode, but for cases that I don't want to setup the agent as a dependency in my project or in case I have container that I dont want to add another articats inside, Jolokia is support the proxy mode.

For implementation design the only different is the proxy acting as POST request with body, like the example from the Jolokia documentation:

  {
    "type" : "read",
    "mbean" : "java.lang:type=Memory",
    "attribute" : "HeapMemoryUsage",
    "target" : { 
         "url" : "service:jmx:rmi:///jndi/rmi://targethost:9999/jmxrmi",
         "user" : "jolokia",
         "password" : "s!cr!t"
    } 
  }

@saiello can you pls try to add this to the current plugin or maybe someone else?

Thanks

@saiello
Copy link
Contributor

saiello commented Jan 4, 2016

Hi
@panda87 's suggestion is right!

The plugin configuration could be something like

[jolokia]
mode = "proxy"  // default is 'agent'

// used only in proxy mode
[jolokia.proxy]
host = "jolokia.proxy.my-domain.org"
port = "8000"

[[jolokia.servers]]
  name = "as-service-1"
  host = "127.0.0.1"
  port = "8080"
// used only in proxy mode
  user = "jolokia"
  password = "s!cr!t"

[[jolokia.metrics]]
  name = "heap_memory_usage"
  mbean = "java.lang:type=Memory",
  attribute = "HeapMemoryUsage",
  pass = ["used", "max"]

I'll provide an implementation on my fork as soon as possible. @panda87, I'll notify you when ready.

@panda87
Copy link
Author

panda87 commented Jan 4, 2016

Thanks @saiello this feature is super important for me and I believe for others that wan to use this plugin in their systems!
Thanks for the effort!

@saiello
Copy link
Contributor

saiello commented Jan 4, 2016

Hi,
I just completed a simple naive implementation of what we expect branching the 0.2.4 of this repo.

You could find the source code at: https://github.com/saiello/telegraf/tree/feature/jolokia-as-proxy-mode even though I need to improve and write some test as well.

@panda87 If you have some more suggestions or you figure out some issues...

@panda87
Copy link
Author

panda87 commented Jan 4, 2016

Thanks @saiello, I'll do my best to try the new feature in day or two and keep you updated with my findings.

@sparrc
Copy link
Contributor

sparrc commented Jan 5, 2016

@saiello please hold off on sending up a PR, I am trying to finish 0.3.0 (see #437), and will need the changes to be rebased off of 0.3.0 anyways

@panda87
Copy link
Author

panda87 commented Jan 6, 2016

I made tests to the plugin and it looks very good.
I have only one issue that I want to check if this Jolokia or plugin issue.
The problem is when my mbean look like this:

  [[plugins.jolokia.metrics]]
    name = "LogEndOffset"
    mbean  = "kafka.log:type=Log,name=LogEndOffset,*"
    attribute = "Value"

The result is one big serializing json that instead of split it to many tags, im getting one long tag like this example: kafka.log:name=LogEndOffset,partition=0,topic=Production,type=Log and the value look like this: map[Value:2]

Do you think that you can make a change here or this related to the jolokia agent?

Thanks

@saiello
Copy link
Contributor

saiello commented Jan 8, 2016

@sparrc don't worry.

@panda87 It is because the * at end of your mbean attribute.

According to the jolokia docs:

A request to a MBean pattern returns as value a JSON object,
with the MBean names as keys and as value another JSON object
with the attribute name as keys and the attribute values as values.

Try with:

[[plugins.jolokia.metrics]]
    name = "LogEndOffset"
    mbean  = "kafka.log:name=LogEndOffset,partition=0,topic=Production,type=Log"
    attribute = "Value"

@sparrc
Copy link
Contributor

sparrc commented Jan 21, 2016

@saiello 0.10.0 (prev 0.3.0) has been merged to master, so feel free to forge ahead

@darsh221
Copy link

I want to use Jolokia proxy mode but i think latest release http://get.influxdb.org/telegraf/telegraf_0.12.0-1_amd64.deb doesn't have these changes. Which branch i should to build telegraf so that i can get all latest changes up to 0.12.0 along with Jolokia proxy mode?

@sparrc
Copy link
Contributor

sparrc commented Apr 14, 2016

@darsh221 there are no changes, that's why this is an open issue

@saiello
Copy link
Contributor

saiello commented Apr 14, 2016

Hi @sparrc @darsh221 I sent a PR #1031 for this right now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants