Monitoring Tomcat with jvisualvm on Redhat

Monitoring must be done using the VM owner, the tomcat user on RHEL. In a VNC session, “xhost +SI:localuser:tomcat” or equivalent needs to be run to allow tomcat to access the DISPLAY.

First I needed to setup some things as root, as the tomcat user home directory is owned by root and jvisualvm wants to create some preference directories.

su -
mkdir /usr/share/tomcat5/.visualvm
mkdir /usr/share/tomcat5/.nbprofiler
chown tomcat:tomcat /usr/share/tomcat5/.visualvm
chown tomcat:tomcat /usr/share/tomcat5/.nbprofiler

Then, one can just run jvisualvm as tomcat when required:

su - tomcat

To monitor a long running jvm owned by the tomcat user, you will also need to ensure that the tmpwatch program does not blow away an important jvm file:

  1. Edit the file /etc/cron.daily/tmpwatch
  2. Add the exclusion -x /tmp/hsperfdata_tomcat to the /tmp tmpwatch invocation.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: