[mrtg] Math operations

lucap lucap at staff.virgilio.net
Wed May 20 09:39:59 CEST 2015


Hi Steve

I perfectly agree the issue is caused by counters oids.
In effect this problem is not present with other targets with gauge oids.
I'll take into account your precious suggestions in order to solve the 
matter.

Thank you very much for your comprehensive explanation.

Regards
Luca

----- Original Message ----- 
From: "Steve Shipway" <s.shipway at auckland.ac.nz>
To: "lucap" <lucap at staff.virgilio.net>; <mrtg at lists.oetiker.ch>
Sent: Tuesday, May 19, 2015 11:38 PM
Subject: RE: [mrtg] Math operations


>> Target[target]: tcpRetransSegs.0&tcpInErrs.0:community at target /
> tcpOutSegs.0&tcpInSegs.0:community at target * 100
>> MaxBytes[target]: 100
>> Options[target]: growright, nopercent
> ...
>> I have no errors, but data in the RRDTool file are always 0 (zero):
>
> Are you sure that the final value IS more than zero?  You are likely to be
> not evaluating what you think you are evaluating.
>
> You are not running in 'gauge' mode, and so the value will be converted to 
> a
> rate AFTER the Target is evaluated.   Although tcpRetransSegs and 
> tcpOutSegs
> are likely to be counters,  the rate is not calculated until AFTER the
> Target calculation.
>
> Therefore, your Target will first calculate the percentage retrans of out
> since the last counter reset -- and will then calculate the rate of change
> of this percentage, which is likely to be zero or so close as to make no
> odds.
>
> IF retranssegs and insegs were rates, then the calculation would work
> provided you had 'Option[]: gauge' in order to skip the 'convert to a 
> rate'
> step.  HOWEVER, since I do not believe they are, this will not work.
>
> One way to do this will work better if you are using Routers2 as your
> frontend.  In this case, you can run a normal counter rate monitoring for
> the tcpRetransSegs and tcpOutSegs, and then use the option 'dorelpercent'.
> This will calculate the percentage of the first value relative to the
> second:
>
> Target[target]: tcpRetransSegs.0&tcpOutSegs.0:community at target
> MaxBytes[target]: 10000000
> Options[target]: growright, nopercent, dorelpercent
>
> With Routers2, it will display a single percentage line showing the
> percentage of tcpRetransSegs relative to tcpOutSegs.  With Native MRTG, 
> you
> will get a third line showing this percentage, the colour of which you can
> set by adding a fifth option to the Colours[] directive.  Note that the
> MaxBytes value is for the maximum rate of the Target, not the maximum of 
> the
> percentage!
>
> This is the order of where calculations are performed:
>
> (Done by MRTG)
> 1. Target SNMP or backquote data retrieval.
> 2. Target ConversionCode functions
> 3. Target calculations
> (Following are done by RRDTool if in RRD mode)
> 4. Rate calculations (if not Gauge mode)
> 5. Convert to integer (if native mode)
> 6. Stored in RRD database (or log file for native mode)
> (Following are done by web frontend if RRD mode)
> 7. Factor[] calculations
> 8. Any special display options - dorelpercent, c2fi/o, etc
> 9. Graphing
>
> Steve
>
> Steve Shipway
> s.shipway at auckland.ac.nz
>
> 



More information about the mrtg mailing list