Sponsored Content
Top Forums Shell Programming and Scripting Help with bash script - Need to get CPU usage as a percentage Post 302374599 by graysky on Wednesday 25th of November 2009 03:58:24 AM
Old 11-25-2009
My distro doesn't have iostat Smilie I need to figure out which package contains it.
 

10 More Discussions You Might Find Interesting

1. HP-UX

How to determine cpu&memory percentage usage per user

Using HP-UX v11 Need to monitor cpu and memory usage, total for system and separately for each user in command-line mode. Found out next ways to monitor total cpu usage under hp-ux: 1) vmstat, also shows free memory 2) sar -M ps -eo user,pcpu - does not work, means 'user-defined format'... (4 Replies)
Discussion started by: hp-ux-user
4 Replies

2. Gentoo

cpu%/mem% usage, scripting, dzen2: howto learn bash the hard way

I am trying to write a small (and rather simple) script to gather some info about the system and piping it to dzen2 first, i want to explain some things. I know i could have used conky, but my intention was to expand my knowledge of bash, pipes and redirections inside a script, and to have fun... (14 Replies)
Discussion started by: broli
14 Replies

3. HP-UX

how can I find cpu usage memory usage swap usage and logical volume usage

how can I find cpu usage memory usage swap usage and I want to know CPU usage above X% and contiue Y times and memory usage above X % and contiue Y times my final destination is monitor process logical volume usage above X % and number of Logical voluage above can I not to... (3 Replies)
Discussion started by: alert0919
3 Replies

4. AIX

How to monitor the IBM AIX server for I/O usage,memory usage,CPU usage,network..?

How to monitor the IBM AIX server for I/O usage, memory usage, CPU usage, network usage, storage usage? (3 Replies)
Discussion started by: laknar
3 Replies

5. Shell Programming and Scripting

Finding total Percentage CPU usage

Hi, How can I find total CPU usage in percentage? e.g. if my system has 8 CPUs and I want to list total usage for all of them, is it possible through a command? I have tried some of the commands like top, mpstat, sar. The output of those commands has to be manipulated to derive the percentage... (14 Replies)
Discussion started by: jal_capri
14 Replies

6. HP-UX

Perl script limit cpu usage

Hi Experts, I am executing multiple instances(in parallel) of perl script on HP-UX box. OS is allocating substantial amount of CPU to these perl processes,resulting higher cpu utilization. Glance always shows perl processes are occupying majority of the CPU resource. It is causing slower... (2 Replies)
Discussion started by: sai_2507
2 Replies

7. Shell Programming and Scripting

Shell script to calculate the max cpu usage from the main script

Hi All, I have a script which does report the cpu usuage, there are few output parameter/fields displayed from the script. My problem is I have monitor the output and decide which cpu number (column 2) has maximum value (column 6). Since the output is displayed/updated every seconds, it's very... (1 Reply)
Discussion started by: Optimus81
1 Replies

8. Shell Programming and Scripting

CPU usage script

Hello Friends, I am trying to create a shell script which will check the CPU utilization. I use command top to check the %CPU usage. It give s me below output Cpu states: CPU LOAD USER NICE SYS IDLE BLOCK SWAIT INTR SSYS 0 0.31 9.6% 0.0% 6.1% 84.3% 0.0% 0.0%... (3 Replies)
Discussion started by: Nakul_sh
3 Replies

9. Shell Programming and Scripting

Script for CPU usage -Linux

Hi all I was wondering if its possible to write a script to keep CPU usage at 90%-95%? for a single cpu linux server? I have a perl script I run on servers with multple cpu's and all I do is max all but one cpu to get into the 90'% utilised area. I now need a script that raises the CPU to... (4 Replies)
Discussion started by: sudobash
4 Replies

10. Solaris

Capture PRSTAT based on CPU usage percentage

