What is jstatd?
"The jstatd tool is an RMI server application that monitors for the creation and termination of instrumented HotSpot Java virtual machines (JVMs) and provides a interface to allow remote monitoring tools to attach to JVMs running on the local host." [source]
NOTE: jstatd is not required for JMX connections;
How to setup jstatd on a Linux server?
A) login as root (told you - it's dirty)
B) create the jstatd.all.policy file in the home folder (/root) with the following content:
grant codebase "file:/opt/jdk1.8.0_45/lib/tools.jar" {
permission java.security.AllPermission;
};
NOTE: don't forget to change the path of the JDK
C) run jstatd:
./jstatd -p 1099
-J-Djava.security.policy=/root/jstatd.all.policy
-J-Djava.net.preferIPv4Stack=true
-J-Djava.rmi.server.hostname=172.17.1.143
-p listen port for jstat daemon
java.security.policy policy file to use (created above)
java.net.preferIPv4Stack use IPv4 (optional if IPv6 not used)
java.rmi.server.hostname listen on this interface (optional)
NOTE: add & to run jstatd in background
D) now you should be able to monitor this server using VisualVM.