enabling JMX on java processes - jmx

I am aware of enabling JMX on java processes. The typical recommendation for a java process with out authentication or SSL access looks something like this:
-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.port=5459
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
I am able to understand the properties except the first one. What does
-Dcom.sun.management.jmxremote
signify?
My java process exposes JMX with just the following 3 java options as well and I am able to connect using jconsole.
-Dcom.sun.management.jmxremote.port=5459
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
What happens if I do not specify "-Dcom.sun.management.jmxremote" parameter?

From what I can tell, it looks like it's just historical, and no longer necessary in Java 6 and beyond.
Under previous releases of the Java SE platform, to allow the JMX client access to a local Java VM, you had to set the following system property when you started the Java VM or Java application.
com.sun.management.jmxremote
Setting this property registered the Java VM platform's MBeans and published the Remote Method Invocation (RMI) connector via a private interface to allow JMX client applications to monitor a local Java platform, that is, a Java VM running on the same machine as the JMX client.
In the Java SE 6 platform, it is no longer necessary to set this system property. Any application that is started on the Java SE 6 platform will support the Attach API, and so will automatically be made available for local monitoring and management when needed.
Ref: http://docs.oracle.com/javase/6/docs/technotes/guides/management/agent.html

Related

How to run Tomcat 9 as a Windows service with a security manager

I'm installing Tomcat9 as a Windows service using the service.bat.
In order to use the security manager I understand that I need to use the
"-security" option but where do I configure it (before starting the installation)?
I saw that the service path points to Tomcat9.exe (and not to the catalina.bat that accepts the security option)

Unable to access datasource mbeans via jmx in wildfly swarm/thorntail

I'm trying to enable JMX for my wildfly swarm component. I'm used to seeing several mbeans for a variety of wildfly subsystems, I'm specifically interested in the data source mbeans.
I've pasted a snippet below, I've got the jmx fraction and I have statistics-enabled set to true. When thorntail is running I can connect to the JVM via JMX, but I am cannot see any datasource mbeans. Is there something else that needs to be enabled for them to show up?
The app is currently on swarm 2018.2.0.Final
swarm:
jmx:
expression-expose-model.domain-name: RemoteJMX
jmx-remoting-connector:
use-management-endpoint: true
resolved-expose-model.domain-name: RemoteJMX
show-model: true
datasources:
data-sources:
MyDataSourceName:
driver-name: com.microsoft.sqlserver
connection-url: jdbc:xyz
statistics-enabled: true
First of all, WildFly Swarm 2018.2.0.Final is very old. In the meantime, WildFly Swarm got renamed to Thorntail; you can automatically migrate by running mvn io.thorntail:thorntail-maven-plugin:2.5.0.Final:migrate-from-wildfly-swarm.
And then: if you connect to JMX, do you see any WildFly MBeans at all? I mean, is the problem with datasources only, or is it more general?
During boot, you should see JMX-related log messages, such as JMX not configured for remote access or JMX configured for remote connector: implicitly using ... interface. Do you see any of them?
Finally, it seems you want JMX exposed on the management port. Do you have a dependency on the management fraction?

Unable to see any web transactions of my Vertx application in glowroot

I am working on a vertx application running some apis.
After following instructions mentioned under https://github.com/glowroot/glowroot/wiki/Central-Collector-Installation, I was not able to see any Web transaction data on glowroot central collector, here's what I tried.
I downloaded glowroot-central.jar, and after building the netty plugin from https://github.com/glowroot/glowroot/tree/master/agent/plugins/netty-plugin, placed it under plugins folder containing glowroot-central.jar file.
Next, started glowroot by calling "java -jar glowroot-central.jar"
And then passed in -javaagent:path/to/glowroot.jar to my JVM args of vertx application.
I was also able to confirm that my agent is able to connect to central collector from console output
Here's the output when I start my Vertx application, which confirms that agent is connecting to Central Collector
org.glowroot - Java version: 1.8.0_201 (Oracle Corporation / Mac OS X)
2019-04-05 12:31:43.988 INFO org.glowroot - Java args: -javaagent:/Users/somefolder/glowroot/glowroot.jar
org.glowroot - agent id: "testserver"
org.glowroot - connected to the central collector http://0.0.0.0:8181, version 0.13.2, built 2019-03-27 17:05:44 +0000
I am also able to see my agent's name which is "testserver" on glowroot web UI. However I can not see any web transaction data. I called my API, few hundred times to using an automated tool and waited few min (~30 min), but I don't see anything :(

TITAN server monitoring via JMX

Is it possible to monitor TITAN cassandra server with rexster remotely via JMX using something like VisualVM?
I have titan installed on the cloud and want to monitor it from my dev box. Is this possible.
I have read this
https://github.com/tinkerpop/rexster/wiki/Monitoring
but it seems that JMX MBeans are only available locally however I could be wrong
You can monitor Rexster JMX remotely with VisualVM, but it takes a bit of configuration and changes to rexster.sh as you need to include these environment variables:
-Dcom.sun.management.jmxremote.port=3333
-Dcom.sun.management.jmxremote.ssl=false
-Dcom.sun.management.jmxremote.authenticate=false
You can read some more about how to do remote setup on the VisualVM site.
You mentioned that you are trying to monitor an instance in the cloud. You didn't mention the cloud provider, but I've had trouble doing this with EC2 in the past. Perhaps this post will help you out. While I've had issues with VisualVM remoting to EC2, I have successfully connected to Rexster via VisualVM from another EC2 instance without trouble so if all else fails that could be your workaround.

call jmx operation on a local running process

I have a java process on a linux server, which runs with this option: -Dcom.sun.management.jmxremote
So I cannot just connect to this process via jconsole running on my local pc (because neither port nor -Dcom.sun.management.jmxremote.ssl=false options are set up).
But still, how can I connect to the application and run some operations over some of its MBeans? It this possible? I have a ssh access to the server and would be able to run it "locally" on the server (but not changing the options unfortunately)
According to JMX documentation the -Dcom.sun.management.jmxremote option
Enables the JMX remote agent and local monitoring via JMX connector published on a private
interface used by jconsole. The jconsole tool can use this connector if it is executed by
the same user ID as the user ID that started the agent. No password or access files are
checked for requests coming via this connector.
The naming is a bit unfortunate because it in fact enables the local monitoring only.
Since you can not change the options but can access the server via SSH the only option is to use X server forwarding (ssh -X ...) and run jconsole (or better yet jvisualvm which has specific optimisations for running remotely).

Resources