[mrtg] Re: Reversing targets

Alex van den Bogaerdt alex at slot.hollandcasino.nl
Sat Jul 28 10:49:38 MEST 2001

John Oliver wrote:

> So, at the point that the - is added, graphing from then on will be
> reversed, rather than the whole graph being re-drawn?  That doesn't make
> sense, since the graphs are re-drawn with each run anyway.

the '-' just reverses the 'in' and 'out' counters while taking
the sample.

> Is there a way to make the existing graphs display "properly"?

Sure, read the log file line by line.  Swap the entries.  Write
to the new MRTG log file.

A small script should do it, I never wrote it but the following
should work.  Your mileage may vary, warning: contents can be hot,
don't put into microwave oven, etcetera.

In pseudo code:

   wait until just after an update
   backup the mrtg.log and mrtg.old files
   rename mrtg.log to mrtg.tmp
   read from mrtg.tmp write to mrtg.log
   read 1st line into A B C
   write A C B 
   while not end of file
      read line into A B C D E
      write A C B E D
   close files
   remove mrtg.tmp
   alter the config file so that it has the '-' added to the target

 / alex at slot.hollandcasino.nl                  alex at ergens.op.het.net \
| work                                                         private |
| My employer is capable of speaking therefore I speak only for myself |
| Technical questions sent directly to me will be nuked. Use the list. | 
| http://faq.mrtg.org/                                                 |
| http://rrdtool.eu.org  --> tutorial                                  |

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
WebAdmin    http://www.ee.ethz.ch/~slist/lsg2.cgi

More information about the mrtg mailing list