Forum Discussion

ray_tremayne1's avatar
4 years ago

Creating a datapoint from the delta of a datapoint

Is it possible to create a datapoint from the delta of a datapoint ie current value - offset (previous) value. Its obviously possible to create a groovy complex datapoint which uses the API to get the last two available datapoints and find the delta between them but this seems ludicrously inefficient. I'm aware you can generate alerts based on offset, but even with this I cannot seem to include the delta value in the alert message. I'm ok writing the API based groovy complex datapoint but cannot help thinking there has to be a better way and I'm missing something.

Any pointer in the right direction or even confirmation it can only be done using the API will be greatly appreciated.


2 Replies

  • @ray.tremayne you should be able to do this without the API with a counter or gauge type datapoint that you multiply by ##POLLINTERVAL## in a Complex Datapoint. Counter and Derive take the difference of current and previous and divide by the polling interval in seconds.  You might get some slight rounding,  but in most cases this should be fine.

  • I appreciate what you are saying so for each datapoint metric  I want to plot the delta for, I do a normal counter and a normal gauge datapoint for the same oid. Then use ##POLLINTERVAL## in a Complex Datapoint to calculate previous value and from that the delta but I can see serious problems.

    If the original datapoint is a counter say for example ifInOctets, typically used to plot bps of an interface and what I want to plot is the bps delta. Using your method, in the complex datapoint the normal counter datapoint would give me the current Bps rate and the normal gauge datapoint would give me the current raw counter value. Using your method I could calculate the previous raw counter value and as I already have the current raw counter value from the normal gauge datapoint I can calculate the raw counter delta. This is bytes shipped during the poll interval not the bps delta I'm after.

    If the original datapoint is a gauge say for example Active Radius sessions and I want to plot Radius session delta. Using your method I can calculate the previous Radius Sessions delta if the number of sessions has increased if the sessions has decreased then the normal counter datapoint will look like a counter wrap and the value could be nonsense depending on how LM guards against counter wraps.