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

Terry Kennedy terry-mrtg at glaver.org
Thu May 11 10:23:21 CEST 2017

> 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 )

  I could not even get:

1:public at switchA:::::2 - 2:public at switchA:::::2

  to work when I tried it some time ago, reporting some sort of Perl
parsing error. But that does seem to be working now. Even when I use:

1:public at switchA:::::2 - -2:public at switchA:::::2

  it seems to be working. I've added a graph of that target to the
MRTG page for that customer, in addition to the graph which uses
data from my external script that does the math. The data appears
to be consistent in those two graphs, though it has only run for
a half an hour at this point, but I will continue to watch it. If
it works, we can consider the problem solved because I must have
had some sort of typo in my earlier tests.

  The following is an explanation of why I'm doing what I'm doing
and is probably academic if I'm now getting the results I need:

> BUT then again ...
>  a - ( 0 - b ) = a + b ...
> so I am not quite sure what you try to do ...

  I think the confusion is that there are two minus signs in there,
where the first one means "subtract the values", but the second one
means "swap input and output values for this interface", documented
in the "Reversing" section of the MRTG reference.

  1:public at switchA::::2 is the interface to the customer. It carries a
number of VLANs which are distributed to other ports on the switch.
One of those VLANs is sent to another upstream provider connected to
2:public at switchA::::2. That port is dedicated for the customer's use
and no other traffic will be sent to that port. We do not want to bill
the customer for traffic that comes in on his interface and goes out
to the other upstream provider (and likewise for traffic he receives
from the other upstream provider).

  As an example, consider a 5-minute interval where he sends us 300
Mbit/sec of traffic which comes in on 1:public at switchA::::2. Of that
traffic, 100Mbit/sec goes out 2:public at switchA::::2 to the other
upstream provider. That leaves 200Mbit/sec of traffic from the cus-
tomer which we carry as his primary upstream provider and we bill
him for. Likewise for the reverse direction.

  So the formula is in_1 minus out_2 = in_billable, and out_1 minus
in_2 = out_billable.

        Terry Kennedy     http://www.glaver.org      New York, NY USA

More information about the mrtg mailing list