# [mrtg-developers] Mathematical operations on OIDs

nisha nisha.sasindran at gmail.com
Tue Oct 27 05:24:01 CET 2009

```
But this time my target line has 4 OIDs instead of 2 OIDs:

Target[targetname]: oid1&oid3:comm at host - ( ( oid2&oid4:comm at host * 5 ) + (
pseudoZero&oid4:comm at host * 5 ) )

So how is it that MRTG is detecting the counter reset for all 4 OIDs?

If the calculation [oid1 - (oid2 * 5)] is returning consecutive negative
values, and if MRTG keeps dropping them, then i'm losing the data for that
period. Though negative it still represents my data.

My graph will show only the positive x and y axis. What if i want to keep
the values by just ignoring the negative sign and take the absolute value.
can that be done in MRTG?

Regards,
Nisha

S Shipway wrote:
>
> If one of the countes wraps, then MRTG should be able to detect it.  The
> only problem would be if two counters wrap during the same polling cycle,
> which may confuse things.
>
> If you don't want the negative numbers, then no trouble - by default,
> since they are outside the defined range (0-maxbytes) they will be
> dropped.  It's if you want to keep them that you need to tune the RRD
> files.
>
> Steve
>
> ________________________________
> Thanks for the response. But my graph needs to have only the positive
> values and not negative values.
> The negative values are caused because the oid3 - (oid4 * 10) calculation
> returns a negative value.
> In my case when oid3 - (oid4 * 10) is a negative value (not always
> though), how can i handle them in mrtg?
>
> And another query is what will happen if the 4 counters (oid1 to oid4)
> overflow?
> For example, the oid4 counter resets at a slower rate than the oid3
> counter. There are chances of getting a spike on the graph when oid3 value
> is very high and oid4 value is negligible and
> oid3 - (oid4 * 10) is approx equal to oid3.
> how can we handle this scenario?
>
>

--
View this message in context: http://n2.nabble.com/Mathematical-operations-on-OIDs-tp3524231p3896994.html
Sent from the MRTG Developers Mailinglist mailing list archive at Nabble.com.

```