Using Standard Commands and Tools

I l @ ve RuBoard

This section describes standard commands and system instrumentation that can be used for monitoring any application. Some Unix commands are available that can help you to determine the status of your application. Commands to report the overall status of your system are described in Chapter 4.

In addition to these commands, you may want to check the system log file, /var/adm/syslog/syslog.log, for error messages if your system is experiencing problems. Messages written to this log file include information on the module experiencing the problem and the time the event occurred, which can be very valuable when troubleshooting.

ps

The ps command can be used to show the processes running on the system. This can be a quick way to determine whether an application is running ” if its process names are known.

On larger systems with many active processes, you may want to restrict ps output by using the various options. ps “p restricts the listing to a specific process list, and ps “u shows only those processes with a matching user ID.

A process name may not be unique on the system, so you may need to look at additional information, such as the user ID. The ps command can provide the following information:

  • User ID of process owner

  • Process Identifier (PID)

  • PID of parent process

  • Start time of process

  • Controlling terminal for process

  • Cumulative execution time for process

  • Command name and arguments

top

The top command is useful for monitoring process information, as well as system CPU and memory loads. top output is displayed in the terminal window and is updated every five seconds, by default.

top shows CPU resource statistics, including load averages (job queues over the last 1, 5, and 15 minutes), number of processes in each state (sleeping, waiting, running, starting, zombie, and stopped ), percentage of time spent in each processor state (user, nice, system, idle, interrupt, and swapper ) per processor on the system, as well as the average for each processor in a multiprocessor system.

At the process level, top lists the most active processes on the system, based on their CPU usage. The process data displayed by top includes the PID, process size (text, data, and stack), resident size of the process (in K), process state (sleeping, waiting, running, idle, zombie, or stopped), number of CPU seconds consumed by the process, and the average CPU utilization of the process. top can be used to identify processes that may be using large amounts of CPU or memory.

Listing 7-1 shows an example of the output you see when running top. Note that system and process information are displayed on the same screen, so that you can quickly get an overview of what is happening.

vmstat

The vmstat command supplies good information about system resources, including virtual memory and CPU usage. vmstat is useful for detecting when you are low on memory or swap space. CPU utilization is shown by user, system, and idle time.

For processes, vmstat shows the number of processes in various states. These states include: currently in the run queue, blocked on an I/O operation, and swapped out to disk. This can help to give you an idea of whether or not a process is functioning properly.

Listing 7-1 top output showing most active processes.
 System: hpgsslha                                      Sat Apr 24 10:27:04 1999 Load averages: 0.15, 0.08, 0.04 174 processes: 172 sleeping, 1 running, 1 zombie Cpu states:  LOAD   USER   NICE    SYS   IDLE  BLOCK  SWAIT   INTR   SSYS  0.15   0.2%   0.0%   1.2%  98.6%   0.0%   0.0%   0.0%   0.0% Memory: 55028K (8924K) real, 56188K (15136K) virtual, 60528K free  Page# 1/13  TTY   PID USERNAME PRI NI   SIZE    RES STATE    TIME %WCPU  %CPU COMMAND    ?  1729 root      20 20  6676K  5488K sleep  871:04  1.12  1.12 cmcld    ?     3 root     128 20     0K     0K sleep  555:03  0.68  0.68 statdaemon   p2 10779 bstone   178 20   580K   316K run      0:00  0.77  0.51 top    ?     7 root     -32 20     0K     0K sleep  231:40  0.30  0.30 ttisr    ?   262 root     154 20   280K    24K sleep  169:33  0.23  0.23 syncer    ?  1439 root     154 20    80K    84K sleep   51:43  0.06  0.06 instl_bootd    ?  1718 root     168 20    64K   128K sleep   20:55  0.05  0.05 spserver    ?  1424 root     154 20   104K   120K sleep   14:05  0.05  0.05 inetd    ?  1455 root     154 20   304K   184K sleep   29:29  0.05  0.05 nmbd    ?  1641 root     154 20  5100K  1224K sleep   40:50  0.05  0.04 swagentd    ?  1347 root     127 20   104K    76K sleep   30:50  0.03  0.03 netfmt    ?  1662 root     154 20    80K   128K sleep   12:00  0.03  0.03 hpnpd    ? 15563 jimg     154 20   460K   140K sleep    6:59  0.03  0.03 xload    ?  2005 root     154 20  2760K    68K sleep   23:51  0.02  0.02 ns-admin 

The statistics that you see will vary depending on the command option specified. By specifying a time interval, you can have vmstat run continuously so that you can see how values vary over time.

I l @ ve RuBoard


UNIX Fault Management. A Guide for System Administrators
UNIX Fault Management: A Guide for System Administrators
ISBN: 013026525X
EAN: 2147483647
Year: 1999
Pages: 90

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net