Sponsored Content
Full Discussion: Mpstat and sar
Top Forums Shell Programming and Scripting Mpstat and sar Post 302776837 by busyboy on Thursday 7th of March 2013 03:29:09 AM
Old 03-07-2013
mpstat is a /proc repository based utility and without any parameters, it will display the averaged output since last reboot or as from the man page
Quote:
If no activity has been selected, then the default report is the CPU utilization report.
Code:
# mpstat
01:19:14 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest
01:19:14 PM  all    2.42    0.00    0.65    3.84    0.00    0.01    0.00    0.00
#

sar also gathering data from /proc gives you the output based on the switches without any averages and the default behavior is to start real time reporting ( without any options)

you should be able to see that both mpstat and the sar start giving same output as below:

Code:
# sar -u 1
01:26:30 PM     CPU     %user     %nice   %system   %iowait    %steal     %idle
01:26:31 PM     all      0.50      0.00      0.50      0.00      0.00     99.00
01:26:32 PM     all      0.50      0.00      0.00      0.00      0.00     99.50
01:26:33 PM     all      0.00      0.00      0.50      0.00      0.00     99.50
01:26:34 PM     all      1.00      0.00      0.00      0.00      0.00     99.00
01:26:35 PM     all      0.00      0.00      0.00      0.00      0.00    100.00
01:26:36 PM     all      0.00      0.00      0.50      0.00      0.00     99.50
01:26:37 PM     all      0.50      0.00      0.00      1.99      0.00     97.51
01:26:38 PM     all      0.00      0.00      0.50      0.00      0.00     99.50
01:26:39 PM     all      0.50      0.00      0.00      0.00      0.00     99.50
01:26:40 PM     all      0.50      0.00      0.00      0.00      0.00     99.50

Code:
# mpstat 1
01:26:32 PM  CPU    %usr   %nice    %sys %iowait    %irq   %soft  %steal  %guest   %idle
01:26:33 PM  all    0.00    0.00    0.50    0.00    0.00    0.00    0.00    0.00   99.50
01:26:34 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
01:26:35 PM  all    1.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.00
01:26:36 PM  all    0.00    0.00    0.50    0.00    0.00    0.00    0.00    0.00   99.50
01:26:37 PM  all    0.50    0.00    0.00    1.01    0.00    0.00    0.00    0.00   98.49
01:26:38 PM  all    0.00    0.00    0.50    0.99    0.00    0.00    0.00    0.00   98.51
01:26:39 PM  all    0.00    0.00    0.00    0.00    0.00    0.00    0.00    0.00  100.00
01:26:40 PM  all    0.50    0.00    0.00    0.00    0.00    0.00    0.00    0.00   99.50
01:26:41 PM  all    0.99    0.00    0.50    0.00    0.00    0.00    0.00    0.00   98.51

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

mpstat command

I gave mpstat command in my system.. the o/p is like below CPU minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl 0 199 3 198 112 5 78 95 124 55 0 9 25 14 7 54 1 186 2 97 92 1 45 94 121 41 0 220 27 14 5 54 ... (2 Replies)
Discussion started by: shahnazurs
2 Replies

2. Solaris

Describe the parameters of iostat,vmstat and mpstat

Hi, I am trying to take the Statistics of the machine during load.Can someone explian the parameters of iostat: tty sd1 sd2 sd3 sd4 cpu tin tout kps tps serv kps tps serv kps tps serv kps tps serv us sy wt id vmstat: kthr ... (1 Reply)
Discussion started by: grrajeish
1 Replies

3. Solaris

VMSTAT and MPSTAT anomalies

All: I have a V445 server with four IIIi CPUs and 8 GB RAM running Solaris 10 and an Oracle database along with some app server components and we have had some performance issues - so I collected some VMSTAT and MPSTAT data over the course of three days with a 15-minute polling interval. I... (1 Reply)
Discussion started by: jeffd4d
1 Replies

4. Solaris

mpstat command

Hi, I would like to clearly understand the output of the mpstat command. What is the mutex spins and also context switches? What if we saw that the number of mutex spins is high. Basically, what to look for in the output of the mpstat command? What is wrong and what is ok. what is the value... (3 Replies)
Discussion started by: Pouchie1
3 Replies

5. AIX

topas and mpstat disagree on CPU count

I have a number of LPARs on one P520. All LPARs are running 5.3 and I observe the following: On some LPARs the number of CPUs found do not match between topas and mpstat. Server 1: $ mpstat System configuration: lcpu=4 ent=0.2 mode=Uncapped cpu min maj mpc int cs ics rq ... (1 Reply)
Discussion started by: petervg
1 Replies

6. Linux

Execution problem wid mpstat command

