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

[jmxfetch] add list_jvms command #2962

Merged
merged 1 commit into from
Aug 21, 2017
Merged

Conversation

yannmh
Copy link
Member

@yannmh yannmh commented Oct 26, 2016

New list_jvms command.

List available Java virtual machines on the system using the Attach
API.

See DataDog/jmxfetch#112

@yannmh yannmh added the feature label Oct 26, 2016
@yannmh yannmh added this to the 5.10.0 milestone Oct 26, 2016
@olivielpeau olivielpeau self-assigned this Oct 26, 2016
@yannmh yannmh force-pushed the yann/jmxfetch-list-jvms branch from 822da35 to 8dd6282 Compare November 1, 2016 16:00
Copy link
Member

@olivielpeau olivielpeau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@remh
Copy link
Contributor

remh commented Nov 2, 2016

Shouldn't the jmxfetch version be updated ?

@olivielpeau
Copy link
Member

Won't merge this for 5.10.0 unless there are other JMXFetch-related changes we want to ship with 5.10.0

@remh remh modified the milestones: 5.11.0, 5.10.0 Nov 3, 2016
@masci masci modified the milestones: 5.11.0, 5.12.0 Jan 24, 2017
@yannmh yannmh force-pushed the yann/jmxfetch-list-jvms branch from 8dd6282 to be642ba Compare March 10, 2017 21:47
@yannmh yannmh modified the milestones: 5.13.0, 5.12.0 Mar 10, 2017
@yannmh yannmh force-pushed the yann/jmxfetch-list-jvms branch from be642ba to 95dced2 Compare March 10, 2017 22:12
New `list_jvms` command.
> List available Java virtual machines on the system using the Attach
  API.

See DataDog/jmxfetch#112
@yannmh yannmh force-pushed the yann/jmxfetch-list-jvms branch from 95dced2 to 58e33ac Compare March 10, 2017 22:59
@masci masci modified the milestones: 5.13.0, 5.14.x Apr 12, 2017
@olivielpeau olivielpeau modified the milestones: 5.15, 5.14 May 26, 2017
@hush-hush hush-hush modified the milestones: 5.16, 5.15 Jul 10, 2017
@truthbk truthbk modified the milestones: 5.16, 5.17 Jul 25, 2017
@truthbk truthbk removed this from the 5.16 milestone Jul 25, 2017
@iancward
Copy link
Contributor

Any chance of getting this released soon?
I applied the patch to an agent running 5.13.2 and it seems to work; however, /etc/init.d/datadog-agent jmx list_jvms only shows java processes running as the same user (e.g. dd-agent). Does this mean that the agent can only use the JMX Attach connection method for processes that run as the same user as the collector or can the agent monitor processes started by other users and this is simply a limitation of the jvms_list command?

Thanks.

@olivielpeau
Copy link
Member

Thanks for your feedback @iancward! I'll work on merging and testing this for the next minor release of the agent (5.17.0).

About the JMXAttach connection method: list_jvms does list all the JVMs it can attach to. JMXFetch can only attach to the jvms run by the same user as the JMXFetch process (dd-agent by default).

Although we don't recommend it, if you need JMXFetch to be able to attach to other processes you can try to run JMXFetch as that other user by:

  • changing the agent's supervisor configuration file (/etc/dd-agent/supervisor.conf) and setting that user as the user under [program:jmxfetch]
  • setting the correct write permissions on the agent's run/ and log/ directory for that user
  • running supervisord as root in /etc/dd-agent/supervisor.conf: user=root under [supervisord] (this has security implications, which is why we don't recommend this)

@iancward
Copy link
Contributor

Thanks for the info @olivielpeau. I did find https://gist.github.com/olivielpeau/80b8c8f9d13d4644faee328ed178fb36 and had tried to use that, but ran into some issues. I added the user for the monitored process into the datadog group (and the datadog user to the monitored process user), and updated the permissions on the /tmp/hsperfdata directories and list_jvms would list the process IDs, but couldn't see the full path, which I need for the search to work.

I ended up publishing JMX via RMI and configuring Datadog to monitor the JVMs that way. It was more configuration to manage, but definitely a lot less screwy business with files, permissions, and users.

@olivielpeau
Copy link
Member

Oh, thanks for linking to that gist @iancward, I completely forgot I had written this...

Using RMI probably makes more sense in the long run indeed. Unfortunately the Attach API has a few bugs on Oracle's JVM even when set up correctly, I think the bug you found was one of them...

@olivielpeau olivielpeau merged commit 5cad70d into master Aug 21, 2017
@olivielpeau olivielpeau deleted the yann/jmxfetch-list-jvms branch August 21, 2017 20:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants