DC/OS JMX Access DC/OS JMX Access docker docker

DC/OS JMX Access


I changed a value of property -Djava.rmi.server.hostname in JAVA_OPTS string: -Djava.rmi.server.hostname="public agent ip". And it works for me.Working configuration for a standart tomcat container in case that port 8081 is open:

{  "id": "/tomcat",  "instances": 1,  "cpus": 1,  "mem": 512,  "container": {    "type": "DOCKER",    "docker": {      "image": "tomcat:8.0",      "network": "BRIDGE",      "portMappings": [        { "protocol": "tcp", "hostPort": 8080   , "containerPort": 8080 },        { "protocol": "tcp", "hostPort": 8081   , "containerPort": 8081 }      ]    }  },  "requirePorts": true,  "acceptedResourceRoles": [    "slave_public"  ],  "env": {          "JAVA_OPTS": "-Dcom.sun.management.jmxremote -Djava.rmi.server.hostname=<public agent ip> -Dcom.sun.management.jmxremote.port=8081 -Dcom.sun.management.jmxremote.rmi.port=8081 -Dcom.sun.management.jmxremote.local.only=false -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.ssl=false"  },  "healthChecks": [    {      "gracePeriodSeconds": 120,      "intervalSeconds": 30,      "maxConsecutiveFailures": 3,      "path": "/",      "portIndex": 0,      "protocol": "HTTP",      "timeoutSeconds": 5    }  ]}

And I can connect to tomcat via jmx using from local machine: host="public agent ip" and port=8081

public agent ip = "prefix"agents.westeurope.cloudapp.azure.com


Does anybody have any ideas why I can connect to the service via jmx from my master node but I can't from my local machine? Port 8081 is opened.

You should connect jmx as the following command.

java -jar jmxterm.jar --url service:jmx:rmi:///jndi/rmi://<agent public IP>:8081/jmxrmi 

Update:

hostname should be public agent ip, then you could connect jmx from your local PC.