mpstat -P ALL 1 10 it results.. 08:05:54 PM CPU %user %nice %sys %iowait %irq %soft %steal %idle intr/s 08:05:55 PM all 0.00 0.00 0.49 0.00 0.49 0.00 0.00 99.02 1024.75 08:05:55 PM 0 0.00 0.00 0.00 0.00 0.99 0.00 0.00 ... (1 Reply)
Discussion started by: pritesh_patil
1 Replies

7. Shell Programming and Scripting

One script for Linux Monitoring-free, sar, vmstat, mpstat

HI , I am wrirting a script for checking the performance monitoring on Linux System when my application is running. I have to run a test for 30 minutes on some server and while the test is running i have to capture the perfromance metrics of Linux through vmstat , sar, mpstat, free. here is the... (3 Replies)
Discussion started by: Anamica
3 Replies

8. UNIX and Linux Applications

Graphical Representation of mpstat.out file

hi everyone, We've generated mpstat.out file monitoring cpu utilization and the file is ready now.Wanted to generate graphical charts for the same output data. Can anyone pleas suggest tool for the same.? (1 Reply)
Discussion started by: Kathraji
1 Replies

9. Shell Programming and Scripting

Mpstat script output

I have a script which runs the mpstat and prints the output in a file. In order capture highest cpu ususage from the generated output file, have to manually tail the output file and need to grab which cpu has highest value (which is very annoying) Is there a way we can automate that process of... (3 Replies)
Discussion started by: Optimus81
3 Replies

10. Shell Programming and Scripting

Need to get average idle time using mpstat

I want to get average idle time of the server using mpstat. The problem I am having is %idle is not in same columns in all the versions of linux. example 1: example 2: I tried below command as generalized solution but as Average as one less column output is not proper. I am... (1 Reply)
Discussion started by: kumarjohn
1 Replies
sag(1)                                                             User Commands                                                            sag(1)

NAME
sag - system activity graph SYNOPSIS
sag [-e time] [-f file] [-i sec] [-s time] [-T term] [-x spec] [-y spec] DESCRIPTION
The sag utility graphically displays the system activity data stored in a binary data file by a previous sar(1) run. Any of the sar data items may be plotted singly or in combination, as cross plots or versus time. Simple arithmetic combinations of data may be specified. sag invokes sar and finds the desired data by string-matching the data column header (run sar to see what is available). The sag utility requires a graphic terminal to draw the graph, and uses tplot(1) to produce its output. When running Solaris 2.x and OpenWindows, perform the following steps: 1. Run an "xterm" as a Tektronics terminal: prompt# xterm -t 2. In the "xterm" window, run sag specifying a tek terminal: prompt# sag -T tek options OPTIONS
The following options are supported and passed through to sar (see sar(1)): -e time Select data up to time. Default is 18:00. -f file Use file as the data source for sar. Default is the current daily data file /usr/adm/sa/sadd. -i sec Select data at intervals as close as possible to sec seconds. -s time Select data later than time in the form hh[:mm]. Default is 08:00. -T term Produce output suitable for terminal term. See tplot(1) for known terminals. Default for term is $TERM. -x spec x axis specification with spec in the form: name[op name]...[lo hi] name is either a string that will match a column header in the sar report, with an optional device name in square brackets, for example, r+w/s[dsk-1], or an integer value. op is + - * or / surrounded by blank spaces. Up to five names may be specified. Parentheses are not recognized. Contrary to custom, + and - have precedence over * and /. Evaluation is left to right. Thus, A/A+B*100 is evaluated as (A/(A+B))*100, and A+B/C+D is (A+B)/(C+D). lo and hi are optional numeric scale limits. If unspecified, they are deduced from the data. Enclose spec in double-quotes ("") if it includes white space. A single spec is permitted for the x axis. If unspecified, time is used. -y spec y axis specification with spec in the same form as for -x. Up to 5 spec arguments separated by a semi-colon (;) may be given for -y. The -y default is: -y"%usr0100;%usr+%sys0100;%usr+%sys+%wio0100" EXAMPLES
Example 1: Examples of the sag command. To see today's CPU utilization: example$ sag To see activity over 15 minutes of all disk drives: example$ TS=`date +%H:%M` example$ sar -o /tmp/tempfile 60 15 example$ TE=`date +%H:%M` example$ sag -f /tmp/tempfile -s $TS -e $TE -y "r+w/s[dsk]" FILES
/usr/adm/sa/sadd daily data file for day dd ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWaccu | +-----------------------------+-----------------------------+ SEE ALSO
sar(1), tplot(1), attributes(5) SunOS 5.10 4 Mar 1998 sag(1)
All times are GMT -4. The time now is 07:32 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy