Solaris 10 上的 DTrace 功能提供了其他作业系统尚未能提供的透明度。透过一个实例来示範并介绍 DTrace。
问题:在 Solaris 10 上想知道不知名的程式到底在做什么?线索:noaccess 674 1 0 01:04:27 ? 0:32 /usr/java/bin/java -server -Xmx -XX:+BackgroundCompilation -XX:PermSize=準备:先行安装 DTraceToolkit,假设是安装在 /opt/DTraceToolkit-0.99 (参考资料附有下载网址)探索:开启一个视窗执行:root@N-Wing:/ # ps -ef | grep javanoaccess 674 1 0 01:04:27 ? 0:32 /usr/java/bin/java -server -Xmx -XX:+BackgroundCompilation -XX:PermSize=找到 PID 是 674检视它目前开启的档案:root@N-Wing:/ # pfiles 674674: /usr/java/bin/java -server -Xmx -XX:+BackgroundCompilation -XX:Per Current rlimit: 65536 file descriptors... 7: S_IFSOCK mode:0666 dev:280,0 ino:33294 uid:0 gid:0 size:0 O_RDWR SOCK_STREAM SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(49152),IP_NEXTHOP(0.192.0.0) sockname: AF_INET 127.0.0.1 port: 6788... 10: S_IFSOCK mode:0666 dev:280,0 ino:33292 uid:0 gid:0 size:0 O_RDWR SOCK_STREAM SO_REUSEADDR,SO_SNDBUF(49152),SO_RCVBUF(49152),IP_NEXTHOP(0.192.0.0) sockname: AF_INET 127.0.0.1 port: 6789... 如果要取得处理程序的参数及环境变数的话:root@N-Wing:/ # pargs -ae 674 | more... 确认 TCP 的状态:root@N-Wing:/ # netstat -an | egrep '(6788|6789)'127.0.0.1.6788 *.* 0 0 49152 0 LISTEN127.0.0.1.6789 *.* 0 0 49152 0 LISTEN 开启一个视窗执行 dtruss:root@N-Wing:/ # /opt/DTraceToolkit-0.99/dtruss -p 674...resolvepath("/var/webconsole/domains/console/work/com_sun_web_console/localhost/console/com/sun/web/console\0", 0xB8ED8DA8, 0x400)...在另外的视窗执行 opensnoop:root@N-Wing:/ # /opt/DTraceToolkit-0.99/opensnoop -p 674...60002 674 java 20 /var/webconsole/domains/console/work/com_sun_web_console/localhost/console/loader/com/sun/web/console/resources/RoleResources_zh_TW.properties...在另外的视窗执行 connections:root@N-Wing:/ # /opt/DTraceToolkit-0.99/Bin/connections UID PID CMD TYPE PORT IP_SOURCE...60002 674 java tcp 65535 .0...使用本机的浏灠器连该主机的 6789 连接埠: https://localhost:6789答案:原来是 Java Web Console
资料来源:http://blog.xuite.net/evereasy/solarpower/19400612