[mrtg-developers] Mathematical operations on OIDs

S Shipway s.shipway at auckland.ac.nz
Tue Oct 27 05:37:38 CET 2009


Although your Target line uses 4 OIDs, it is only defining 2 variables:  (oid1-5*oid2) and (oid3 -10*oid4).  MRTG needs 2 variables; since usually people have one OID per variable, sometimes people will say MRTG needs 2 OIDs, but it is more precise to say it needs 2 variables, however calculated.

MRTG detects target reset by seeing a normally incrementing counter suddenly drop by a large amount.  In this case, it adds 2^32 to the negative value (or 2^64 if it is a 64bit value)

If you want MRTG to graph the negative values, then this is possible, provided you use RRDTool as the backend and tune the RRD files to allow negative numbers.  The axis will rescale automatically.  If you want to graph the absolute value, then you'll need to write a custom plugin to collect all the data and do the necessary calculations as post-processing functions can only be used per-component.

There's a vague possibility that Tobi used a siumple Perl eval to calculate the value in which case you could do something like
Target[xxxx]: abs( oid1&oid2:comm. at host )
but I think this would fail.

Steve

________________________________
From: nisha [via MRTG Mailinglists] [mailto:ml-node+3896994-737613633 at n2.nabble.com]
Sent: Tuesday, 27 October 2009 5:24 p.m.
To: Steve Shipway
Subject: RE: [mrtg-developers] Mathematical operations on OIDs


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?




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



More information about the mrtg-developers mailing list