Page 1 of 1

Collecting Java Heap memory usage on Windows 2012 R2

Posted: Thu Nov 15, 2018 4:06 pm
by alsoszaa
Is there a way to monitor Java Heap (Total memory) from Tomcat on a Windows server? I think the plugins for Java on Nagios Exchange are for Linux distributions:

Java JDK 1.8.0_112
Tomcat 8.5
Windows 2012 R2

Looking for a way to collect the heap memory usage and set a warning and critical value.

Re: Collecting Java Heap memory usage on Windows 2012 R2

Posted: Fri Nov 16, 2018 9:16 am
by mcapra
The way practically any Java runtime is monitored is via JMX, either remotely via JMX clients connecting to JMX servers or locally via some tool like jconsole.

Here's the official documentation for monitoring Java runtimes via JMX with Nagios:
https://assets.nagios.com/downloads/nag ... ios-XI.pdf

The only tricky part is this particular prerequisite:
This document assumes you have the following:
  • A remote server running JMX
Which is something most Tomcat admins should be familiar with and able to provide insights on. Else, there's boatloads of guides out there for getting your Tomcat server setup with a JMX server:
https://wiki.scn.sap.com/wiki/pages/vie ... =439649886
https://tomcat.apache.org/tomcat-7.0-do ... oring.html

Depending on how Tomcat was configured, you may also have some Tomcat specific Windows performance counters (like heap usage) being exposed which can be monitored by Nagios XI via an agent NSClient++ , NCPA, or WMI:
https://support.nagios.com/kb/article.php?id=127

Happy to answer questions if you have any!

Re: Collecting Java Heap memory usage on Windows 2012 R2

Posted: Fri Nov 16, 2018 3:22 pm
by cdienger
Thanks for the input, @mcapra! Valuable info as usual.