简体   繁体   English

没有jstack的Java线程转储

[英]Java thread dump without jstack

I need to monitor java thread status from command line(ubuntu server) to use with Icinga monitor. 我需要从命令行(ubuntu服务器)监视Java线程状态以与Icinga监视器一起使用。 But i cannot use jps, jstack and jcmd commands since it's not allowed to have JDK installed in production server. 但是我不能使用jps,jstack和jcmd命令,因为不允许在生产服务器中安装JDK。

The process_id with ps command ps命令的process_id

# ps -ef| grep [s]tart.jar | cut -d' ' -f6
1201

But I am struggling to collect java thread dump. 但是我在努力收集Java线程转储。 I have tried with kill -3 but couldn't get any output. 我已经尝试使用kill -3,但是无法获得任何输出。

Is there any other alternative ways to collect java thread status from command line ? 还有其他从命令行收集Java线程状态的方法吗?

I found the way to capture thread dump when executing kill -3 <pid> . 我找到了执行kill -3 <pid>时捕获线程转储的方法。 I have added following options to JAVA_OPTIONS in jetty server which helps to records thread dump in specified location. 我在码头服务器的JAVA_OPTIONS中添加了以下选项,这有助于在指定位置记录线程转储。

-XX:+UnlockDiagnosticVMOptions -XX:+LogVMOutput -XX:LogFile=/var/log/jetty9/threaddump.log

Now execution of kill -3 <pid> command records thread dump in threaddump.log which is used to know status of threads. 现在执行kill -3 <pid>命令将线程转储记录在threaddump.log中,该线程转储用于了解线程状态。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM