What is the relation between values from TOP and SAR commands?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting What is the relation between values from TOP and SAR commands?
# 1  
Old 06-01-2017
What is the relation between values from TOP and SAR commands?

Hi,

Please have a look at the look at the below top and sar commands.

Code:
top -bn1 | grep load | awk '{printf "CPU Load: %.2f\n", $(NF-2)}'
CPU Load: 0.52

 sar -u 1 1
Linux 3.10.0-514.16.1.el7.x86_64 (mymac)  06/01/2017      _x86_64_        (2 CPU)
 03:27:40 PM    CPU  %user   %nice   %system  %iowait  %steal   %idle
03:27:41 PM     all  12.17   0.00     4.23     0.00     0.00    83.60
Average:        all  12.17   0.00     4.23     0.00     0.00    83.60

Question 1: What is the difference between the CPU load shown by the top command and that shown by the sar command ?

Question 2: How can I get sar command to shown the same value as top ?
# 2  
Old 06-01-2017
Quote:
Originally Posted by mohtashims
[/CODE] Question 1: What is the difference between the CPU load shown by the top command and that shown by the sar command ?
You are extracting the 1 minute load average from "top" but your sar command is displaying the CPU usage. These statistics are only loosely related.
Quote:
Question 2: How can I get sar command to shown the same value as top ?
You can run "sar -q 1 1", the load average you are picking from "top" output would be column labeled "ldavg-1".
This User Gave Thanks to jlliagre For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

awk question in relation to finding "top 3" by group.

Hi, I have a file that contains 3 key element fields with the fourth being a total value, something along the lines of this "Site,Region,Town,Total" . What I need to be able to do is find out the top 3 totals by Site using an AWK program. In my efforts so far I have managed to create either a... (2 Replies)
Discussion started by: timberley
2 Replies

2. Solaris

Relation btw commands, "man" and "more" ???

Hi guys, Hope u r doing find. I have this query. When we check the manual pages for a certain command, say man cat we see the manual page with more What is UNIX really doing here, I mean why not less command instead of more command. And can we have UNIX display the manual pages with less command... (2 Replies)
Discussion started by: gabam
2 Replies

3. Solaris

Memory usage, free and used, using sar, top and vmstat in Solaris zone/container

Hi all, I have a server running an Oracle database that is part of a Solaris M5000 container. Presumably this is referred to as a zone within a cluster, not sure if I get the terminology right. Anyway, a third-party manages the zone and unfortunately is not "helpful/friendly" to assist me on... (1 Reply)
Discussion started by: newbie_01
1 Replies

4. Shell Programming and Scripting

emails using sar or parsar commands

Hi, I am using a script to send email from parsar / sar command for, if there is a specific value for CPU usage. If condition is not working but I can see the variable declared in echo command I am using following script for send email from parsar command, If I comment if and then line... (0 Replies)
Discussion started by: mkashif
0 Replies

5. Shell Programming and Scripting

How to see high values on top

Hello folks, I am searching for pattern, after that i want its presenece on top to bottom basis, like cat abcd.txt |grep "123"|awk {'print $3'} |sort|uniq -c it show result like 10 1.1.1.1 1 1.1.1.1 15 1.1.1.1 100 1.1.1.1 but i want to see this like 100 1.1.1.1 15 1.1.1.44 10... (3 Replies)
Discussion started by: learnbash
3 Replies

6. Shell Programming and Scripting

How to sum values from top

Hi. Im looking for way to sum numbers from top. For example i have such command top -b -n | grep Cpu | cut -c 35 - 39 which give me output 97.0 . Ho can i do with that value any arithmetic actions (for example 97.0 +1)? Using c = $((top -b -n | grep Cpu | cut -c 35 - 39)) gives me... (8 Replies)
Discussion started by: qdf
8 Replies

7. UNIX for Dummies Questions & Answers

Combining two commands that use sar.

hey can anyone tell me how can i combine these two commands so that it is executed only once, but gives me both the results. IDLE=`sar 30 6 | grep Average | awk '{print $1 $5}' ` sar 30 120 | awk '{print $1" "$5}' >> mailx -m -s "$MSG" xyz@abc.com. (5 Replies)
Discussion started by: Ankur Khatri
5 Replies

8. Solaris

Looking for the top Solaris specific commands

I am changing jobs and need to know a little about Solaris specific commands. I come from AIX and we have commands like errpt, smit, and lsattr that are AIX specific. Any help is appreciated. (4 Replies)
Discussion started by: biznatch
4 Replies

9. UNIX for Dummies Questions & Answers

sar and iostat recommended interval/count values.

Hi, I got a request from a client to check on their server's cpu, memory and disk utilization. Am planning to use the sar and iostat commands to achieve this. The server is used for sending and receiving messages between the stockbrokers, so I was thinking to run the commands during the market... (9 Replies)
Discussion started by: 60doses
9 Replies

10. UNIX for Advanced & Expert Users

Commands on Digital Unix equivalent to for "top" and "sar" on other Unix flavour

Hi, We have a DEC Alpha 4100 Server with OSF1 Digital Unix 4.0. Can any one tell me, if there are any commands on this Unix which are equivalent to "top" and "sar" on HP-UX or Sun Solaris ? I am particularly interested in knowing the CPU Load, what process is running on which CPU, etc. ... (1 Reply)
Discussion started by: sameerdes
1 Replies
Login or Register to Ask a Question