Sponsored Content
Full Discussion: prstat in shell
Top Forums Shell Programming and Scripting prstat in shell Post 302106088 by sb008 on Tuesday 6th of February 2007 01:12:21 PM
Old 02-06-2007
If you check the manual page for prstat you will see that besided a lot of options there are 2 optional arguments for prstat.

These arguments are:
interval (interval in seconds between 2 statistics reports)
count (Number of statistics reports)

So you could use:

prstat 2 5
Make 5 statistics reports with an interval of 2 seconds

prtstat 3
Make endless statistics report with an interval of 3 seconds.

prstat 0 1
Make 1 statistics report with an interval of 0 seconds (The interval is irrelevant here and can be any number, since it's only 1 report).


To process the output of prstat in a scriipt you have to limit the number of statistics reports. Without this limitation prstat would never end and your script with never proceeed.

You can redirect the limited number of statistics reports to some kind of file which you use later on in your script as source to extract/generate/manipulate or whatever.

If you do not which to redirect the output to a file but like to process the outut right away, by piping the output to another command, it would be easiest to start with a single statistics report. Once you know how to parse that kind of information e.g. with (n)awk you count increase the number of statistics reports. But no matter what, make sure the number of statistics reports is limited, or your script will never end.

There are ways to process a continious output stream of prstat, but shell scripting is not really suited for that. Basically you would have 2 programs and are dealing with IPC (Inter Process Communication).
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Help with prstat

Hello, The last line of prstat shows load average. I am unable to figure out what actually it is. I have read the man pages and also googled, all for no use. Can somebody help me, as to what should be the avg. load of the system for best performance and how is this load of prstat calculated. (6 Replies)
Discussion started by: vibhor_agarwali
6 Replies

2. Shell Programming and Scripting

stop Prstat using shell script

How to stop the Prstat using shell script ? because after i run the below script the thing seems to be always in loop and cannot get out till i ctrl + c, is there anything that i can add in the script to make it terminate ? <code> #!/bin/sh prstat -Tc -u testing > testing.txt </code> ... (19 Replies)
Discussion started by: filthymonk
19 Replies

3. Solaris

prstat log

Hi All, But the prstat logs of my system shows:- NPROC USERNAME SWAP RSS MEMORY TIME CPU 77 oracle 17G 10G 65% 4:24:47 0.8% Total: 486 processes, 3850 lwps, load averages: 3.77, 4.45, 4.94 What does the MEMORY denotes? Is it the %memory used from RAM? Or is the %memory used by... (10 Replies)
Discussion started by: dipashre
10 Replies

4. Solaris

prstat O/P

Good Evening everyone, I am confused about prstat O/P as it shows memory values which are different from actual value.Below is the O/P of prstat command and swap commands. NPROC USERNAME SIZE RSS MEMORY TIME CPU 48 root 2113M 1590M 1.2% 45:09.39 32% 31 daemon ... (7 Replies)
Discussion started by: vvpotugunta
7 Replies

5. Solaris

prstat output

Can someone please explain me the "TIME" field of the output of "prstat -p<pid>" command ? The man page says it is "The cumulative execution time for the process". Does it mean how many hrs:min:sec the process is running ? If so then I'm not getting the desired output. Can someone pls help me in... (5 Replies)
Discussion started by: senabhi
5 Replies

6. Shell Programming and Scripting

prstat

hi all, am writing a ksh script on solaris 9 to get the number of threads taken by a process. am using the prstat -p command to do this. output i get is : :"/export/home/user" > prstat -p 25528 | cut -f2 -d/ NLWP 203 Total: 1 processes, 203 lwps, load averages: 2.58, 3.24, 3.62... (2 Replies)
Discussion started by: cesarNZ
2 Replies

7. Solaris

prstat

hi all, was trying to figure out how busy my app was by looking at the performance of the app server. did a 'prstat -s rss' command to find the app servers using most memory. Found a command 'prstat -m' which is meant to show more details on each pid but the output of this command... (1 Reply)
Discussion started by: cesarNZ
1 Replies

8. Shell Programming and Scripting

prstat output

hi all, have a ksh script where i am doing a prstat -m -u osuser 1 1 >> $FILE_NAME but for some reason it only writes 15 lines wheres when i run the same command manually from command prompt it prints out 60 lines. why is it not writing the full 60 lines to the file ?? ta. (1 Reply)
Discussion started by: cesarNZ
1 Replies

9. Solaris

prstat on Solaris 8

On Solaris 8, when I try to run prstat 30 5 as a background process, the command exits 1-2 seconds after it's initiated instead of the 30 seconds I specified. It runs fine in interactive mode. Is there a workaround to this I could use? (Upgrading the package is not an option) A link to... (1 Reply)
Discussion started by: Devyn
1 Replies

10. Solaris

Understanding prstat

Hello We have a SPARC box running Solaris 10. We have 32 GB of physical memory, 32 GB of swap. Now i want to monitor memory usage for performance tuning. The box is running Sybase database. When I type prstat i get the following PID USERNAME SIZE RSS STATE PRI NICE TIME CPU... (4 Replies)
Discussion started by: abohmeed
4 Replies
CIFSIOSTAT(1)							Linux User's Manual						     CIFSIOSTAT(1)

NAME
cifsiostat - Report CIFS statistics. SYNOPSIS
cifsiostat [ -h ] [ -k | -m ] [ -t ] [ -V ] [ interval [ count ] ] DESCRIPTION
The cifsiostat command displays statistics about read and write operations on CIFS filesystems. The interval parameter specifies the amount of time in seconds between each report. The first report contains statistics for the time since system startup (boot). Each subsequent report contains statistics collected during the interval since the previous report. A report con- sists of a CIFS header row followed by a line of statistics for each CIFS filesystem that is mounted. The count parameter can be specified in conjunction with the interval parameter. If the count parameter is specified, the value of count determines the number of reports gener- ated at interval seconds apart. If the interval parameter is specified without the count parameter, the cifsiostat command generates reports continuously. REPORT
The CIFS report provides statistics for each mounted CIFS filesystem. The report shows the following fields: Filesystem: This columns shows the mount point of the CIFS filesystem. rB/s (rkB/s, rMB/s) Indicate the average number of bytes (kilobytes, megabytes) read per second. wB/s (wkB/s, wMB/s) Indicate the average number of bytes (kilobytes, megabytes) written per second. rop/s Indicate the number of 'read' operations that were issued to the filesystem per second. wop/s Indicate the number of 'write' operations that were issued to the filesystem per second. fo/s Indicate the number of open files per second. fc/s Indicate the number of closed files per second. fd/s Indicate the number of deleted files per second. OPTIONS
-h Make the CIFS report easier to read by a human. -k Display statistics in kilobytes per second. -m Display statistics in megabytes per second. -t Print the time for each report displayed. The timestamp format may depend on the value of the S_TIME_FORMAT environment variable (see below). -V Print version number then exit. ENVIRONMENT
The cifsiostat command takes into account the following environment variables: S_TIME_FORMAT If this variable exists and its value is ISO then the current locale will be ignored when printing the date in the report header. The nfsiostat command will use the ISO 8601 format (YYYY-MM-DD) instead. The timestamp displayed with option -t will also be com- pliant with ISO 8601 format. BUG
/proc filesystem must be mounted for cifsiostat to work. FILE
/proc/fs/cifs/Stats contains CIFS statistics. AUTHORS
Written by Ivana Varekova (varekova <at> redhat.com) Maintained by Sebastien Godard (sysstat <at> orange.fr) SEE ALSO
sar(1), pidstat(1), mpstat(1), vmstat(8), iostat(1), nfsiostat(1) http://pagesperso-orange.fr/sebastien.godard/ Linux JANUARY 2011 CIFSIOSTAT(1)
All times are GMT -4. The time now is 04:51 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy