|
SLES9 snmp calculate CPU usage
I have been struggling with this for a couple of years and think there's a bug in net-snmp on SLES9 SP4 (which I know is now out of support).
servername # rpm -qa | grep snmp
net-snmp-5.1.3.1-0.13
If I look at the Raw CPU for a 2x dual core processor via snmpwalk:
servername # snmpwalk -v 2c -c tsheagan localhost .1.3.6.1.4.1.2021.11.50
UCD-SNMP-MIB::ssCpuRawUser.0 = Counter32: 184552743
servername # snmpwalk -v 2c -c tsheagan localhost .1.3.6.1.4.1.2021.11.51
UCD-SNMP-MIB::ssCpuRawNice.0 = Counter32: 3805228
servername # snmpwalk -v 2c -c tsheagan localhost .1.3.6.1.4.1.2021.11.52
UCD-SNMP-MIB::ssCpuRawSystem.0 = Counter32: 184960730
servername # snmpwalk -v 2c -c tsheagan localhost .1.3.6.1.4.1.2021.11.54
UCD-SNMP-MIB::ssCpuRawWait.0 = Counter32: 293651438
servername # bc -l
bc 1.06
Copyright 1991-1994, 1997, 1998, 2000 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'.
184552743 / (184552743 + 3805228 + 184960730 + 293651438 + 145570191 )
.22713056347615385441
That gives you 22% cpu usage.
But if you look at mpstat or vmstat:
servername # mpstat 5
Linux 2.6.5-7.283-bigsmp (servername) 11/04/09
21:54:17 CPU %user %nice %system %iowait %irq %soft %idle intr/s
21:54:18 all 0.50 0.00 0.25 0.00 0.00 0.25 99.00 4255.00
21:54:19 all 0.25 0.00 0.25 0.00 0.00 0.00 99.50 3528.71
Anybody have any clues what I'm looking at and doing wrong?
Thanks,
Pete
|