Hi, Recently i have write a simple script to capture CPU high usage based on prstat but i found out that it did capture correctly. I need to capture the rows that contains CPU usage more than 3%. Below line which i thought will capture CPU usage based CPU column in prstat(9th parameter) which is... (3 Replies)
Discussion started by: tharmendran
3 Replies
IOSTAT(8)						    BSD System Manager's Manual 						 IOSTAT(8)

NAME
iostat -- report I/O statistics SYNOPSIS
iostat [-CUdKIoT?] [-c count] [-n devs] [-w wait] [drives] DESCRIPTION
Iostat displays kernel I/O statistics on terminal, device and cpu operations. The first statistics that are printed are averaged over the system uptime. To get information about the current activity, a suitable wait time should be specified, so that the subsequent sets of printed statistics will be averaged over that time. The options are as follows: -? Display a usage statement and exit. -C Display CPU statistics. This is on by default, unless -d is specified. -c Repeat the display count times. If no wait interval is specified, the default is 1 second. -d Display only device statistics. If this flag is turned on, only device statistics will be displayed, unless -C or -U or -T is also specfied to enable the display of CPU, load average or TTY statistics. -I Display total statstics for a given time period, rather than average statistics for each second during that time period. -K In the blocks transferred display (-o), display block count in kilobytes rather then the device native block size. -n Display up to devs number of devices. iostat will display fewer devices if there aren't devs devices present. -o Display old-style iostat device statistics. Sectors per second, transfers per second, and miliseconds per seek are displayed. If -I is specified, total blocks/sectors, total transfers, and miliseconds per seek are displayed. -T Display TTY statistics. This is on by default, unless -d is specified. -U Display system load averages. This is on by default, unless -d is specified. -w Pause wait seconds between each display. If no repeat count is specified, the default is infinity. Iostat displays its information in the following format: tty tin characters read from terminals tout characters written to terminals devices Device operations. The header of the field is the device name and unit number. iostat will display as many devices as will fit in a standard 80 column screen, or the maximum number of devices in the system, whichever is smaller. If -n is specified on the command line, iostat will display the smaller of the requested number of devices, and the maximum number of devices in the system. To force iostat to display specific drives, their names may be supplied on the command line. iostat will not display more devices than will fit in an 80 column screen, unless the -n argument is given on the command line to specify a maximum number of devices to display, or the list of specified devices exceeds 80 columns. If fewer devices are specified on the command line than will fit in an 80 column screen, iostat will show only the specified devices. The standard iostat device display shows the following statistics: KB/t kilobytes per transfer tps transfers per second MB/s megabytes per second The standard iostat device display, with the -I flag specified, shows the following statistics: KB/t kilobytes per transfer xfrs total number of transfers MB total number of megabytes transferred The old-style iostat display (using -o) shows the following statistics: sps sectors transferred per second tps transfers per second msps average milliseconds per transaction The old-style iostat display, with the -I flag specified, shows the following statistics: blk total blocks/sectors transferred xfr total transfers msps average milliseconds per transaction cpu us % of cpu time in user mode sy % of cpu time in system mode id % of cpu time in idle mode EXAMPLES
iostat -w 1 disk0 disk2 Display statistics for the first and third disk devices device every second ad infinitum. iostat -c 2 Display the statistics for the first four devices in the system twice, with a one second display interval. iostat -Iw 3 Display total statistics every three seconds ad infinitum. iostat -odICTw 2 -c 9 Display total statistics using the old-style output format 9 times, with a two second interval between each measurement/display. The -d flag generally disables the TTY and CPU displays, but since the -T and -C flags are given, the TTY and CPU displays will be displayed. SEE ALSO
fstat(1), netstat(1), nfsstat(1), ps(1), pstat(8) The sections starting with ``Interpreting system activity'' in Installing and Operating 4.3BSD. HISTORY
This version of iostat first appeared in FreeBSD 3.0. BSD
September 27, 2001 BSD
All times are GMT -4. The time now is 09:35 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy