According to http://net-snmp.sourceforge.net/docs/mibs/ucdavis.html#scalar_notcurrent
ssCpuIdle, etc are deprecated in favor of the raw variants (
The former values (which don't cover things like nice, wait, kernel, interrupt, etc) returned a percentage value:
The percentage of CPU time spent processing user-level code, calculated over the last minute.
This object has been deprecated in favour of '
ssCpuRawUser(50)', which can be used to calculate the same metric, but over any desired time period.
The raw values return the "raw" number of ticks the CPU spent:
The number of 'ticks' (typically 1/100s) spent processing user-level code.
On a multi-processor system, the '
ssCpuRaw*' counters are cumulative over all CPUs, so their sum will typically be N*100 (for N processors).
My question is: how do you turn the number of ticks into percentage?
That is, how do you know how many ticks per second (it's typically — which implies not always — 1/100s, which either means 1 every 100 seconds or that a tick represents 1/100th of a second).
I imagine you also need to know how many CPUs there are or you need to fetch all the CPU values to add them all together. I can't seem to find a MIB that gives you an integer value for # of CPUs which makes the former route awkward. The latter route seems unreliable because some of the numbers overlap (sometimes). For example,
ssCpuRawWait has the following warning:
This object will not be implemented on hosts where the underlying operating system does not measure this particular CPU metric. This time may also be included within the '
Some help would be appreciated. Everywhere seems to just say that % is deprecated because it can be derived, but I haven't found anywhere that shows the official standard way to perform this derivation.
The second component is that these "ticks" seem to be cumulative instead of over some time period. How do I sample values over some time period?
The ultimate information I want is: % of user, system, idle, nice (and ideally steal, though there doesn't seem to be a standard MIB for this) "currently" (over the last 1-60s would probably be sufficient, with a preference for smaller time spans).