Page 2 of 3

Re: check tomcat memory

Posted: Fri Feb 09, 2018 9:37 am
by mcapra
Frédéric GRANAT wrote: When Check_tomcat.pl reports by example 1 Gb of memory used, the taskmanager reports, by the same time, 2,2 Gb for Tomcat process memory usage.
Effectively, the history of memory consumption is logged by NagiosXI, but the memory consumption doesn't match the values showed by the taskmanager for Tomcat process
I have explained this exact situation here:
mcapra wrote:One is reporting on the Windows environment (task manager), the other is reporting on the JVM (check_tomcat.pl).

The JVM can hold as much memory for its heap as the OS allows, or up to the -Xmx setting for its runtime. That doesn't necessarily mean the JVM's processes are using all of that heap in any given instant, though.
The JVM might want to "reserve" memory for a variety of reasons.

In the above scenario, the JVM has requested 2,2GB from the OS (Windows) for its heap. Of that 2,2GB in the heap, the Tomcat process inside that JVM is currently using 1GB. Why is the JVM reserving an additional 1,2GB for its heap? I cannot say, but isn't not exactly uncommon practice especially with Tomcat. I'd wager someone told Tomcat's JVM to do that by modifying the -Xms value at run-time.

If you don't care about JVM technicals and specifics, you could use a different plugin and monitor the Tomcat process as it exists on the OS level, rather than as it exists inside a JVM. There's pros and cons to both approaches. Both NSClient++ and check_wmi_plus should have the necessary tools to get memory usage of a given process. NCPA should have it with the release of 3.0.0.

Re: check tomcat memory

Posted: Fri Feb 09, 2018 10:14 am
by Frédéric GRANAT
Hi mcapra ,
Ok thanks, I understand now :
Taskmgr : shows the all memory configured for Java
Nagios : shows the memory consumption of Tomcat ("inside Java memory")

Is there a way to monitor Tomcat process memory consumption with a tool install on my windows server ? (I would like to verify that Tomcat memory consumption is correct on my Nagios check).

Rgds

Frederic

Re: check tomcat memory

Posted: Fri Feb 09, 2018 10:47 am
by swolf
Hi Frederic,

You should be able to verify internal JVM statistics using jconsole.exe

If you don't have jconsole.exe, it should come bundled with the Java JDK, which you can get here. It probably will not come up in Windows search, but it should be installed at C:\Program Files\Java\jdk-9.0.1\bin (or whatever directory you used to install the JDK).

Re: check tomcat memory

Posted: Mon Feb 12, 2018 10:06 am
by Frédéric GRANAT
Hi,
I'v just tried jconsole.
It doesn't detect the Tomcat process and running jconsole with PID of Tomcat process says it doesn't know that process

Do you have any idea that could help ?

Re: check tomcat memory

Posted: Mon Feb 12, 2018 1:44 pm
by npolovenko
FrédéricGRANAT, I'm not an expert in Tomcat but seems like you need to connect Tomcat to the Jconsole. Take a look at this tutorial:
https://community.jaspersoft.com/wiki/h ... ng-service

Re: check tomcat memory

Posted: Tue Feb 13, 2018 4:08 am
by Frédéric GRANAT
Hi,
Thanks, I succeeded in monitoring via jconsole (and it corresponds to the values monitored by nagios)
What's strange is that check_tomcat didn't detect the java.lang.OutOfMemoryError : Java heap space (error message logged in Tomcat log)

Re: check tomcat memory

Posted: Tue Feb 13, 2018 4:39 pm
by npolovenko
Frédéric GRANAT, It could be that there was a bump in memory usage as a result of check_tomcat using the JConsole. I'd probably consider increasing the memory limit for tomcat. Take a look at these errors and try to find when and how often they're occurring.

Re: check tomcat memory

Posted: Wed Feb 14, 2018 2:31 am
by Frédéric GRANAT
Hi,
Frédéric GRANAT, It could be that there was a bump in memory usage as a result of check_tomcat using the JConsole
=> I'm talking about an error that occured 8 days ago (so no link with check_tomcat using jconsole).
I increased the memory allocated to java (from 2Gb to 4 Gb).

Re: check tomcat memory

Posted: Wed Feb 14, 2018 1:28 pm
by npolovenko
Frédéric GRANAT, I see. Let us know if this issue returns.

Re: check tomcat memory

Posted: Thu Feb 15, 2018 11:22 am
by Frédéric GRANAT
Hi,
Ok you can close the post.

Thanks for your help

Frederic