vmstat's cpu stats on first line of output are always the same


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users vmstat's cpu stats on first line of output are always the same
# 1  
Old 07-24-2009
vmstat's cpu stats on first line of output are always the same

Hello,

I'm seeing this problem with vmstat, where the first line of output always has the same CPU statistics. For example:

Code:
neked@nekedmachine:~$ date && vmstat
Fri Jul 24 06:57:08 EDT 2009
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0 130152 293444  23964 356264    0    0    13   125    0    2  7  7 82  4  0
neked@nekedmachine:~$ date && vmstat
Fri Jul 24 06:57:09 EDT 2009
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0 130152 293444  23964 356264    0    0    13   125    0    2  7  7 82  4  0
neked@nekedmachine:~$ date && vmstat
Fri Jul 24 06:57:11 EDT 2009
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 2  0 130152 293352  23964 356264    0    0    13   125    0    2  7  7 82  4  0
neked@nekedmachine:~$ date && vmstat
Fri Jul 24 06:57:13 EDT 2009
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0 130152 293368  23968 356276    0    0    13   125    0    2  7  7 82  4  0

As you can see, CPU statistics are always context switch=0, user=7, system=7, idle=82, I/O wait = 4.

You could see this problem (on my machine which is CentOS 5, and on another machine which Debian Lenny) by typing:

Code:
watch -n 1 vmstat

However, the problem goes away if you let vmstat update itself at intervals, i.e.:

Code:
neked@nekedmachine:~$ vmstat -n 1
procs -----------memory---------- ---swap-- -----io---- --system-- -----cpu------
 r  b   swpd   free   buff  cache   si   so    bi    bo   in   cs us sy id wa st
 0  0 130152 284248  25264 357732    0    0    13   125    0    2  7  7 82  4  0
 0  0 130152 284248  25264 357732    0    0     0     0 1010  304  1  8 91  0  0
 0  0 130152 284248  25264 357768    0    0     0     0 1030  233  0  1 99  0  0
 0  0 130152 284248  25264 357768    0    0     0     0 1022  235  0  1 99  0  0
 0  0 130152 284248  25264 357772    0    0     0    12 1024  237  0  2 98  0  0
 0  0 130152 284248  25276 357760    0    0     0   744 1024  217  1  2 97  0  0

But you can still see that the first line of vmstat's output above shows the same symptoms.

What explains this? How do I avoid it?

---------- Post updated at 07:32 AM ---------- Previous update was at 07:13 AM ----------

Uhhh... to answer my own inquiry, I should've RTFM. From vmstat's manpage:

Code:
       The first report produced gives averages since the last reboot.   Addi-
       tional  reports  give information on a sampling period of length delay.
       The process and memory reports are instantaneous in either case.

I'll leave this post up there as a cautionary tale for those who ask before doing proper research.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Tool suggestion for collection CPU/memory Stats

Hi, We have around 1000 server (Red Hat + Suse + Parallels + Solaris-9/10/11). Every month, we generate a report for all servers for CPU and Memory utilization in 'percentage used'. This report is generated from HP Openview and frequency is every file minutes. In HP OpenView, we are picking 20... (0 Replies)
Discussion started by: solaris_1977
0 Replies

2. UNIX for Dummies Questions & Answers

Pls. help with vmstat output...

Hi, Users are reporting performance issue on my Sun Solaris 10 server. I am on the server. I don't see a issue or I might be looking at the wrong thing. Please help. I don't see anything on sar. it's all zero on that. Not sure why users are reporting high CPU and unresponsive at times. ... (1 Reply)
Discussion started by: samnyc
1 Replies

3. Shell Programming and Scripting

Please help me to monitor cpu usage vmstat in Redhat Linux .

Hi , Please some one help me How to write a shell script to monitor cpu usage vmstat in Redhat linux . Thanks, (4 Replies)
Discussion started by: saanvi
4 Replies

4. UNIX for Advanced & Expert Users

Shell script to monitor cpu and VMstat, iostat

Hi , I am new to scripting. please help me out how to write a script to monitor cpu , vmstat, iostat in Redhat linux. we are doing the load test. Thanks in advance !!!! (1 Reply)
Discussion started by: saanvi
1 Replies

5. Red Hat

Monotring cpu and VMstat in Redhat Linux

Hi , Please some one help me out . How to write a shell cript to monitor cpu usage vmstat and in Redhat linux . vmstat out put should be in percentage. Thanks in advance !!!! (1 Reply)
Discussion started by: saanvi
1 Replies

6. Solaris

help with vmstat output

Hi all. I need some assistance with my vmstat output. We have several oracle db's running on our solaris machine: SunOS rcworaprd 5.9 Generic_112233-07 sun4u sparc SUNW,Sun-Fire-480R Recently I bumped up our main Oracle database to use 6 GB instead of 4 GB as vmstat output was showing... (1 Reply)
Discussion started by: jamie_collins
1 Replies

7. AIX

vmstat incomprehensible output

Hello everybody, When i run Nmon the output is really incomprehensible vmstat 5 System configuration: lcpu=16 mem=24576MB ent=4.00 kthr memory page faults cpu ----- ----------- ------------------------ ------------ -----------------------... (3 Replies)
Discussion started by: Vit0_Corleone
3 Replies

8. HP-UX

vmstat displays cpu idle time at 100%

Since yesterday the vmstat command is displaying the cpu idle time at 100%At each time interval. It never changes. Not sure what it means other than it Quit calculating that stat. And I'm curious why. Using sar I can display a correctCpu idle percent, but vmstat does not. Any ideas why or... (2 Replies)
Discussion started by: tfrye
2 Replies

9. Solaris

CPU, memory and disk stats

I've been asked to gather CPU, memory and disk stats in the following format: Cpu_Max Cpu_Min Cpu_Avg Mem_Max Mem_Min Mem_Avg Disk_Max Disk_Min Disk_Avg Can anyone please tell me a command to gather all this info? Thanks! Todd (6 Replies)
Discussion started by: ungnown.admin
6 Replies

10. UNIX for Advanced & Expert Users

output of vmstat

i have 2 question about vmstat 1) pin (pagein) output of vmstat is always zero for our system what is the meaning of this? (pout significantly changes depending on the running processes) 2) sometimes react output of vmstat is given in K like 44K sometimes it is given without any unit... (1 Reply)
Discussion started by: gfhgfnhhn
1 Replies
Login or Register to Ask a Question