[mrtg] Re: Smoother Graphs

Morten S. Nielsen msn at ipt.dtu.dk
Mon May 29 16:12:24 MEST 2000

Mayer, Bernard <bernard.mayer at cp.credit-agricole.fr> [000529 11:57]:
> Hello, and sorry for intrusion, but
> Have you, please, a mrtg.cfg sample ?

No only a hack. 

I have never messed with routers so my solution is only based on 
creative use of the mrtg log files. I have used this target
on displaying service time.

Target[misssvc]: cacheHttpMissSvcTime.5&cacheHttpMissSvcTime.5:public at localhost:3401
Title[misssvc]: MISS median svartid (HTTP)
PageTop[misssvc]: <H1>Cache Statistik: MISS median svartid(HTTP, 5min) </H1>
LegendI[misssvc]:  MISS tid
Legend1[misssvc]:  MISS tid
YLegend[misssvc]: msec
ShortLegend[misssvc]: msec
Options[misssvc]: nopercent, gauge 

Target[logmisssvc]: `/usr/local/sbin/svclog.pl`
Title[logmisssvc]: log MISS median svartid (HTTP)
PageTop[logmisssvc]: <H1>Cache Statistik: log MISS median svartid(HTTP, 5min) *
100</H1><table><tr><td>100 = 9msec svartid </td><td> 200 = 99msec svartid</td><td> 300 = 999msec svartid</td></tr><tr><td>400 = 9sec svartid </td><td>500 = 99sec svartid</td><td>600 = 999sec svartid</td></tr></table>
LegendI[logmisssvc]:  log MISS tid * 100
Legend1[logmisssvc]:  log MISS tid * 100
YLegend[logmisssvc]: log(msec+1)
ShortLegend[logmisssvc]: log(msec+1)
Suppress[logmisssvc]: wmy  
Options[logmisssvc]: nopercent, gauge                                           

The target /usr/local/sbin/svclog.pl is extracting the non logarithmic data
from the mrtg log file /home/httpd/html/mrtg/misssvc.log:

$A=`sed -n 1p < /home/httpd/html/mrtg/misssvc.log` ;
print "$logsvc\n$logsvc\n";                            

I have suppressed the weekly monthly and yearly graphs since the average of the
logarithmic values is not the same as the logarithm of the average values.
If those are needed rateup need to be hacked or one has to use RRDTool 
(which I'm not familiar with).
Note that I use sed to grab the first line of the log file (only "in" value is
used) allthough one could have made all in perl with a few extra lines so
the script may be used on windows too (but then again why would anyone use
windows? :) . Please also note that mrtg demands an integer value returned, 
so in order to get a proper resolution I have multiplied by 100 and converted 
to int.

Use eg.  $logsvc=int(10*log($T[1]+1)/log(2));
if you want exponents of base 2 instead of base 10. 

- The Penguin's  1. We are better together than alone
-     Postulate  2. If you push something hard enough it will fall over
- Morten S. Nielsen           Department of Manufacturing Engineering
- mailto:msn at ipt.dtu.dk       Building 425, 2. floor, DK-2800 Lyngby

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

More information about the mrtg mailing list