I´m newbie at JMX. I developped a Web Service, using Glassfish as server. Now I want to monitorize my app;
My first thought was using Jconsole and JVM as monitorizing tool remotly. After continue my research I find this articles:
http://www.javacodegeeks.com/2012/02/client-side-server-monitoring-with.html
Accessing JMX via HTTP alternatives
This suggest that I must use a bridge like Jolokia, which I clearly don´t understant the reason. JConsole + mbeans is not enough?
I continue my research and I created a java project, using their example:
public static void main(String[] args) throws MalformedObjectNameException, J4pException {
J4pClient j4pClient = new J4pClient("http://localhost:8080/jolokia/");
J4pReadRequest req = new J4pReadRequest("java.lang:type=Memory",
"HeapMemoryUsage");
J4pReadResponse resp = j4pClient.execute(req);
Map<String, String> vals = resp.getValue();
System.out.println("Memory usage: used: " + vals);
}
It worked, I receive some message, related to my usage memory. But, I don´t know what was the prupose.
What is the best way to monitorize my Web Service?