分享

[Packer01] Section 20.3. Other Monitoring Tools

 Stefen 2010-07-15

Other Monitoring Tools

An extremely useful set of tools, based on information held in /proc, can be found in /usr/proc/bin (as of Solaris 8, these tools are located in /bin, with symlinks in /usr/proc/bin pointing to the new location). They include the following:

  • pcred Prints the credentials (effective, real, and saved user IDs, or UIDs, and group IDs, or GIDs) of each process.

  • pfiles— Reports fstat (2) and fcntl (2) information for all open files in each process.

  • pflags— Prints the /proc tracing flags, pending and held signals, and other /proc status information for each lwp in each process.

  • pldd Lists the dynamic libraries linked into each process, including shared objects explicitly attached by dlopen (3X).

  • pmap— Prints the address space map of each process.

  • psig— Lists the signal actions of each process.

  • pstack Prints a hex+symbolic stack trace for each lwp in each process.

  • pstop/prun— Stops or starts each process.

  • ptime— Times a command, like the time (1) command but uses microstate accounting for reproducible precision.

  • ptree Prints the process trees containing the specified process IDs (PIDs) or users, with child processes indented from their respective parent processes. An argument of all digits is taken to be a process ID; otherwise, it is assumed to be a user login name. Default is all processes.

  • pwait— Waits for all of the specified processes to terminate.

  • pwdx— Prints the current working directory of each process.

Network traffic can be monitored with both netstat and statit, although both tools focus on the number of packets sent and received. An undocumented netstat option, -k, reports the number of packets received and sent by each network interface ( ipackets and opackets), along with an almost overwhelming quantity of other kernel data. As of Solaris 2.6, netstat -k also reports the number of bytes received and sent ( rbytes and obytes). The combination of packet count and byte statistics count allows the average packet size to be calculated for both incoming and outgoing packets. A new utility, kstat, introduced in Solaris 8, presents the same information in a more flexible manner, allowing statistics to be selectively extracted. An example of how kstat can be used is given on page 293.

A sophisticated tool referred to as memtool (developed by Richard McDougall) is also not officially supported but provides extremely useful information about memory usage for all processes on the system. memtool is available on the book website. A script based on this tool, procmem, is also included on the book website and is described on page 286.

Another useful tool is truss, which displays all system calls made by a running process. With the -c option, truss summarizes system call statistics for a monitored process. The statistics are reported when you interrupt truss with Control-C. Note, though, that truss can be intrusive on heavily loaded systems.

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多