On Wed, 11 May 2005, Mohr James wrote:

I am curious about the mechanics of how you actually get the data. Do you do the walk once, reading it into an array then parse the array? Or do you do the walk twice, calculating the offset into the table the first time and the do the walk again to get the data?

Normally, one does a walk to get the index-to-name mapping. If you don't have to consider the possibility that someone adds or removes execs before yours in snmpd.conf, you never have to repeat them. It is recommended to do request the ExtName together with the data and verify that the result matches with what you expect (if they don't, someone inserted or removed an exec before yours :-)


When is the command actually run? It seems to me when the walk reaches UCD-SNMP-MIB::extOutput.1, or so it seems.

Yes, it does. This can get quite expensive too. Also, depending on just what you exec, you may significantly distort your data because the extra code will add load to your system.


By the way, your subject indicates that you want to _calculate_ the CPU load. What you've implemented is an _estimate_ of the CPU load. The data you will be rerieving will be wrong unless you retrieve the data at exactly the interval that the underlying tool you "exec" reports. You can only get exact data from the ssCpuRawIdle counter. Anything else is a guess, and usually a wrong guess.

Suppose you have a crontab which runs a program that uses 5 CPU seconds every five minutes. Chances are your exec will show 100% CPU usage if you poll during the execution of that script, and 0% if you poll outside of that (brief) time period. If you use NTP and you use cron to do the polling it is easy to get this to lock-step and show a CPU which is 99.7% idle as 99.7% full. This is why ssCpuRawIdle and friends were introduced. You take a start measurement and the time. You take an end measurement and the time. You divide the difference by the elapsed time and you know the CPU load, instead of having made a (probably wrong) guess at it.

Hope this helps.

Cheers,

                                -- Bert

--
Bert Driehuis -- [EMAIL PROTECTED] -- +31-20-3116119
If the only tool you've got is an axe, every problem looks like fun!


------------------------------------------------------- This SF.Net email is sponsored by Oracle Space Sweepstakes Want to be the first software developer in space? Enter now for the Oracle Space Sweepstakes! http://ads.osdn.com/?ad_id=7393&alloc_id=16281&op=click _______________________________________________ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users

Reply via email to