# [mrtg] Re: multi-target graphs problems

PAUL WILLIAMSON pwilliamson at mandtbank.com
Thu Apr 1 16:41:07 MEST 2004

```>>> <J.Latimer at sussex.ac.uk> 04/01/04 02:54AM >>>
>Hello to all,
>
>I need some help with MRTG.
>
>I'm monitoring four high speed interfaces and I want to measure the
>Aggregate of 2 x firewall external interfaces minus aggregate of 2 x
>firewall internal, like so:-
>
>[target]: 1:public at 192.168.0.1 + 2:public at 192.168.0.1 -
>3:public at 192.168.0.1 + 4:public at 192.168.0.1
>
>However the graph should be flat (or close to flat) but what I'm actually
>getting is (1+2) (3+4), not (1+2)-(3+4) effectively double the internal and
>external graphs, anyone have any ideas?
>
>Regards.
>
>John

To paraphrase Monty Python - "You need to get to TWO OIDs
in each intended target, not one, not three, two, only after
you have completed one.  Your goal is to get TWO OIDs."

So, MRTG is doing more than I would expect it to do.  If your
goal is to subtract the sum of 3 & 4 from the sum of 1 & 2,
you need to do some additional math.  Do you want one
line on your graph?  If so, you'll need to do one of at least
two things to get there.

1.  Find an OID that always returns 0 and incorporate that into

2.  Write an external script to do the math and not worry about
the OID.

Either way, you need to provide an expression similar to this:

target: OID1&OID2

It can be in a form like so:

target: OID1&0 + OID2&0 - OID3&0 - OID4&0

This will result in adding OIID1 and OID2, then subtracting the
value of OID3 and OID4.  (1+2) - (3+4) is the same as 1 + 2 - 3 - 4.

Remember MRTG doesn't do negative values.

Paul