Discussion:
[jboss-user] [Beginner's Corner] - Using jps and jstat with jboss
Willem Noorduin
2013-01-14 06:44:03 UTC
Permalink
Willem Noorduin [https://community.jboss.org/people/willemnoorduin] created the discussion

"Using jps and jstat with jboss"

To view the discussion, visit: https://community.jboss.org/message/791429#791429

--------------------------------------------------------------
We are trying to set up some basic monitoring with jps and jstat and we are running into a problem. For usage of these tools there is a hsperfdata_${user} directory created by the jvm, by default in /tmp. Only in our case, it is not created. Hence we cannot use jps, jstat or the other jvm tools. Some information:

***@nlptc27b09:/tmp# cat /etc/redhat-release
Red Hat Enterprise Linux Server release 6.3 (Santiago)

***@nlptc27b09:/tmp# uname -a
Linux nlptc27b09 2.6.32-279.11.1.el6.x86_64 #1 SMP Sat Sep 22 07:10:26 EDT 2012 x86_64 x86_64 x86_64 GNU/Linux
***@nlptc27b09:/tmp# /distr/jdk/bin/java -version
java version "1.6.0_27"
Java(TM) SE Runtime Environment (build 1.6.0_27-b07)
Java HotSpot(TM) Server VM (build 20.2-b06, mixed mode)

***@nlptc27b09:/tmp# ls -ls /tmp
total 16
0 drwxr-xr-x. 2 root     root       40 Jan 14 07:21 hsperfdata_root
12 -rwxr-xr-x. 1 root     root     8630 Dec 13 15:30 iptables
4 -rwxr-xr-x. 1 root     root      324 Dec 13 12:53 iptables-ctl.sh
0 drwxr-xr-x. 2 wnoordui users      40 Dec 12 10:20 iptables.d
0 drwx------. 2 root     root       40 Dec 18 11:46 mc-root
0 drwx------. 2 wnoordui wnoordui   40 Dec  3 09:44 mc-wnoordui
0 drwx------. 2 root     root       40 Nov 14 10:53 vmware-root

***@nlptc27b09:/tmp# ls -ld /tmp
drwxrwxrwt. 8 root root 200 Jan 14 07:18 /tmp

We are running jboss under a non-root user (as it should) named jboss.  We have tried the next things, with different results:

* Running jboss under root. => Then the directory hsperdata_root is used and we get results (but you don't want that).
* Putting *-XX:+UsePerfData -Djava.io.tmpdir=/tmp* as Java options => has no results (there is no hsperdata_jboss, in our case, created).
* Switching to the last stable release of SUN/Oracle SDK => has no results (there is no hsperdata_jboss, in our case, created).
* Switching to OpenJDK on Redhat => Now we get a /tmp/hsperfdata_jboss (but we don't want to use OpenJDK for our production JBoss).
* Switching to another OS (Debian 6.0.6) and the same SUN JDK => Is working fine.
* Putting *-XX:+UsePerfData -Djava.io.tmpdir=/home/jboss/tmp* (where this last directory is writeable by user jboss)  as Java options => has no results (there is no hsperdata_jboss, in our case, created).

I am communicating with Redhat on this, since the swritch from SUN to OpenJDK or/and Redhat to another Linux OS seemed to do the trick, but all I learned was that it might be a permission issue. But:

***@nlptc27b09:/apps/jboss/test/configs# su - jboss
***@nlptc27b09:~$ cd /tmp
***@nlptc27b09:/tmp$ mkdir i-am-a-directory
***@nlptc27b09:/tmp$ touch i-am-a-directory/i-am-a-file
***@nlptc27b09:/tmp$ ls -lR i-am-a-directory/
i-am-a-directory/:
total 0
-rw-rw-r--. 1 jboss jboss 0 Jan 14 07:38 i-am-a-file

on Redhat says otherwise. Also, you can google all you want on this problem, all I found was ways to turn the perfstats off, not on. Can someone tell me where I went wrong ?  Also, the residental Linux Gurus on our team seems to point that this is really a java issue.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/791429#791429]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Willem Noorduin
2013-01-14 07:36:19 UTC
Permalink
Willem Noorduin [https://community.jboss.org/people/willemnoorduin] created the discussion

"Re: Using jps and jstat with jboss"

To view the discussion, visit: https://community.jboss.org/message/791446#791446

--------------------------------------------------------------
As a round of "asnswering your own question" the hsperfdata_$user directory does appear when I start jboss with a 64-bit jdk (on a 64-bit platform). So I suspect I am missing some libraries that makes it possible to connect to 32-bits proceesses. We have make the 32-bits compatibility with:

root # yum install -y glibc-devel.i686 libgcc.i686 libstdc++-devel.i686

Obviously, this is enough to run jboss in a 32-bits jdk, but no enough to do stiuff like jps and jstat.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/791446#791446]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Wolf-Dieter Fink
2013-01-14 09:31:17 UTC
Permalink
Wolf-Dieter Fink [https://community.jboss.org/people/wdfink] created the discussion

"Re: Using jps and jstat with jboss"

To view the discussion, visit: https://community.jboss.org/message/791467#791467

--------------------------------------------------------------
I'm using Fedora and RHEL as well.
the default is a 64bit vm. If I use a 32 bit VM by setting JAVA_HOME everything works fine.

The /tmp/hsperfdata directory is created as soon as the (JBoss) JVM starts.
Maybe you are right and miss libraries or you have some strange settings.
I suppose that the JVM might fail if it is not possible to write the files.

Maybe 'lsof' give you a hint.
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/791467#791467]

Start a new discussion in Beginner's Corner at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
Loading...