[mrtg] Possible bug / documentation error in Multi Target Syntax?

Tobias Oetiker tobi at oetiker.ch
Thu May 11 09:05:01 CEST 2017

Hi Terry,

----- On May 11, 2017, at 1:21 AM, Terry Kennedy terry-mrtg at glaver.org wrote:

> http://oss.oetiker.ch/mrtg/doc/mrtg-reference.en.html says (under
> Multi Target Syntax) that " Any syntactically correct expression that
> the Perl interpreter can evaluate to will work" and gives an example
> of adding two targets together (which does work). However, I have
> been unable to get the reverse (subtraction) to work. Am I doing some-
> thing wrong, or is this a documentation error or a programming over-
> sight?
>  To complicate matters a bit, I also need to swap the In/Out values
> on the interface being subtracted (as in the "Reversing" section of
> the manual). I have not attempted this yet, but am wondering if MRTG
> is mis-interpreting the minus sign when working with Multi Target Syn-
> tax. And I'm perplexed by how I would actually put this into the MRTG
> configuration file - I'm coming up with something like:
>  1:public at switchA:::::2 - -2:public at switchA:::::2
>  which is pretty arcane.
>  In case you're wondering "why would anybody want to do that", here
> is the usage case: I have a customer with a link to us which carries
> both traffic he pays me for, as well as traffic we send to another
> interface (to a different upstream) for a fixed fee. The goal is to
> graph "customer input minus upstream output" and "customer output
> minus upstream input", to give a graph that represents only traffic
> he is paying us for.
>  Right now I have a pretty horrible external script to accomplish
> this (available on request), but from reading the documentation, all
> of the pieces to do it inside MRTG should already exist, if I can
> figure out how to combine them.

the problem ist that you are adding a '-' infront of the interface number
you have to use whitespace ... the following should work

 1:public at switchA:::::2 - ( 0 - 2:public at switchA:::::2 )

BUT then again ... 

 a - ( 0 - b ) = a + b ... 

so I am not quite sure what you try to do ... 


>        Terry Kennedy     http://www.glaver.org      New York, NY USA
> _______________________________________________
> mrtg mailing list
> mrtg at lists.oetiker.ch
> https://lists.oetiker.ch/cgi-bin/listinfo/mrtg

Tobi Oetiker, OETIKER+PARTNER AG, Aarweg 15 CH-4600 Olten, Switzerland
www.oetiker.ch tobi at oetiker.ch +41 62 775 9902

More information about the mrtg mailing list