[mrtg-developers] Mathematical operations on OIDs

S Shipway s.shipway at auckland.ac.nz
Fri Aug 28 02:45:08 CEST 2009

This is not possible as you state it; Target line calculations can only be done on an OID pair.  However you might achieve it like this:

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

Note that the spaces around the brackets and arithmetic signs are essential.  'pseudoZero' is a magic MRTG virtualOID that always resolves to zero.

Check the documentation on complex calculated Target lines online at www.mrtg.org<http://www.mrtg.org/> or get a copy of the book from www.steveshipway.org/book<http://www.steveshipway.org/book>

Your example below is using oid4x10 in one place but oid4x8 in another but I guess that's just a typo.


From: nisha (via Nabble) [mailto:ml-user+230579-585948030 at n2.nabble.com]
Sent: Thursday, 27 August 2009 11:02 p.m.
To: Steve Shipway
Subject: [mrtg-developers] Mathematical operations on OIDs

Hi all,

I want to perform mathematical operations on OIDs in the target line. For example, there are 4 oids as shown below:
        traffic packet
In oid1 oid2
Out oid3 oid4

Now i want to apply the following formula
        traffic in  = oid1 - (oid2 * 5)
        traffic out = oid3 - (oid4 * 10)

My target line in router cfg file is like this:
Target[targetname]: oid1&oid3:comm at hostname - (oid2 * 5)&(oid4 * 8):comm at hostname

Is this possible in MRTG? Can the router cfg file handle oids with mathematical operations?

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

More information about the mrtg-developers mailing list