Continuous system-performance monitoring with commands in AIX
The vmstat, iostat, netstat, and sar commands provide the basic foundation upon which you can construct a performance-monitoring mechanism.
You can write shell scripts to perform data reduction on the command output, warn of performance problems, or record data on the status of a system when a problem is occurring. For example, a shell script can test the CPU idle percentage for zero, a saturated condition, and execute another shell script for when the CPU-saturated condition occurred. The following script records the 15 active processes that consumed the most CPU time other than the processes owned by the user of the script:
# ps -ef | egrep -v "STIME|$LOGNAME" | sort +3 -r | head -n 15
• Continuous performance monitoring with the vmstat command
The vmstat command is useful for obtaining an overall picture of CPU, paging, and memory usage.
The following is a sample report produced by the vmstat command:
# vmstat 5 2
kthr memory page faults cpu
----- ----------- ------------------------ ------------ -----------
r b avm fre re pi po fr sr cy in sy cs us sy id wa
1 1 197167 477552 0 0 0 7 21 0 106 1114 451 0 0 99 0
0 0 197178 477541 0 0 0 0 0 0 443 1123 442 0 0 99 0
Remember that the first report from the vmstat command displays cumulative activity since the last system boot. The second report shows activity for the first 5-second interval.
• Continuous performance monitoring with the iostat command
The iostat command is useful for determining disk and CPU usage.
The following is a sample report produced by the iostat command:
# iostat 5 2
tty: tin tout avg-cpu: % user % sys % idle % iowait
0.1 102.3 0.5 0.2 99.3 0.1
" Disk history since boot not available. "
tty: tin tout avg-cpu: % user % sys % idle % iowait
0.2 79594.4 0.6 6.6 73.7 19.2
Disks: % tm_act Kbps tps Kb_read Kb_wrtn
hdisk1 0.0 0.0 0.0 0 0
hdisk0 78.2 1129.6 282.4 5648 0
cd1 0.0 0.0 0.0 0 0
Remember that the first report from the iostat command shows cumulative activity since the last system boot. The second report shows activity for the first 5-second interval.
The system maintains a history of disk activity. In the example above, you can see that the history is disabled by the appearance of the following message:
Disk history since boot not available.
To disable or enable disk I/O history with smitty, type the following at the command line:
# smitty chgsys
Continuously maintain DISK I/O history [value]
and set the value to either false to disable disk I/O history or true to enable disk I/O history. The interval disk I/O statistics are unaffected by this setting.
• Continuous performance monitoring with the netstat command
The netstat command is useful in determining the number of sent and received packets.
The netstat command is useful in determining the number of sent and received packets.
The following is a sample report produced by the netstat command:
# netstat -I en0 5
input (en0) output input (Total) output
packets errs packets errs colls packets errs packets errs colls
8305067 0 7784711 0 0 20731867 0 20211853 0 0
3 0 1 0 0 7 0 5 0 0
24 0 127 0 0 28 0 131 0 0
CTRL C
Remember that the first report from the netstat command shows cumulative activity since the last system boot. The second report shows activity for the first 5-second interval.
• Continuous performance monitoring with the sar command
The sar command is useful in determining CPU usage.
The sar command is useful in determining CPU usage.
The following is a sample report produced by the sar command:
# sar -P ALL 5 2
AIX aixhost 2 5 00040B0F4C00 01/29/04
10:23:15 cpu %usr %sys %wio %idle
10:23:20 0 0 0 1 99
1 0 0 0 100
2 0 1 0 99
3 0 0 0 100
- 0 0 0 99
10:23:25 0 4 0 0 96
1 0 0 0 100
2 0 0 0 100
3 3 0 0 97
- 2 0 0 98
Average 0 2 0 0 98
1 0 0 0 100
2 0 0 0 99
3 1 0 0 99
- 1 0 0 99
The sar command does not report the cumulative activity since the last system boot
No comments:
Post a Comment