|
If your data gatherer were run as a daemon, it would be able to collect and store the value on the first call, and then compare on the subsequent calls. You could also do this via a registry save.
When you first call for counter A, the program returns 0 but saves the current value of A into the registry in a special area along with the time the sample was taken. Next time it is called, it spots that it already has a previous sample, and if the time is not too far into the past (eg, <6 min) then it returns (curren - stored)/timedifference. Then, it stores the current time and value for use on the next call.
RRD actually uses a similar method to calculate the values in the RRAs.
Steve
|