[mrtg-developers] Mathematical operations on OIDs

Westlake, Simon simon.westlake at twcable.com
Thu Oct 22 16:28:07 CEST 2009


Nisha,

For reference, this is the script I use in order to tune my files (I graph cable modem signal levels and I have to tune all the files to allow them to display negative dB values)

for RRD in `ls /var/www/mrtg/*/*-down.rrd` ; do rrdtool tune $RRD -i ds0:-60 -a ds0:60 blah ; done

You will obviously have to modify the values to match your setup..

HTH

--
Simon Westlake


-----Original Message-----
From: mrtg-developers-bounces at lists.oetiker.ch [mailto:mrtg-developers-bounces at lists.oetiker.ch] On Behalf Of S Shipway
Sent: Wednesday, October 21, 2009 5:29 PM
To: mrtg-developers at lists.oetiker.ch
Subject: Re: [mrtg-developers] Mathematical operations on OIDs


MRTG is able to handle negative values, provided that:
a)       you are using RRDTool as your backend, not native mode, and
b)       You manually set the Minimum for the DS appropriately within the RRD file using RRDTune (MRTG always sets the minimum to 0).

Also, unless this is a gauge, you might need to use 'derive' rather than 'counter' in order to cope with negative slopes.

Steve

________________________________
From: nisha [via MRTG Mailinglists] [mailto:ml-node+3864251-1100011265 at n2.nabble.com]
Sent: Wednesday, 21 October 2009 11:04 p.m.
To: Steve Shipway
Subject: RE: [mrtg-developers] Mathematical operations on OIDs

Hi Steve,

This solution worked. But now i have a problem when the calcualtion results in a negative value.

Lets say [oid1 - (oid2 * 5)] gives a positive value and [oid3 - (oid4 * 10)] gives a negative value then the rrds are not able to update these values and hence my graph shows Nan

Have you come across something like this before? Can mrtg can handle this?

Regards,
Nisha

S Shipway wrote:
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.

Steve

________________________________
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 message @ http://n2.nabble.com/Mathematical-operations-on-OIDs-tp3524231p3864251.html
To start a new topic under MRTG Developers Mailinglist, email ml-node+795384-1747653317 at n2.nabble.com
To unsubscribe from MRTG Developers Mailinglist, click here< (link removed) =>.


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

_______________________________________________
mrtg-developers mailing list
mrtg-developers at lists.oetiker.ch
https://lists.oetiker.ch/cgi-bin/listinfo/mrtg-developers
This E-mail and any of its attachments may contain Time Warner
Cable proprietary information, which is privileged, confidential,
or subject to copyright belonging to Time Warner Cable. This E-mail
is intended solely for the use of the individual or entity to which
it is addressed. If you are not the intended recipient of this
E-mail, you are hereby notified that any dissemination,
distribution, copying, or action taken in relation to the contents
of and attachments to this E-mail is strictly prohibited and may be
unlawful. If you have received this E-mail in error, please notify
the sender immediately and permanently delete the original and any
copy of this E-mail and any printout.



More information about the mrtg-developers mailing list