Sponsored Content
Top Forums Shell Programming and Scripting Help with bash script - Need to get CPU usage as a percentage Post 302374723 by mkastin on Wednesday 25th of November 2009 09:23:36 AM
Old 11-25-2009
sysstat
 

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
CONS(3) 						     Library Functions Manual							   CONS(3)

NAME
cons - console, clocks, process/process group ids, user, null, klog, stats, lights, noise, sysstat, hz, swap, key, hostowner, hostdomain, authenticate, authcheck, authenticator SYNOPSIS
bind #c /dev /dev/authcheck /dev/authenticate /dev/authenticator /dev/clock /dev/cons /dev/consctl /dev/cputime /dev/hostdomain /dev/hostowner /dev/hz /dev/key /dev/klog /dev/lights /dev/msec /dev/noise /dev/null /dev/pgrpid /dev/pid /dev/ppid /dev/swap /dev/sysname /dev/sysstat /dev/time /dev/user DESCRIPTION
The console device serves a one-level directory giving access to the console and miscellaneous information. Reading the cons file returns characters typed on the keyboard. Normally, characters are buffered to enable erase and kill processing. A control-U, typed at the keyboard kills the current input line (removes all characters from the buffer of characters not yet read via cons), and a backspace erases the previous non-kill, non-erase character from the input buffer. Killing and erasing only delete characters back to, but not including, the last newline. Characters typed at the keyboard actually produce 16-bit runes (see utf(6)), but the runes are translated into the variable-length UTF encoding (see utf(6)) before putting them into the buffer. A read(2) of length greater than zero causes the process to wait until a newline or a ends the buffer, and then returns as much of the buffer as the argument to read allows, but only up to one complete line. A terminating is not put into the buffer. If part of the line remains, the next read will return bytes from that remainder and not part of any new line that has been typed since. If the string rawon has been written to the consctl file and the file is still open, cons is in raw mode: characters are not echoed as they are typed, backspace and are not treated specially, and characters are available to read as soon as they are typed. Ordinary mode is reen- tered when rawoff is written to consctl or this file is closed. A write (see read(2)) to cons causes the characters to be printed on the console screen. The null file throws away anything written to it and always returns zero bytes when read. The klog file contains the tail of messages written by kernel logging statements. Writing a number (as plain text) to the lights device directs any lights that are available to turn on and off. The bits of the number are mapped to the lights in a processor-dependent way. Writing two blank- or tab-separated numbers to the noise device causes the machine to make a tone, if possible. The first number is the frequency, in Hertz, and the second is the duration, in milliseconds. The hostdomain file contains the name of the authentication domain that this host belongs to; see auth(6). Only the user named in /dev/hostowner may write this. The hostowner file contains the name of the user that owns the console device files. The hostowner also has group permissions for any local devices. The key file is used to set the DES key used for encryption. Each machine has one key. Only the user named in /dev/hostowner may write this. The authenticate file is used to authenticate new users to the kernel; see auth(6). After an open, the first read returns a ticket request message of the following form: char num; char authid[28]; char authdom[48]; char chal[8]; char hostid[28]; char uid[28]; Here num is 1, authid and hostid are the contents of hostowner, and authdom is the contents of hostdomain. Chal is an 8 byte random chal- lenge created by the kernel. A subsequent write of a valid ticket encrypted with the key contained in key changes the user name of the writing process to the value of suid in the ticket. The ticket is of the form: char num; char chal[8]; char cuid[28]; char suid[28]; char noncekey[7]; The ticket is valid if num is 64 and chal matches the challenge in the ticket request. Writing an invalid ticket generates an error. A read following a successful write yields an authenticator message of the form: char num; char chal[8]; char id[4]; The authenticator is encrypted in noncekey from the ticket. Num is 66, id[0-4] are 0, and chal matches the challenge in the original ticket request. The authenticator file is used to generate an authenticator from a ticket. One writes a ticket encrypted with the key contained in key, followed, optionally, by a 4-byte id; a missing id defaults to zero. If the client uid matches the current user, a subsequent read yields an authenticator for that ticket with the given id. The authcheck file is used to match authenticators to tickets. A write of an authenticator appended to the end of a ticket succeeds if the ticket is encrypted with the key contained in key, the ticket's num is 65, the authenticator is encrypted with the ticket's noncekey, the authenticator's and ticket's chal's match, the authenticator's num is 66, and the authenticator's id is 0. Alternatively, the write may consist of ticket, authenticator, chal, and id, in which case the given chal and id must match those of the authenticator. The user file contains the name of the user associated with the current process. Any process can change to user none by writing none to this file. The rest of the files contain (mostly) read-only strings. Each string has a fixed length: a read(2) of more than that gives a result of that fixed length (the result does not include a terminating zero byte); a read of less than that length leaves the file offset so the rest of the string (but no more) will be read the next time. To reread the file without closing it, seek must be used to reset the offset. When the file contains numeric data, each number is formatted in decimal as an 11-digit number with leading blanks and one trailing blank: twelve bytes total. The cputime file holds 6 numbers, containing the time in milliseconds that the current process has spent in user mode, system calls, real elapsed time, and then the time spent, by exited children and their descendants, in user mode, system calls, and real elapsed time. The clock file holds two numbers: the number of clock ticks since booting followed by the number of clock ticks in a second. The sysname file holds the textual name of the machine, e.g. kremvax, if known. The sysstat file holds 8 numbers: processor number, context switches, interrupts, system calls, page faults, tlb faults, tlb purges, and load average. The load average is in units of milli-CPUs and is decayed over time; the others are total counts from boot time. If the machine is a multiprocessor, sysstat holds one line per processor. Writing anything to sysstat resets all of the counts on all processors. The swap device holds a string of the form m1/m2 memory s1/s2 swap These give, for each of internal memory and the swapping area, the number of pages used and the total available. These numbers are not blank padded. To turn on swapping, write to swap the textual file descriptor number of a file or device on which to swap. See swap(8). The other files served by the cons device are all single numbers: hz frequency of the system clock msec number of milliseconds since booting pgrpid process group number pid process number ppid parent's process number time number of seconds since the epoch 00:00:00 GMT, Jan. 1, 1970. (Can be written once, to set at boot time.) SEE ALSO
bit(3), keyboard(6), auth(6), utf(6), swap(8) SOURCE
/sys/src/9/port/devcons.c BUGS
For debugging, two control-T's followed by a letter generate console output: prints data about processes, prints data about streams, prints data about the mount device, prints data about the bitblt device, and prints data about kernel memory allocation. The system can be rebooted by typing CONS(3)
All times are GMT -4. The time now is 12:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy