# [mrtg] R:mrtg expression

Emiliano Panella emilianopanella at yahoo.it
Tue Jan 13 16:12:03 MET 2004

```Thanks for your answer!
1)Can I use variables a e b for sobstitute mib  in the mrtg or target of target ?
Which is the difference from my expression and yours?
Tahnks
Emiliano

On Tue, Jan 13, 2004 at 02:28:13PM +0100, Emiliano Panella wrote:
> Hello
> I 've to calcolate the following expression with the mrtg grapher for input errors and output errors:
> ( ifInErrors/ ifInUcastPkts + ifInNUcastPkts ) * 100
> ( ifOutErrors/ ifOutUcastPkts + ifOutNUcastPkts ) * 100
Substitute variables to simplify:

( a / b + c ) * 100    for input (before &)
( d / e + f ) * 100    for output (after &)

> I use the following sintax:
> Target[err_2]:ifInErrors.2&ifOutErrors:public at mydevice * 100 / ifInUcastPkts.2&ifOutUcastPkts.2:public at mydevice + ifInNUcastPkts.2&ifOutNUcastPkts.2:public at mydevice

a&d * 100 / b&e + c&f  which is
a * 100 / b + c        for input
d * 100 / e + f        for output

This is not the same

> Another question:
> can I use also the parenthesis in the expression?

I think you can. Use plenty of whitespace.

If you can't, rewrite the expression:

(a / b + c ) * 100 = 100 * a / 100 * b + 100 * c

However, you probably want a / (b + c) * 100 to get a percentage
of errors in relation to unicasts+broadcasts.

HTH
Alex
--

---------------------------------
Yahoo! Mail: 6MB di spazio gratuito, 30MB per i tuoi allegati, l'antivirus, il filtro Anti-spam

--
Unsubscribe mailto:mrtg-request at list.ee.ethz.ch?subject=unsubscribe
Archive     http://www.ee.ethz.ch/~slist/mrtg
FAQ         http://faq.mrtg.org    Homepage     http://www.mrtg.org