snmp cpu
Dan Nelson
dnelson at allantgroup.com
Tue Nov 30 17:23:40 UTC 2010
In the last episode (Nov 30):
> Hi,
> reading this:
> http://old.nabble.com/Measuring-CPU-usage-via-SNMP-td23392403.html
>
> > So fetching the matching ssCpuRaw* oids and totaling them up should
> > always equal 100% cpu.
>
> but when I fetch cpurawidle it is about 100, system 25
> totalling give me 125. What wrong I do?
Hey! I recognize that post :) Note that ssCpuRawSystem is a synthetic value
that net-snmp generates by adding ssCpuRawKernel and ssCpuRawInterrupt. If
you are doing the totalling yourself, you should ignore it, or you'll be
counting kernel time twice.
In case anyone else reading is unclear:
Totalling the raw values always gives 100% cpu, but the units aren't
percent; they're ticks. You may get a different total on different
machines, depending on Hz and the number of CPUs. If you want to graph the
values as percentages, you'll need to record the previous values for each
variable, then sum the differences to get the total number of ticks for your
sampling period. Then divide each variable's difference by that total to
get a percentage.
Raw values on my machine using a ~ 5-second sampling period:
User Nice Idle Kernel Interrupt
14993233 67689938 1943767096 171721693 11277468
14993237 67690250 1943768892 171722224 11277487
14993246 67690357 1943770991 171722649 11277495
Deltas:
4 312 1796 531 19 Total: 2662
9 107 2099 425 8 Total: 2648
Percent:
0.2 11.7 67.5 19.9 0.7
0.3 4.0 79.3 16.0 0.3
--
Dan Nelson
dnelson at allantgroup.com
More information about the freebsd-questions
mailing list